From infynon-trace
Configures INFYNON Trace session hooks for automatic memory overview/loading on start and auto-saving on end. Opt-in install to project .claude/settings.json.
How this skill is triggered — by the user, by Claude, or both
Slash command
/infynon-trace:session-hooksThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Activate this skill when:
Activate this skill when:
Session hooks are the automated entry and exit points for Trace's memory operating layer. They ensure that:
@tracer agent is invoked, presents the memory overview, and asks the user which layers to load before work begins@tracer agent auto-saves the session to user memory (no prompt), then asks the user if team memory should be updated tooHooks are opt-in only. When the user asks to set up trace hooks, install them into the project's .claude/settings.json (never system-level).
bash <path-to-code-guardian>/infynon-trace/hooks/install.sh <project-dir>
This creates or merges hooks into <project-dir>/.claude/settings.json.
Create .claude/settings.json in the project root:
{
"hooks": {
"SessionStart": [
{
"matcher": "startup|resume",
"hooks": [
{
"type": "command",
"command": "echo '=== INFYNON TRACE: MEMORY OVERVIEW ===' && infynon trace retrieve --layer canonical 2>/dev/null || echo '[trace] Not initialized. Run: infynon trace init --repo <name> --owner <team> --user <you>' && echo '' && echo '--- Team Memory Index ---' && infynon trace retrieve --layer team 2>/dev/null | head -20 || echo '(no team notes)' && echo '' && echo '--- User Memory Index ---' && infynon trace retrieve --layer user 2>/dev/null | head -10 || echo '(no user notes)' && echo '' && echo '[TRACE-HOOK] Invoke @tracer agent. Ask the user which memory layers to load before proceeding with the session.'",
"timeout": 20
}
]
}
],
"Stop": [
{
"hooks": [
{
"type": "command",
"command": "INPUT=$(cat); if [ \"$(echo \"$INPUT\" | jq -r '.stop_hook_active // false')\" = \"true\" ]; then exit 0; fi; echo '[TRACE-HOOK] Task complete. Invoke @tracer agent to: (1) Auto-save session observations to user memory using infynon trace note add --layer user --tags session-output,auto-saved — no prompt needed. (2) Run infynon trace compact. (3) Ask user if highlights should also be saved to team memory.'",
"timeout": 5
}
]
}
]
}
}
infynon trace retrieve for all layers, injects the memory overview into Claude's context, and instructs Claude to invoke @tracer to ask the user which layers to load.stop_hook_active to prevent infinite loops. When work is complete, instructs @tracer to auto-save to user memory (no prompt) and ask about team memory..claude/settings.json, not ~/.claude/settings.json.claude/settings.json already exists, the install script merges (requires jq).claude/settings.jsonSession Start
│
├── 1. Load canonical memory (always)
│ infynon trace retrieve --layer canonical
│
├── 2. Ask user: "Load team memory?"
│ ├── Yes → infynon trace retrieve --layer team
│ └── No → skip
│
├── 3. (Optional) Load user memory
│ infynon trace retrieve --layer user --author <current-user>
│
└── 4. Pull from remote if configured
infynon trace sync --direction pull
Step 1: Load canonical memory (non-negotiable)
Canonical memory contains architecture decisions, API contracts, and security constraints. The agent must always know these before making changes.
infynon trace retrieve --layer canonical
Review the output. These are the ground rules for this codebase.
Step 2: Ask about team memory
Team memory contains active caveats, handoffs, and working knowledge. It's useful but can be noisy.
Ask the user: "Do you want to load team memory for this session?"
If yes:
infynon trace retrieve --layer team
If the user says no, that's fine — team memory is optional at session start.
Step 3: Optionally load user memory
If the user has personal notes from a previous session:
infynon trace retrieve --layer user --author <username>
Step 4: Pull from remote
If a remote backend is configured, sync to get the latest notes:
infynon trace sync --direction pull
Session End
│
├── 1. Ask user: "Any observations to save?"
│ ├── Yes → Create team/user notes
│ └── No → skip
│
├── 2. Mark session-scoped notes as stale
│ infynon trace note update <id> --status stale
│
├── 3. Flag promotion candidates
│ Any team note reused 3+ times without contradiction
│
├── 4. Compact stale and session notes
│ infynon trace compact
│
├── 5. Push to remote if configured
│ infynon trace sync --direction push
│
└── 6. NEVER auto-update canonical memory
Step 1: Capture new observations
Ask the user if they learned anything worth saving:
"Did you discover anything during this session worth noting? (Architecture changes, caveats, handoff notes, bugs found)"
If yes, create notes in the appropriate layer:
# Team observation
infynon trace note add session-obs-<topic> \
--title "<What was learned>" \
--body "<Details and context>" \
--layer team \
--scope <appropriate-scope> \
--tags session-output
# Personal note
infynon trace note add user-obs-<topic> \
--title "<Personal observation>" \
--body "<Details>" \
--layer user \
--author <username>
Step 2: Update stale notes
If any notes loaded at session start are now outdated:
infynon trace note update <id> --status stale
Step 3: Flag promotion candidates
If a team note was referenced multiple times this session and remains accurate:
infynon trace note update <id> --tags promote,canonical-candidate
Step 4: Compact
Clean up session-scoped and stale notes:
infynon trace compact
Step 5: Push to remote
infynon trace sync --direction push
Step 6: Never auto-update canonical
Even if the agent discovered something important, canonical updates require human review. At most, flag it:
infynon trace note add promote-<topic> \
--title "Promote candidate: <topic>" \
--body "Discovered during session. Needs validation before canonical promotion." \
--layer team \
--tags promote,needs-review
The canonical hook configuration — same as Option 2 above, kept here for reference:
{
"hooks": {
"SessionStart": [
{
"matcher": "startup|resume",
"hooks": [
{
"type": "command",
"command": "echo '=== INFYNON TRACE: MEMORY OVERVIEW ===' && infynon trace retrieve --layer canonical 2>/dev/null || echo '[trace] Not initialized. Run: infynon trace init --repo <name> --owner <team> --user <you>' && echo '' && echo '--- Team Memory Index ---' && infynon trace retrieve --layer team 2>/dev/null | head -20 || echo '(no team notes)' && echo '' && echo '--- User Memory Index ---' && infynon trace retrieve --layer user 2>/dev/null | head -10 || echo '(no user notes)' && echo '' && echo '[TRACE-HOOK] Invoke @tracer agent. Ask the user which memory layers to load before proceeding.'",
"timeout": 20
}
]
}
],
"Stop": [
{
"hooks": [
{
"type": "command",
"command": "INPUT=$(cat); if [ \"$(echo \"$INPUT\" | jq -r '.stop_hook_active // false')\" = \"true\" ]; then exit 0; fi; echo '[TRACE-HOOK] Task complete. Invoke @tracer agent to: (1) Auto-save session to user memory using infynon trace note add --layer user --tags session-output,auto-saved — no prompt needed. (2) Run infynon trace compact. (3) Ask user if highlights should also be saved to team memory.'",
"timeout": 5
}
]
}
]
}
}
If hooks are not configured, the agent should:
@tracer) and run the session start workflownpx claudepluginhub d4rkninja/code-guardian --plugin infynon-traceManages cross-session memory persistence by saving work history, decisions, and learned patterns to `.claude/memory/`. Useful for continuing work across sessions.
Manages cross-session learning and memory persistence by recording session logs, decisions, patterns, and project context in .claude/memory/. Invoked automatically for session handoff and history queries.
Logs session accomplishments, file changes, commits, decisions, and next steps for future recall. Triggered by phrases like 'save diary' or 'wrapping up'.