Skip to content

Commit 67a9ae8

Browse files
committed
docs: extract context
1 parent 8acdc02 commit 67a9ae8

31 files changed

Lines changed: 1330 additions & 1590 deletions

.archcore/.sync-state.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3311,6 +3311,46 @@
33113311
"source": "plugin/plugin-as-mcp-enforcement-boundary.idea.md",
33123312
"target": "plugin/cli-integration-tests.rule.md",
33133313
"type": "related"
3314+
},
3315+
{
3316+
"source": "plugin/skill-surface-collapse.adr.md",
3317+
"target": "plugin/intent-based-skill-architecture.adr.md",
3318+
"type": "extends"
3319+
},
3320+
{
3321+
"source": "plugin/skill-surface-collapse.adr.md",
3322+
"target": "plugin/remove-document-type-skills.adr.md",
3323+
"type": "extends"
3324+
},
3325+
{
3326+
"source": "plugin/skill-surface-collapse.adr.md",
3327+
"target": "plugin/merge-review-status-remove-graph.adr.md",
3328+
"type": "extends"
3329+
},
3330+
{
3331+
"source": "plugin/skill-surface-collapse.adr.md",
3332+
"target": "plugin/inverted-invocation-policy.adr.md",
3333+
"type": "extends"
3334+
},
3335+
{
3336+
"source": "plugin/skill-surface-collapse.adr.md",
3337+
"target": "plugin/skills-system.spec.md",
3338+
"type": "related"
3339+
},
3340+
{
3341+
"source": "plugin/skill-surface-collapse.adr.md",
3342+
"target": "plugin/commands-system.spec.md",
3343+
"type": "related"
3344+
},
3345+
{
3346+
"source": "plugin/skill-surface-collapse.adr.md",
3347+
"target": "plugin/plugin-architecture.spec.md",
3348+
"type": "related"
3349+
},
3350+
{
3351+
"source": "plugin/skill-surface-collapse.adr.md",
3352+
"target": "plugin/component-registry.doc.md",
3353+
"type": "related"
33143354
}
33153355
]
33163356
}

.archcore/plugin/actualize-implementation.plan.md

Lines changed: 40 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ tags:
88
- "skills"
99
---
1010

11+
> **Outcome (2026-05-15):** Plan executed. Layer 1 (`bin/check-staleness`) and Layer 2 (`bin/check-cascade`) shipped as designed. Layer 3 (deep analysis) shipped as the `--drift` mode of `/archcore:audit` rather than as a standalone `/archcore:actualize` intent skill, per `skill-surface-collapse.adr.md`. The drift-mode protocol lives at `skills/audit/lib/drift-detection.md`. All acceptance criteria below are met under the new naming.
12+
1113
## Goal
1214

13-
Implement the 3-layer Actualize system for documentation freshness detection as specified in the Actualize System ADR and Specification. Deliver all components: two new bin scripts (check-staleness, check-cascade), updated session-start script, updated hooks.json, new `/archcore:actualize` intent skill, and updated `/archcore:help` skill.
15+
Implement the 3-layer Actualize system for documentation freshness detection as specified in the Actualize System ADR and Specification. Deliver all components: two new bin scripts (check-staleness, check-cascade), updated session-start script, updated hook configs, deep-analysis mode in the appropriate audit/inspection skill, and updated `/archcore:help` skill.
1416

1517
## Tasks
1618

@@ -29,22 +31,13 @@ Logic:
2931
5. If no changes → exit 0
3032
6. Count changed files
3133
7. For each `.archcore/*.md` document: grep for directory references from changed files
32-
8. Output formatted warning (max 2KB)
34+
8. Output formatted warning (max 2KB), rate-limited to once per 24 hours
3335

3436
Files: `bin/check-staleness` (new, ~50 lines)
3537

3638
**1.2 Extend `bin/session-start`**
3739

38-
Add call to `bin/check-staleness` after the successful `archcore hooks claude-code session-start` line. The staleness output is appended to the session context.
39-
40-
```sh
41-
# After existing archcore hooks call:
42-
STALENESS=$("${CLAUDE_PLUGIN_ROOT}/bin/check-staleness" 2>/dev/null) || true
43-
if [ -n "$STALENESS" ]; then
44-
echo ""
45-
echo "$STALENESS"
46-
fi
47-
```
40+
Add call to `bin/check-staleness` after the successful `archcore hooks <host> session-start` line. The staleness output is appended to the session context.
4841

4942
Files: `bin/session-start` (edit, ~5 lines added)
5043

@@ -64,67 +57,55 @@ Logic:
6457
6. Extract document title from tool result or path
6558
7. Output JSON with `hookSpecificOutput.additionalContext` listing affected documents
6659

67-
Note: Reads `.sync-state.json` directly (faster than CLI call, within 3s budget). This file is always present and updated by MCP tools.
68-
6960
Files: `bin/check-cascade` (new, ~60 lines)
7061

71-
**2.2 Update `hooks/hooks.json`**
62+
**2.2 Update hook configs**
7263

73-
Add new PostToolUse entry for cascade detection:
64+
Add new PostToolUse entry for cascade detection across all hosts:
7465

7566
```json
7667
{
7768
"matcher": "mcp__archcore__update_document",
78-
"hooks": [
79-
{
80-
"type": "command",
81-
"command": "${CLAUDE_PLUGIN_ROOT}/bin/check-cascade",
82-
"timeout": 3
83-
}
84-
]
69+
"hooks": [{"type": "command", "command": "${PLUGIN_ROOT}/bin/check-cascade", "timeout": 3}]
8570
}
8671
```
8772

88-
Append to the existing PostToolUse array (after the MCP validation entry).
89-
90-
Files: `hooks/hooks.json` (edit)
91-
92-
### Phase 3: Layer 3 — Deep Analysis Skill
73+
Files: `hooks/hooks.json`, `hooks/cursor.hooks.json`, `hooks/codex.hooks.json` (edit)
9374

94-
**3.1 Create `skills/actualize/SKILL.md`**
75+
### Phase 3: Layer 3 — Deep Analysis (drift mode of audit)
9576

96-
New Layer 1 intent skill for comprehensive staleness analysis.
77+
**3.1 Move drift protocol into the audit skill**
9778

98-
Frontmatter:
79+
Per `skill-surface-collapse.adr.md`, Layer 3 ships as the `--drift` mode of `/archcore:audit`. Originally this phase was scoped to a new `skills/actualize/SKILL.md`; the same content (routing table, 3-dimension analysis, assisted-fix flow) now lives at `skills/audit/lib/drift-detection.md` and is loaded by `skills/audit/SKILL.md` on `--drift`.
9980

100-
- `name: actualize`
101-
- `argument-hint: "[scope: tag, category, or 'all']"`
102-
- `description: Detect stale documentation and suggest updates based on code changes and relation graph.`
81+
Frontmatter for `audit`:
10382

104-
Note: under the Inverted Invocation Policy (adopted after this plan was drafted), intent skills are auto-invocable and do NOT carry `disable-model-invocation`. The actualize skill follows that policy as shipped.
83+
- `name: audit`
84+
- `argument-hint: "[--deep] [--drift] [category, tag, or scope]"`
85+
- `description: "Audit Archcore docs: dashboard (counts, status, relations, orphans), deep coverage audit, or drift detection (code/cascade/temporal staleness)."`
10586

106-
Content structure (following intent skill pattern):
87+
Content structure for the `audit` skill (drift portion):
10788

10889
1. Title + one-liner
109-
2. When to Use (vs review, vs status)
110-
3. Routing Table (full / tag-scoped / category-scoped / type-scoped)
111-
4. Execution:
90+
2. When to Use (with explicit anti-trigger for capture / decide)
91+
3. Routing Table (default short / `--deep` / `--drift`)
92+
4. Execution (per mode) — drift mode steps loaded from `lib/drift-detection.md`:
11293
- Step 1: Gather (list_documents + list_relations + git log)
11394
- Step 2: Apply scope filter from $ARGUMENTS
114-
- Step 3: Analyze Code→Doc drift (for each doc: extract path references, check git changes)
115-
- Step 4: Analyze Doc→Doc cascade (traverse relation graph, compare modification dates)
116-
- Step 5: Analyze Temporal (draft age, TODO markers, rejected in chains)
95+
- Step 3: Analyze Code→Doc drift
96+
- Step 4: Analyze Doc→Doc cascade
97+
- Step 5: Analyze Temporal
11798
- Step 6: Report (grouped by severity: critical, cascade, temporal)
11899
- Step 7: Assisted fix (offer update_document per finding, one at a time)
119100
5. Result
120101

121-
Files: `skills/actualize/SKILL.md` (new, ~250 lines)
102+
Files: `skills/audit/SKILL.md`, `skills/audit/lib/drift-detection.md` (the latter holds what would have been Phase 3.1's standalone SKILL.md).
122103

123104
### Phase 4: Integration Updates
124105

125106
**4.1 Update `skills/help/SKILL.md`**
126107

127-
Add `/archcore:actualize` to the Quick Start section, between `status` and `help`.
108+
Document the `audit` skill's three modes (default short, `--deep`, `--drift`).
128109

129110
**4.2 Update `agents/archcore-auditor.md`**
130111

@@ -135,21 +116,21 @@ Add a 6th audit dimension: "Code-Document Correlation" — check if documents re
135116
**5.1 Structural validation**
136117

137118
- Verify `bin/check-staleness` and `bin/check-cascade` are executable
138-
- Verify `hooks/hooks.json` has 4 hook entries (1 SessionStart, 1 PreToolUse, 2 PostToolUse — MCP mutations + cascade)
139-
- Verify `skills/actualize/SKILL.md` exists with correct frontmatter
140-
- Count at plan completion: 32 skill directories (8 intent + 6 track + 17 type + 1 utility). Today: 18 skill directories (11 intent + 6 track + 1 utility) after `remove-document-type-skills.adr.md` removed the type-skill layer.
119+
- Verify every host hook config has the cascade matcher
120+
- Verify `skills/audit/lib/drift-detection.md` exists and is loaded by `skills/audit/SKILL.md`
121+
- Count at plan completion (under `skill-surface-collapse.adr.md`): 7 skills total (`init`, `capture`, `decide`, `plan`, `audit`, `context`, `help`)
141122

142123
**5.2 Content validation**
143124

144125
- `bin/check-staleness`: exits 0 in all cases, output < 2KB, works without git
145126
- `bin/check-cascade`: exits 0 in all cases, reads sync-state.json correctly, outputs valid JSON
146-
- `skills/actualize/SKILL.md`: has all 5 intent skill sections, routing table, within 300 lines
147-
- `skills/help/SKILL.md`: lists all primary intent commands
127+
- `skills/audit/SKILL.md`: has all 5 sections, three modes routed deterministically
128+
- `skills/help/SKILL.md`: lists all 7 commands
148129

149130
**5.3 Integration validation**
150131

151132
- `bin/session-start` calls `bin/check-staleness` after context loading
152-
- `hooks/hooks.json` cascade matcher fires only on `update_document`
133+
- Every host hook config's cascade matcher fires only on `update_document`
153134
- No existing hook behavior is broken
154135

155136
## Acceptance Criteria
@@ -159,19 +140,20 @@ Add a 6th audit dimension: "Code-Document Correlation" — check if documents re
159140
- [x] `bin/session-start` includes staleness check output in session context
160141
- [x] `bin/check-cascade` produces cascade warnings after `update_document` when dependents exist
161142
- [x] `bin/check-cascade` exits cleanly with no output when no cascade
162-
- [x] `hooks/hooks.json` has 4 entries: SessionStart, PreToolUse, 2x PostToolUse (MCP mutations + update_document cascade). No PostToolUse Write|Edit entry — PreToolUse already blocks.
163-
- [x] `/archcore:actualize` skill exists with routing table, 3-dimension analysis, and assisted fix
164-
- [x] `/archcore:help` lists all primary commands including actualize
143+
- [x] Every host hook config registers `check-cascade` on `update_document`
144+
- [x] `/archcore:audit --drift` exists with routing, 3-dimension analysis, and assisted fix
145+
- [x] `/archcore:help` lists all 7 primary commands including `audit`
165146
- [x] `archcore-auditor` includes code-doc correlation dimension
166147
- [x] All bin scripts are POSIX shell compatible and exit 0
167148
- [x] All bin scripts degrade gracefully when git or CLI is unavailable
168-
- [x] Total skill directory count at plan completion: 32. Current count (post type-skill removal): 18.
149+
- [x] Total skill directory count at plan completion: 7 (per `skill-surface-collapse.adr.md`)
169150

170151
## Dependencies
171152

172153
- Actualize System ADR (accepted) — architectural decision
173154
- Actualize System Specification (accepted) — detailed contract
174-
- Hooks and Validation System Specification (updated) — extended hook contract
175-
- Plugin Architecture Specification (updated) — intent skills, hooks
176-
- Skills System Specification (updated) — intent skills
177-
- Commands System Specification (updated) — actualize in Tier 1
155+
- Hooks and Validation System Specification — extended hook contract
156+
- Plugin Architecture Specification — intent skills, hooks
157+
- Skills System Specification — intent skills
158+
- Commands System Specification — `audit` in the 7-command surface
159+
- `skill-surface-collapse.adr.md` — the decision that folded Layer 3 into the `audit` skill as `--drift`

.archcore/plugin/actualize-system.adr.md

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,19 @@ tags:
88
- "skills"
99
---
1010

11+
> **Outcome (2026-05-15):** Decision accepted as-is, but Layer 3 shipped as the `--drift` mode of `/archcore:audit` rather than as a standalone `/archcore:actualize` intent skill (see `skill-surface-collapse.adr.md`). The 3-layer architecture, detection dimensions, and naming rationale below remain authoritative; substitute `/archcore:audit --drift` for `/archcore:actualize` throughout.
12+
1113
## Context
1214

13-
The Archcore Claude Plugin has a comprehensive validation system (PreToolUse blocking, PostToolUse validation via `archcore doctor`) that ensures **structural integrity** of `.archcore/` documents. The `/archcore:review` skill provides on-demand health checks for coverage gaps, relation health, and status issues.
15+
The Archcore Plugin has a comprehensive validation system (PreToolUse blocking, PostToolUse validation via `archcore doctor`) that ensures **structural integrity** of `.archcore/` documents. The `/archcore:audit` skill (formerly `/archcore:review`) provides on-demand health checks for coverage gaps, relation health, and status issues.
1416

15-
However, no mechanism detects when documentation **content becomes stale**. Three types of staleness go undetected:
17+
However, no mechanism detected when documentation **content becomes stale**. Three types of staleness went undetected:
1618

1719
1. **Document cascade**: Updating document A while documents that `implements`, `depends_on`, or `extends` A remain unchanged. Example: PRD is rewritten but the plan that `implements` it still describes the old scope.
1820
2. **Code-document drift**: Source code changes that invalidate assumptions, APIs, or patterns described in archcore documents. Example: auth module is refactored but the ADR still describes the old JWT strategy.
1921
3. **Temporal staleness**: Documents stuck in inappropriate statuses — long-lived drafts, plans with passed deadlines, rejected documents still referenced in active chains.
2022

21-
Currently, staleness is only discovered during manual `/archcore:review` invocations or when someone happens to read an outdated document. There is no proactive or reactive detection.
23+
At the time this ADR was drafted, staleness was only discovered during manual audit invocations or when someone happened to read an outdated document. There was no proactive or reactive detection.
2224

2325
## Decision
2426

@@ -36,23 +38,25 @@ Extend `bin/session-start` to run a lightweight git-based staleness check at eve
3638

3739
Add cascade detection logic to the PostToolUse hook pipeline. After `mcp__archcore__update_document`, query the relation graph for documents connected to the updated document via `implements`, `depends_on`, or `extends` relations (where the updated document is the target). Inject a cascade warning naming potentially affected documents.
3840

39-
**Mechanism**: Parse updated document path from tool input, query `archcore` CLI for relations, filter by directional relation types.
41+
**Mechanism**: Parse updated document path from tool input, query the `.sync-state.json` relation graph, filter by directional relation types.
4042

4143
**Character**: Informational only. Injected as `additionalContext` after the update succeeds. Never blocks operations.
4244

43-
### Layer 3 — Deep Analysis (/archcore:actualize intent skill)
45+
### Layer 3 — Deep Analysis (drift mode of /archcore:audit)
4446

45-
Add an 8th Layer 1 intent skill that performs comprehensive staleness analysis on demand. Three detection dimensions:
47+
Add comprehensive staleness analysis on demand. Three detection dimensions:
4648

4749
- **Code→Doc drift**: For each document, find referenced code paths in content, check `git log` for changes since document was last modified.
4850
- **Doc→Doc cascade**: For recently updated documents, traverse the relation graph to find stale dependents.
4951
- **Temporal**: Draft documents older than 30 days, accepted plans with past deadlines, rejected documents still in active relation chains.
5052

5153
Offers interactive assisted fixes via MCP `update_document`.
5254

55+
> When this ADR was originally drafted, Layer 3 was to ship as a standalone `/archcore:actualize` intent skill (8th primary command). It later shipped as the `--drift` mode of the unified `/archcore:audit` skill per `skill-surface-collapse.adr.md`.
56+
5357
### Naming
5458

55-
The skill is named `actualize` because:
59+
The system is called Actualize because:
5660
- `refresh` implies reloading data, not content analysis
5761
- `sync` implies bidirectional synchronization (misleading)
5862
- `update` conflicts with `update_document` MCP tool name
@@ -78,17 +82,17 @@ When document A is updated, which documents may be stale?
7882

7983
## Alternatives Considered
8084

81-
### Only enhance /archcore:review
85+
### Only enhance /archcore:audit (dashboard/deep modes)
8286

83-
Add staleness checks to the existing review skill. **Rejected**: review is on-demand only — no passive or reactive detection. Users must remember to run it. The actualize system catches staleness automatically.
87+
Add staleness checks to the existing audit skill's dashboard or `--deep` mode. **Initially rejected** because review/audit was on-demand only — no passive or reactive detection. The actualize system catches staleness automatically via hooks. **Later partially reconsidered**: Layer 3 of this decision was folded into `/archcore:audit --drift` per `skill-surface-collapse.adr.md`, but Layer 1 and Layer 2 (the hook-driven detection) remained separate as designed.
8488

8589
### Background polling via /loop
8690

8791
Use Claude Code's `/loop` command to periodically check for staleness. **Rejected**: requires a persistent session open in terminal, wasteful of resources, and stops when the user closes the terminal.
8892

8993
### MCP-side staleness check
9094

91-
Add `check_staleness` command to the archcore CLI itself. **Deferred, not rejected**: good for cross-tool portability (works in any IDE plugin, not just Claude Code). The plugin-side implementation delivers value now without CLI changes. If the CLI adds this later, the hook can delegate to it.
95+
Add `check_staleness` command to the archcore CLI itself. **Deferred, not rejected**: good for cross-tool portability. The plugin-side implementation delivers value now without CLI changes. If the CLI adds this later, the hook can delegate to it.
9296

9397
### Git pre-commit hook (outside Claude Code)
9498

@@ -110,4 +114,12 @@ Check staleness before git commits. **Rejected**: wrong timing — by the time t
110114
- **Heuristic false positives**: File-path matching in Layer 1 may flag documents that reference a directory where unrelated files changed. Acceptable tradeoff — false positives are informational nudges, not errors.
111115
- **SessionStart latency**: Layer 1 adds ~1-2 seconds to session startup for git operations. Acceptable — already within the 3-second budget and user expects startup to load context.
112116
- **PostToolUse overhead**: Layer 2 adds relation graph query after every `update_document`. Must complete within existing 3-second timeout.
113-
- **Skill count increase**: Layer 1 intent skills go from 7 to 8. Requires updating plugin-architecture.spec, skills-system.spec, and commands-system.spec constraints.
117+
- **Skill surface**: When this ADR was drafted, the cost was "Layer 1 intent skills go from 7 to 8." That cost was later eliminated by folding Layer 3 into the existing `audit` skill as `--drift`.
118+
119+
### Supersedes
120+
121+
- (none — this is a net addition to the plugin)
122+
123+
### Superseded by (partially)
124+
125+
- The standalone `/archcore:actualize` skill described in this ADR was superseded by `skill-surface-collapse.adr.md`. Layer 3 ships as `/archcore:audit --drift`; Layers 1 and 2 remain as designed.

0 commit comments

Comments
 (0)