Install
$ agentstack add skill-fangxm233-cortex-agent-compound ✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
About
/compound [tier]
Compound engineering phase — turns session work into accumulated system advantage by embedding learnings into conventions, skills, and patterns. Invoked at session close or standalone.
Tier selection
$ARGUMENTS
If an explicit tier is provided ("fast", "full", "deep"), use it. Otherwise, auto-detect:
- Read
agent-server/orient-state.json→lastFullCompoundAt - Read CORTEX.md →
Last consolidationdate, count experiments since then across all projects - Decision:
lastFullCompoundAt= 5 → DEEP (consolidation is due)- Otherwise → FULL
| Tier | Steps | Duration | When | |------|-------|----------|------| | Fast | 1, 2, 10 | ~1-2 turns | Full ran . or Compound (fast): no actions.`
Full compound
Steps 1-2 are the same as fast compound above. Continue with:
Step 3: Scan unactioned recommendations
First, run the recommendation extractor for a structured scan:
npx tsx agent-server/src/recommendation-extractor.ts --days 7 --json
This tool extracts reflection fields, implied tasks from findings, and recommendation sections from skill outputs (diagnose/postmortem/synthesize), deduplicates against existing TASKS.md, and outputs structured candidates.
Use the tool output as a starting point, then apply judgment:
Part A: Reflection field scan
- Review the
reflection_fieldssection from tool output. - For each
behavior adjustments: Has the adjusted behavior been applied in subsequent experiments? If not and it's actionable → create task or apply directly. - For each
process defects: Has a corresponding improvement been made or task created? If not → create task. - Skip entries that describe one-time situational adjustments already superseded by later experiments.
Part B: Implied tasks and recommendations
- Review the
candidatessection from tool output. - For candidates with
is_duplicate: false: verify they are genuinely actionable, then create task in TASKS.md. - For candidates with
is_duplicate: true: skip (already covered). - The tool detects these implied task patterns from experiment findings:
| Pattern | Signal phrases | Implied task | |---------|----------------|--------------| | Failed criterion | "FAIL", "below threshold", "not achieved" | Refined experiment | | Insufficient sample | "N too small", "cannot draw conclusions" | Larger replication | | Confound | "confound", "cannot separate" | Controlled follow-up | | Unexplained result | "unexpected", "mechanism unclear" | Diagnosis | | Multi-phase plan | "Phase N" in body | Check phase-tasks exist |
Anti-loop check: For recommendations about analyzing running experiments, split into preliminary analysis task (satisfiable mid-experiment) and final analysis task (blocked-by experiment completion). Do not create a single "analyze results" task for an experiment that isn't done — it will be selected repeatedly and produce incomplete conclusions each time.
Step 3c: Correction propagation check
Check whether the current session made corrections but lacked Downstream Impact analysis.
Detection method:
- Use
git diffto check if the experiments/index.md index status column has newly addedsupersededorrefinedentries - Check if a CORRECTION paragraph has been added
- Check if the project knowledge/index.md has substantive modifications
For each detected correction:
- Check whether the correction record includes a
#### Downstream Impactparagraph - If missing: run grep to search for consumers, build an Impact table, create tasks for
needs-updateitems - If all corrections already include Impact analysis: skip
Skip condition: No corrections in this session (no supersede/refine, no CORRECTION, no knowledge/index.md modification)
Step 4: Surface open investigations
Scan active project experiments/index.md for unresolved questions:
| Pattern | Signal phrases | Question form | |---------|----------------|---------------| | Unexplained result | "unexpected", "mechanism unclear" | "Why does X despite Y?" | | Untestable hypothesis | "cannot be tested", "future work" | "Under what conditions does H hold?" | | Methodology confound | "asymmetric setup", "confound" | "How to disentangle X from Y?" |
Also check STATUS.md for unresolved "Next" items that imply investigation needs. Generate follow-up tasks in TASKS.yaml if none exist for identified questions.
Part B: Parameter-tuning pattern detection
Scan this session's git diff for "threshold adjustments" — changes where a numeric value was changed from X to Y (timeouts, token limits, retry counts, batch sizes, buffer sizes, etc.).
For each such change, apply five tests:
- Understanding: Do I know the mechanism that required this adjustment?
- Generalization: Is this a problem anyone with a similar system would face?
- Solution existence: Is there a known structural solution, or am I just bumping a number?
- Recurrence: Has this same parameter (or a related one) been adjusted before?
- Trade-off nature: Is the underlying pressure resource-solvable or fundamental?
If ≥2 tests point toward "structural problem" for any adjustment → create a structural review task with provenance citing this session's diff.
Signal to watch for: The same parameter adjusted 2+ times, or two different parameters adjusted for the same underlying reason — these are strong indicators of a structural problem hiding behind incremental fixes.
Step 5: Detect gravity candidates
Check whether this session reveals a pattern that has recurred 3+ times:
- Did you do something manually that a script or validator could do?
- Did you apply judgment that has become routine enough for a convention?
- Did you follow a multi-step procedure that could be simplified into a skill?
Cross-reference with project knowledge/index.md entries: if a knowledge entry has been referenced as decision basis in 3+ experiments, flag it as a knowledge→rule promotion candidate for Step 10.
Step 6: Convention lifecycle check
6a: Project knowledge/index.md lifecycle
Scan each active project's knowledge/index.md:
(i) Staleness check Knowledge entries with verification date > 60 days → flag as potentially stale. Consider: does the problem still exist? Should evidence be refreshed?
(ii) Contradiction check Compare recent experiment conclusions against knowledge/index.md claims. If a recent experiment's findings contradict a knowledge entry → flag for revision.
(iii) Anti-templating check Read the last 3 experiment Reflection blocks. If process defects or behavior adjustments have been "none" for 3+ consecutive experiments → force at least one specific observation next time (per CORTEX.md anti-templating rule).
6b: Decision staleness
Scan context/decisions/ and project-level decisions/ directories:
- Decisions with Status
acceptedolder than 90 days where the context has materially changed → flag for review - Decisions referenced by K-entries that have been superseded or modified → check if the decision's rationale still holds
6c: Skill drift signal
If during this session you worked around a skill instruction or found a skill misleading:
- Note the skill name and the specific instruction that didn't fit
- Flag for
/refresh-skillsevaluation - Do not edit the skill inline during compound — skill edits need full context
Step 10 (full): Act
For each compound finding from Steps 1-6, classify and act:
| Category | Criterion | Action | |----------|-----------|--------| | Direct update | Small, verifiable, self-contained | Apply now (CORTEX.md, skill, project file) | | New task | Larger change, needs design | Add to TASKS.md with provenance | | Knowledge candidate | Recurring pattern with evidence | Add to project knowledge/index.md | | Knowledge→Rule promotion | Knowledge entry referenced in 3+ experiments | Queue to PENDINGAPPROVALS.md | | Decision record | Significant design choice with alternatives | Create DR in decisions/ + add CORTEX.md inline reference | | Approval needed | Governance change | Write to PENDINGAPPROVALS.md |
Direct update rules:
- Additions preferred over modifications (gotchas safer than rewrites)
- Self-contained (future agent understands without this session's context)
- Propagate changes to all locations in same turn
- Growth accounting: When adding 10+ lines to any artifact, identify lines to compress or remove
- Gate: If target skill is >400 lines, must simplify before adding new content. A 300-line skill gets a task; a 400-line skill blocks the addition until simplified. This prevents indefinite deferral of complexity management.
Post-execution state update: Read agent-server/orient-state.json, set lastFullCompoundAt to current timestamp (milliseconds), write back. Preserve all other fields.
Output (full):
Compound (full) — [date]
Session: [1-2 lines what changed]
Learnings: [knowledge candidates or "none"]
Recommendations actioned: [count or "none"]
Corrections propagated: [count or "none" or "no corrections"]
Open investigations: [count or "none"]
Gravity candidates: [count or "none"]
Convention lifecycle: [flags or "none"]
Tasks discovered: [count or "none"]
If no compound actions: Compound (full): no actions this session.
Deep compound
Steps 1-6d and 10 are the same as full compound. Continue with:
Step 7: Consolidation
Trigger: 5+ new experiment entries (across all projects) since the last deep compound.
Read each project's experiments/index.md (entries since last deep compound). Perform:
(a) Pattern scanning Look for recurring patterns across experiments. If a pattern appears in 2+ experiments and isn't already in the relevant project's knowledge/index.md → add new entry to project knowledge/index.md. If a pattern confirms existing knowledge → update evidence and verification date. Cross-project patterns → add to system-level knowledge under context/decisions/ or a project-spanning knowledge note.
Also scan Reflection.behavior adjustments fields: if the same behavioral adjustment appears in 2+ experiments → add to knowledge/index.md (high confidence, verified process improvement).
(b) Gap detection
- Process defect clustering: Same type of process defect in 2+ experiments → log as capability gap
- Goal achievement degradation: 3+ experiments with "partially achieved" and similar root causes → log as systematic blocker
- Repeated blocking: Same step/action blocked in 3+ cycles → log as process/system gap
Classify gaps → Skill gap (propose improvement) | Process gap (propose knowledge/index.md entry or rule) | Knowledge gap (queue an investigation task) | System gap (propose architecture fix).
(c) Knowledge→Rule promotion evaluation Criteria: Entry validated recently + content is process/methodology rule + referenced in 3+ experiments + not redundant with existing CORTEX.md rules. Candidates → queue to PENDING_APPROVALS.md.
(d) Effectiveness tracking
- Knowledge reference scan: check if new experiments reference knowledge/index.md entries as decision basis
- Gap→action closure: check if gaps from previous consolidations had recommended actions that were executed successfully
- Behavioral adjustment follow-through: check if behavior adjustment items from earlier experiments were applied in later ones
Step 7b: Domain knowledge synthesis check (deep mode only)
Check whether any active project has accumulated enough experiment records to warrant domain knowledge synthesis.
- For each active project, count completed experiments in experiments/index.md
- Check whether the project has a knowledge/index.md (or equivalent consolidated knowledge file)
- If a project has 10+ completed experiments AND no knowledge/index.md (or knowledge/index.md hasn't been updated while 5+ new experiments completed since its last update):
- Flag as a domain synthesis candidate
- Create a task:
- [ ] Run domain knowledge synthesis for
- If a project already has knowledge/index.md and 30 per project | Flag for compression or split |
| .claude/skills/*/SKILL.md | >200 flag, >300 task, >400 gate | Tiered response | | context/projects/*/TASKS.md | >150 | Create archival task |
For each exceeding threshold: check TASKS.md for existing task. Create one if missing.
Step 10 (deep): Act
Same as full compound Step 10, plus:
- Record consolidation actions (or "no consolidation needed")
- Record domain synthesis candidates (or "none needed")
- Record complexity monitoring results
- Log compression actions if any
Post-execution state update: Read agent-server/orient-state.json, set both lastFullCompoundAt and lastDeepCompoundAt to current timestamp. Write back preserving all fields.
Output (deep):
Compound (deep) — [date]
Session: [1-2 lines what changed]
Learnings: [knowledge candidates or "none"]
Recommendations actioned: [count or "none"]
Corrections propagated: [count or "none" or "no corrections"]
Open investigations: [count or "none"]
Gravity candidates: [count or "none"]
Convention lifecycle: [flags or "none"]
Consolidation: [patterns found / gaps detected / promotions / effectiveness verified]
Domain synthesis: [projects flagged or "none needed"]
Complexity: [artifacts flagged or "all within limits"]
Tasks discovered: [count or "none"]
Relationship to other skills
- /orient: Session-start awareness. Compound is session-end embedding. Orient reads what compound wrote — feedback cycle.
- /deep-retrospective: Mines historical JSONL logs across days/weeks. Compound operates on single-session learnings.
- /evolve: Discovers skill improvements. Compound may generate evolution candidates.
- /compound-simple: Lightweight version for quick post-task reflection.
Anti-patterns
- Compound theater: Trivial updates to show activity. If nothing learned, log "no compound actions".
- Scope creep: Executing new work. Compound creates tasks and embeds learnings — it does not do the work.
- Ungrounded proposals: Convention changes from single data point. Need 3x recurrence for knowledge entries.
- Skipping: Most common failure. Even "routine work" may have friction worth documenting.
Commit
If standalone: commit changes with descriptive message. If another orchestrated workflow already owns the commit step, defer to that workflow.
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: fangxm233
- Source: fangxm233/cortex-agent
- License: MIT
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet — be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.