| name | sync |
| description | Consolidate session debriefs into a single source of truth (SSOT). Run once daily from the cortex repo. |
/sync - Morning Consolidation (Codex)
Read all unprocessed debriefs from the cortex OACP workspace, enrich them with memory and git context, and rewrite SSOT.md - a compact document that any agent can read at session start.
Arguments
/sync - full consolidation
/sync --dry-run - generate the SSOT without writing to disk
/sync --collect-only - show the collected inputs without writing the SSOT
Instructions
When the user runs /sync, do the following:
1. Load configuration
Read config.yaml from the cortex repo root. If it is missing, fall back to config.example.yaml only to infer the expected keys and defaults.
Extract and expand ~ / $VARS for:
oacp_home - defaults to ${OACP_HOME:-$HOME/oacp}
project - defaults to cortex
cortex_dir - defaults to the current repo root
enrich_sources.oacp_memory - memory base dir and glob pattern
enrich_sources.git_repos - repos to include in git history enrichment
max_ssot_lines - maximum SSOT size (default 60)
Use the resolved values as:
OACP_HOME - expanded oacp_home
CORTEX_PROJECT - expanded project
CORTEX_DIR - expanded cortex_dir
2. Collect unprocessed debriefs
Scan all agent inboxes in the cortex OACP workspace:
command find "$OACP_HOME/projects/$CORTEX_PROJECT/agents" -path "*/inbox/*.yaml" -type f
For each YAML message:
- Parse the envelope with
yaml.safe_load
- Keep only debrief messages - either
channel: debrief or a subject starting with Debrief:
- Extract the message body, source agent, source project, and timestamp
If no debriefs are found, report No new debriefs. SSOT unchanged. and exit cleanly.
If --collect-only was passed, show the collected debriefs and stop after enrichment.
3. Enrich with context
OACP project memory
Read memory files under the configured memory base directory and extract:
- active priorities
- recent decisions
- open threads / blockers
Git history
For each configured git repo, collect recent activity:
git -C <repo_path> log --oneline --since="<lookback_days> days ago"
If a repo is missing locally, skip it and note the omission in the output.
4. Generate the SSOT
Synthesize the debriefs, memory context, and git history into this format:
# SSOT - <YYYY-MM-DD>
> Auto-generated by `/sync`. Do not edit manually.
## Active Work
- <project>: <summary> (<agents involved>). <status>.
## Decisions
- <project>: <decision> (<date>)
## Blockers
- <project>: <blocker>
## Carry-Forward
- [ ] <project>: <next step>
Constraints:
- stay under
max_ssot_lines
- prioritize recent and active work over completed work
- group by project, not by agent or individual session
- drop stale items that no longer affect the next work session
5. Write SSOT.md
Write the generated document to ${CORTEX_DIR}/SSOT.md.
If --dry-run was specified, display the proposed SSOT and skip file writes and inbox cleanup.
6. Clean up processed debriefs
After a successful SSOT write, delete each processed inbox message:
rm "$OACP_HOME/projects/$CORTEX_PROJECT/agents/<agent>/inbox/<message>.yaml"
Do not move processed debriefs into outbox. The sender-side outbox copy created at send time is already the durable record.
No outbound messages are required for the base /sync flow. If you later notify another agent about sync results, use oacp send rather than writing protocol files manually.
7. Confirm
Print:
Sync complete: <N> debriefs processed, SSOT.md updated (<line_count> lines).
Sources: <list of agents/projects that contributed>
Notes
- Run this skill from the cortex repo so it can write
SSOT.md in place
- Codex skills may be installed globally in
~/.codex/skills/ or project-locally in .codex/skills/
- Idempotent: running with no new debriefs is a clean no-op
- Debrief inbox entries are deleted after processing, not moved to outbox