Skip to content

fix: persist runtime skills + volume consolidation + docs overhaul#13

Merged
bupao merged 11 commits intomainfrom
fix/persist-runtime-skills
Mar 13, 2026
Merged

fix: persist runtime skills + volume consolidation + docs overhaul#13
bupao merged 11 commits intomainfrom
fix/persist-runtime-skills

Conversation

@bupao
Copy link
Contributor

@bupao bupao commented Mar 12, 2026

Summary

  • Runtime skill persistence: Skills created by the agent during chat (written to .claude/skills/) are now automatically persisted to $MEMORY_DIR/skills/ before the next sync, surviving container restarts. Both entrypoint.sh and src/skills.ts implement the persist-before-clear logic.
  • Volume consolidation (4→3): Removed SESSIONS_DIR entirely. SDK session state (.claude/) now lives inside MEMORY_DIR, reducing deployment from 4 volumes to 3 (memory, store, org). SESSIONS_DIR env var is deprecated and ignored with a warning.
  • Documentation overhaul: Fixed audit findings across deployment guide and CLAUDE.md. Added consolidated docs/CONFIGURATION_REFERENCE.md with FAQ, task parameters, cross-reference table. Updated all docs for 3-volume model.

Changes

Code (4 files)

  • src/config.ts — Remove SESSIONS_DIR export, add deprecation warning
  • src/index.ts — Use MEMORY_DIR/.claude instead of SESSIONS_DIR
  • src/skills.ts — Persist runtime-created skills + use MEMORY_DIR for destination
  • src/routes/health.ts — Health check sessions field now checks MEMORY_DIR/.claude

Container & deployment (5 files)

  • Dockerfile — Remove /data/sessions, create /data/memory/.claude/skills
  • entrypoint.sh — Runtime skill persist logic, auto-memory circular symlink guard
  • docker-compose.yml — Remove sessions volume
  • Makefile — Remove sessions volume references
  • picoclaw.sh — Remove sessions volume mount

Tests (3 files)

  • src/skills.test.ts — Tests for runtime skill persistence and shadow detection
  • src/entrypoint.test.ts — Test for merged-mode auto-memory symlink skip
  • scripts/e2e-test.sh — Update paths for 3-volume model

Documentation (8 files)

  • docs/CONFIGURATION_REFERENCE.md — New consolidated config reference (12 sections)
  • docs/SERVERLESS_API_DEPLOYMENT_GUIDE.md — Fix audit findings, update volumes
  • docs/DESIGN_RATIONALE.md — Update to 3-volume rationale
  • docs/SECURITY.md — Update filesystem boundary table
  • docs/SKILLS_AND_PERSONA_GUIDE.md — Add .claude/ to memory structure
  • CLAUDE.md — Add missing env vars, update volume table
  • CHANGELOG.md — Volume consolidation entry
  • README.md — Update quick-start for 3-volume model

Migration (existing deployments)

# 1. Stop container
# 2. Move session data into memory volume
cp -r /old-path/sessions/.claude /path-to/memory/.claude
# 3. Remove SESSIONS_DIR env var and sessions volume mount
# 4. Start new version

New deployments need only memory + store (+ optional org).

Test plan

  • npm run build passes
  • npm test — 52/53 pass (1 flaky socket hang up in server.test.ts, pre-existing)
  • npm run format:check passes
  • Docker build succeeds
  • Live API smoke test — all 15 endpoints verified
  • ./scripts/e2e-test.sh with Docker (updated paths)
  • Verify SESSIONS_DIR deprecation warning appears when set

🤖 Generated with Claude Code

bupao and others added 4 commits March 13, 2026 02:14
Skills created during chat (e.g. via Claude Code) are written to
~/.claude/skills/ which resolves to the sessions volume. Previously
these were lost on restart because syncSkills() clears the destination
first. Now both entrypoint.sh and skills.ts persist non-managed skills
back to USER_SKILLS_DIR before wiping the destination.

Also restructured entrypoint.sh to resolve ORG_SKILLS_SRC before the
persist block so it can correctly identify managed vs runtime skills.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…MEMORY_DIR

SDK session state (.claude/) now lives at $MEMORY_DIR/.claude/ instead of
a separate SESSIONS_DIR volume.  Reduces deployment from 4 volumes to 3
(memory, store, org).

SESSIONS_DIR env var is deprecated — a startup warning is printed if set.

USER_SKILLS_DIR env var is removed — user skills are always at
$MEMORY_DIR/skills/, consistent with the consolidation principle.

The runtime-skills persist logic (persistRuntimeSkills) is preserved but
updated: comments now reference "syncSkills() clears the destination"
instead of the former "sessions volume" rationale.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove /data/sessions volume mount from Dockerfile, docker-compose,
Makefile, picoclaw.sh, and e2e test script.

entrypoint.sh changes:
- SESSION_CLAUDE_DIR derived from MEMORY_DIR instead of hardcoded
  /data/sessions
- USER_SKILLS_SRC derived from MEMORY_DIR (no env var override)
- Circular symlink detection for auto-memory when CLAUDE_HOME is
  inside MEMORY_DIR (merged mode)
- Updated comments to remove "sessions volume" references

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Update all docs to reflect 3-volume model (memory, store, org):
- Remove SESSIONS_DIR and USER_SKILLS_DIR from env var tables
- Remove /data/sessions from volume mount examples and diagrams
- Add .claude/ subdirectory to /data/memory descriptions
- Add .claude/CLAUDE.md risk note to SKILLS_AND_PERSONA_GUIDE
- Update DESIGN_RATIONALE "Why Four Separate Volumes" section
- Add volume consolidation entry to CHANGELOG

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@bupao bupao changed the title fix: persist runtime-created skills across container restarts refactor: consolidate SESSIONS_DIR and USER_SKILLS_DIR into MEMORY_DIR Mar 12, 2026
bupao and others added 4 commits March 13, 2026 04:45
…ence

Knowledge extracted from internal analysis documents:

SKILLS_AND_PERSONA_GUIDE.md:
- Configuration reload timing table (per-request / manual reload / restart)
- Runtime-created skills lifecycle (persist-before-clear behavior)
- Agent input context format (XML with timezone, sender, timestamps)
- [SCHEDULED TASK] prefix auto-injection for task-triggered runs
- Persona best practices: trigger conditions, tool priority, degradation
  strategies, full MCP tool name prefix requirement

CLAUDE.md:
- Boot sequence diagram (entrypoint.sh → index.ts → Express)
- additionalDirectories ≠ skill discovery gotcha

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…oute

- Fix Go-Live checklist: :id → /:conversation_id (correct path params)
- Move ANTHROPIC_BASE_URL from Required to Optional (SDK has built-in default)
- Split "Mounted Volumes" into persistent vs ephemeral tables for clarity
- Add note explaining volumes.sessions field is backward-compat alias for .claude/
- Add MEMORY_DIR, STORE_DIR, ASSISTANT_NAME, LOG_LEVEL to CLAUDE.md env table
- Remove ANTHROPIC_BASE_URL from secrets checklist (not a secret)
- Add code comment in health.ts clarifying sessions field

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Single-page reference covering all env vars, API endpoints, volumes,
persona/skills config, MCP servers, and runtime controls. Replaces
scattered information across multiple docs with one scannable document.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Merge valuable content from prior team draft: POST /task parameters,
SDK internal settings, FAQ (Q1-Q6), and configuration cross-reference
table. All references updated for the current 3-volume model.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@bupao bupao changed the title refactor: consolidate SESSIONS_DIR and USER_SKILLS_DIR into MEMORY_DIR fix: persist runtime skills + volume consolidation + docs overhaul Mar 13, 2026
bupao and others added 3 commits March 13, 2026 12:14
Drop the runtime warning for SESSIONS_DIR — the variable is simply
removed. Docs updated to say "removed" instead of "deprecated".

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Revert prettier's padded table alignment (excessive --- separators
and trailing whitespace) back to compact format. Content unchanged.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@bupao bupao merged commit 6190c8f into main Mar 13, 2026
1 check passed
@bupao bupao deleted the fix/persist-runtime-skills branch March 13, 2026 07:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant