Agent skill
zylos-memory
Core memory system. Maintains persistent memory across sessions via tiered markdown files following the Inside Out model. Handles Memory Sync (processing conversations into structured memory), session rotation, consolidation, and context-aware state saving. Must be launched via a runtime-appropriate background subagent mechanism — do not invoke with the Skill tool.
Install this agent skill to your Project
npx add-skill https://github.com/zylos-ai/zylos-core/tree/main/skills/zylos-memory
SKILL.md
Memory System
Maintains persistent memory across sessions via tiered markdown files.
This skill must be run via a runtime-appropriate background subagent mechanism. For Claude, use the Task tool (subagent_type: general-purpose, model: sonnet, run_in_background: true). For Codex, use the current session's available background-agent capability with a Codex-supported model; do not hardcode sonnet.
Architecture
~/zylos/memory/
├── identity.md # Bot soul + digital assets (always loaded)
├── state.md # Active working state (always loaded)
├── references.md # Pointers to config files (always loaded)
├── users/
│ └── <id>/profile.md # Per-user preferences
├── reference/
│ ├── decisions.md # Key decisions with rationale
│ ├── projects.md # Active/planned projects
│ ├── preferences.md # Shared team preferences
│ └── ideas.md # Uncommitted plans and ideas
├── sessions/
│ ├── current.md # Today's session log
│ └── YYYY-MM-DD.md # Past session logs
└── archive/ # Cold storage
Memory Sync
Priority
Memory Sync is the highest-priority internal maintenance task. When triggered, run it before handling queued user messages.
Trigger Paths
- Session init: if C4 unsummarized count is over threshold, launch memory sync.
- Scheduled context check: if context usage is high, launch memory sync.
Both launch a background subagent using the current runtime's supported subagent mechanism with this file's Sync Flow as the prompt.
Sync Flow
- Rotate session log if needed:
node ~/zylos/.claude/skills/zylos-memory/scripts/rotate-session.js - Fetch unsummarized conversations from C4:
node ~/zylos/.claude/skills/comm-bridge/scripts/c4-fetch.js --unsummarizedIf output says "No unsummarized conversations.", skip to step 5 (still save current state). Otherwise, note theend_idfrom the[Unsummarized Range]line. - Read memory files (
identity.md,state.md,references.md, user profiles,reference/*,sessions/current.md). - Extract and classify updates from conversations into the correct files.
- Write memory updates (always — even without new conversations,
update
state.mdandsessions/current.mdwith current context). - Create checkpoint (only if conversations were fetched in step 2):
node ~/zylos/.claude/skills/comm-bridge/scripts/c4-checkpoint.js create <end_id> --summary "SUMMARY" - Confirm completion.
Classification Rules
reference/decisions.md: committed choices that close alternatives.reference/projects.md: scoped work efforts with status.reference/preferences.md: standing team-wide preferences.reference/ideas.md: uncommitted proposals.users/<id>/profile.md: user-specific preferences.state.md: active focus and pending tasks.references.md: pointers only; do not duplicate.envvalues.
File Formats and Examples
Each memory file type has a format definition in references/ and a
worked example in examples/:
| File | Format | Example |
|---|---|---|
identity.md |
references/identity-format.md |
examples/identity.md |
state.md |
references/state-format.md |
examples/state.md |
references.md |
references/references-file-format.md |
examples/references.md |
users/<id>/profile.md |
references/user-profile-format.md |
examples/user-profile.md |
reference/decisions.md |
references/decisions-format.md |
examples/decisions.md |
reference/projects.md |
references/projects-format.md |
examples/projects.md |
reference/preferences.md |
references/preferences-format.md |
examples/preferences.md |
reference/ideas.md |
references/ideas-format.md |
examples/ideas.md |
sessions/current.md |
references/session-log-format.md |
examples/session-log.md |
Supporting Scripts
session-start-inject.js: prints core memory context blocks for hooks.rotate-session.js: rotatessessions/current.mdat day boundary.daily-commit.js: local git snapshot formemory/if changed.consolidate.js: JSON consolidation report (sizes, age, budget checks).memory-status.js: quick health summary.
C4 scripts used by sync flow (provided by comm-bridge skill):
c4-fetch.js --unsummarized: fetch unsummarized conversations and range.c4-checkpoint.js create <end_id> --summary "...": create sync checkpoint.
Consolidation Review
The weekly consolidation task runs consolidate.js and outputs a JSON report.
Review the report and apply these rules:
Core File Budgets
- Files over 100% budget: summarize and trim older entries.
Move historical content to
reference/orarchive/. state.mdis the strictest — must stay under 4KB.
Session Logs
- Logs in
archiveCandidatesOlderThan30Days: move fromsessions/toarchive/.
Reference Files (reference/*.md)
These files have no size cap. Maintenance is at the entry level. Freshness is reported by file mtime (Phase 1 limitation):
- active (< 7 days): no action.
- aging (7–30 days): no action.
- fading (30–90 days): open the file. Review entries by their dates
and status fields. Update or confirm still-relevant entries; move
obsolete entries (superseded/completed/abandoned/dropped) to
archive/. - stale (> 90 days): same as fading, but prioritize review. Entries that are clearly still critical may remain.
Immunity: Entries with importance 1-2 (defined in entry metadata) are immune to automatic fading suggestions. They may still be reviewed but should not be archived based on age alone.
User Profiles
- Profiles over ~1KB: summarize older notes.
General Rules
- Never delete — always move to
archive/. Content is recoverable fromarchive/or git history. - Log consolidation actions in
sessions/current.md.
Best Practices
- Keep
state.mdlean (tight context budget). - Prefer updates over duplication.
- Use explicit dates/timestamps for entries.
- Archive instead of deleting historical data.
- Route user data to user profiles.
- Keep configuration values in config files; use
references.mdas an index.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
web-console
Built-in web interface for communicating with Claude without external services. Use when setting up or configuring the web console channel, or troubleshooting browser-based access.
component-management
Guidelines for managing zylos components via CLI and C4 channels. Use when installing, upgrading, or uninstalling components, or when user asks about available components.
restart-claude
Use when the user asks to restart Claude Code, or after changing settings/hooks/keybindings.
comm-bridge
C4 communication bridge — central gateway for ALL external communication (Telegram, Lark, etc.). Use when replying to users via the "reply via" path, sending proactive messages to external channels, querying recent conversations or checkpoint status (prefer c4-db.js CLI; sqlite3 OK for unsupported queries), fetching conversation history for Memory Sync, or creating checkpoints after sync. Incoming messages are queued by channel bots and delivered to Claude via a PM2 dispatcher daemon. Session-start hooks automatically provide conversation context and can trigger Memory Sync when unsummarized conversations exceed the configured threshold.
new-session
Start a new session when context is high. Claude uses /clear, Codex uses /exit. Use when context is high or when a fresh session is needed.
http
Caddy-based web server providing web console hosting, file sharing, and health check endpoints. Use when configuring HTTP access, setting up file sharing, or troubleshooting web connectivity.
Didn't find tool you were looking for?