azclaude-copilot 0.5.6 → 0.5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +85 -3
- package/package.json +1 -1
- package/templates/agents/orchestrator.md +19 -0
- package/templates/capabilities/shared/parallel-coordination.md +75 -0
- package/templates/commands/parallel.md +34 -2
- package/templates/commands/snapshot.md +11 -0
- package/templates/hooks/user-prompt.js +17 -4
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
{
|
|
10
10
|
"name": "azclaude",
|
|
11
11
|
"description": "AZCLAUDE is a complete AI coding environment for Claude Code. It installs 39 commands, 10 auto-invoked skills, 15 specialized agents, 4 hooks, and a persistent memory system — in one command.\n\nKey features:\n• Memory across sessions — goals.md + checkpoints injected automatically before every session\n• Self-improving loop — /reflect fixes stale CLAUDE.md rules, /reflexes learns from tool-use patterns, /evolve creates agents from git evidence\n• Autonomous copilot mode — /copilot runs a three-tier team (orchestrator → problem-architect → milestone-builder) across sessions until the product ships\n• Spec-driven workflow — /constitute writes project rules, /spec writes structured ACs, /analyze detects plan drift and ghost milestones, /blueprint traces every milestone to a spec\n• Security layer — 111-rule environment scan (/sentinel), pre-write secret blocking, pre-ship credential audit\n• Progressive levels 0–10 — start with CLAUDE.md, grow into multi-agent pipelines and self-evolving environments\n• Zero dependencies — no npm packages, no external APIs, no vector databases. Plain markdown files and Claude Code's native architecture.\n• Smart install — npx azclaude-copilot@latest auto-detects first install vs upgrade vs verify. Context-aware onboarding shows the right next command for your project state.\n\nExample use cases:\n• /setup — scan an existing project, detect stack + domain + scale, fill CLAUDE.md, generate project-specific skills and agents automatically\n• /copilot \"Build a compliance SaaS with trilingual support\" — walk away, come back to working code across multiple sessions\n• /sentinel — run a scored security audit (0–100, grade A–F) across hooks, permissions, MCP servers, agent configs, and secrets\n• /evolve — detect gaps in the environment, generate new skills and agents from git co-change evidence, report score delta (e.g. 42/100 → 68/100)\n• /constitute — write your project's constitution (non-negotiables, architectural commitments, definition of done) — gates all future AI actions\n• /analyze — cross-artifact consistency check: ghost milestones, spec vs. code drift, unplanned commits\n• /reflect — find stale, missing, or contradicting rules in CLAUDE.md and propose exact fixes\n• /debate \"REST vs GraphQL for this project\" — adversarial evidence-based decision with order-independent scoring, logged to decisions.md",
|
|
12
|
-
"version": "0.5.
|
|
12
|
+
"version": "0.5.8",
|
|
13
13
|
"source": {
|
|
14
14
|
"source": "github",
|
|
15
15
|
"repo": "haytamAroui/AZ-CLAUDE-COPILOT",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "azclaude",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.8",
|
|
4
4
|
"description": "AZCLAUDE is a complete AI coding environment for Claude Code. It installs 39 commands, 10 auto-invoked skills, 15 specialized agents, 4 hooks, and a persistent memory system — in one command.\n\nKey features:\n• Memory across sessions — goals.md + checkpoints injected automatically before every session\n• Self-improving loop — /reflect fixes stale CLAUDE.md rules, /reflexes learns from tool-use patterns, /evolve creates agents from git evidence\n• Autonomous copilot mode — /copilot runs a three-tier team (orchestrator → problem-architect → milestone-builder) across sessions until the product ships\n• Spec-driven workflow — /constitute writes project rules, /spec writes structured ACs, /analyze detects plan drift and ghost milestones, /blueprint traces every milestone to a spec\n• Security layer — 111-rule environment scan (/sentinel), pre-write secret blocking, pre-ship credential audit\n• Progressive levels 0–10 — start with CLAUDE.md, grow into multi-agent pipelines and self-evolving environments\n• Zero dependencies — no npm packages, no external APIs, no vector databases. Plain markdown files and Claude Code's native architecture.\n• Smart install — npx azclaude-copilot@latest auto-detects first install vs upgrade vs verify. Context-aware onboarding shows the right next command for your project state.\n\nExample use cases:\n• /setup — scan an existing project, detect stack + domain + scale, fill CLAUDE.md, generate project-specific skills and agents automatically\n• /copilot \"Build a compliance SaaS with trilingual support\" — walk away, come back to working code across multiple sessions\n• /sentinel — run a scored security audit (0–100, grade A–F) across hooks, permissions, MCP servers, agent configs, and secrets\n• /evolve — detect gaps in the environment, generate new skills and agents from git co-change evidence, report score delta (e.g. 42/100 → 68/100)\n• /constitute — write your project's constitution (non-negotiables, architectural commitments, definition of done) — gates all future AI actions\n• /analyze — cross-artifact consistency check: ghost milestones, spec vs. code drift, unplanned commits\n• /reflect — find stale, missing, or contradicting rules in CLAUDE.md and propose exact fixes\n• /debate \"REST vs GraphQL for this project\" — adversarial evidence-based decision with order-independent scoring, logged to decisions.md",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "haytamAroui",
|
package/README.md
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
<a href="#how-it-works-the-execution-pipeline">Pipeline</a> ·
|
|
13
13
|
<a href="#install">Install</a> ·
|
|
14
14
|
<a href="#what-you-get">What You Get</a> ·
|
|
15
|
+
<a href="#structured-for-claude-frontmatter--xml-tags">Structure</a> ·
|
|
15
16
|
<a href="#architecture-philosophy">Architecture</a> ·
|
|
16
17
|
<a href="#autonomous-mode">Autonomous Mode</a> ·
|
|
17
18
|
<a href="#parallel-execution">Parallel</a> ·
|
|
@@ -93,7 +94,6 @@ AZCLAUDE sits as a mandatory middleware firewall between your input and Claude.
|
|
|
93
94
|
┌──────────────────────────────────────────────────────────────┐
|
|
94
95
|
│ 5. OUTBOUND SECURITY & MEMORY TRACKING │
|
|
95
96
|
│ ├─► pre-tool-use.js: blocks curl|bash, secrets, traversal │
|
|
96
|
-
│ ├─► Native execution: Claude runs the approved command │
|
|
97
97
|
│ └─► post-tool-use.js: writes breadcrumb to goals.md │
|
|
98
98
|
└──────────────────────────────────────────────────────────────┘
|
|
99
99
|
```
|
|
@@ -117,6 +117,7 @@ One command, no flags. Auto-detects whether this is a fresh install or an upgrad
|
|
|
117
117
|
```bash
|
|
118
118
|
npx azclaude-copilot@latest doctor # 32 checks — verify everything is wired correctly
|
|
119
119
|
```
|
|
120
|
+
│ ├─► Native execution: Claude runs the approved command │
|
|
120
121
|
|
|
121
122
|
---
|
|
122
123
|
|
|
@@ -155,6 +156,87 @@ npx azclaude-copilot@latest doctor # 32 checks — verify everything is wired
|
|
|
155
156
|
|
|
156
157
|
---
|
|
157
158
|
|
|
159
|
+
## Structured for Claude: Frontmatter + XML Tags
|
|
160
|
+
|
|
161
|
+
Anthropic's research shows Claude comprehends structured content significantly better when it uses two patterns natively built into Claude Code: **YAML frontmatter** for metadata and **`<instructions>` XML tags** for content. AZCLAUDE applies both to every agent and skill file — not as convention, but because it measurably changes how Claude reads, routes, and executes them.
|
|
162
|
+
|
|
163
|
+
### Why this matters
|
|
164
|
+
|
|
165
|
+
Claude was trained on XML-structured content. Tags like `<instructions>`, `<context>`, and `<examples>` signal boundaries Claude parses reliably — unlike prose headings which are ambiguous. Frontmatter gives Claude Code the metadata it needs to route, describe, and invoke agents without any extra configuration.
|
|
166
|
+
|
|
167
|
+
### What AZCLAUDE agent files look like
|
|
168
|
+
|
|
169
|
+
```yaml
|
|
170
|
+
--- ← YAML frontmatter block
|
|
171
|
+
name: code-reviewer ← agent identifier (used by subagent_type=)
|
|
172
|
+
description: > ← Claude Code reads this to decide when to spawn
|
|
173
|
+
Autonomous code review agent.
|
|
174
|
+
Use when: review, audit, PR review,
|
|
175
|
+
find bugs, security check.
|
|
176
|
+
model: opus ← which model this agent runs on
|
|
177
|
+
tools: [Read, Glob, Grep, Bash] ← allowed tools (principle of least privilege)
|
|
178
|
+
disallowedTools: [Write, Edit, Agent] ← explicit deny list — no write access
|
|
179
|
+
permissionMode: plan ← read-only by default
|
|
180
|
+
maxTurns: 30 ← bounded execution
|
|
181
|
+
tags: [review, pr, quality] ← semantic routing hints
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
# Code Reviewer
|
|
185
|
+
|
|
186
|
+
<instructions> ← XML tag: Claude parses this as structured directives
|
|
187
|
+
|
|
188
|
+
## Layer 1: PERSONA
|
|
189
|
+
Code review specialist. Read-only — never modifies code.
|
|
190
|
+
|
|
191
|
+
## Layer 2: SCOPE
|
|
192
|
+
- Reviews staged/unstaged changes via `git diff`
|
|
193
|
+
- Checks for bugs, logic errors, edge cases
|
|
194
|
+
- Identifies security issues (injection, XSS, OWASP top 10)
|
|
195
|
+
|
|
196
|
+
</instructions>
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### What AZCLAUDE skill files look like
|
|
200
|
+
|
|
201
|
+
```yaml
|
|
202
|
+
--- ← YAML frontmatter
|
|
203
|
+
name: test-first
|
|
204
|
+
description: > ← auto-invocation trigger — Claude reads this
|
|
205
|
+
Guides test-driven development.
|
|
206
|
+
Use when about to write code, implement a feature, fix a bug,
|
|
207
|
+
refactor, add an endpoint, or modify business logic.
|
|
208
|
+
tags: [tdd, testing, coverage]
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
# Test-First
|
|
212
|
+
|
|
213
|
+
<instructions> ← structured content block
|
|
214
|
+
|
|
215
|
+
## Check before enforcing
|
|
216
|
+
TDD is opt-in. Check BOTH signals:
|
|
217
|
+
1. CLAUDE.md has a TDD rule
|
|
218
|
+
2. Test files exist (*.test.*, *.spec.*)
|
|
219
|
+
|
|
220
|
+
Both present → TDD protocol active.
|
|
221
|
+
Either missing → suggest TDD, don't block.
|
|
222
|
+
|
|
223
|
+
</instructions>
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
### Why this architecture works
|
|
227
|
+
|
|
228
|
+
| Pattern | What it does |
|
|
229
|
+
|---------|-------------|
|
|
230
|
+
| `description:` frontmatter | Claude Code reads this to decide when to auto-invoke a skill or which agent to spawn. No code required. |
|
|
231
|
+
| `model: opus` frontmatter | Routes complex review tasks to the most capable model automatically. |
|
|
232
|
+
| `tools:` + `disallowedTools:` | Principle of least privilege — code-reviewer cannot Write, milestone-builder cannot call Agent. |
|
|
233
|
+
| `<instructions>` XML tag | Signals to Claude "parse this as directives" — not prose, not documentation, not commentary. |
|
|
234
|
+
| `permissionMode: plan` | Agents that only read run in plan mode — no accidental writes, no permission prompts. |
|
|
235
|
+
|
|
236
|
+
All 15 AZCLAUDE agents and all 10 skills use this exact format. Claude Code routes them, describes them in `/help`, and invokes them via `subagent_type=` — all from the frontmatter, zero extra config.
|
|
237
|
+
|
|
238
|
+
---
|
|
239
|
+
|
|
158
240
|
## Architecture Philosophy
|
|
159
241
|
|
|
160
242
|
**AZCLAUDE uses Markdown files and lifecycle hooks — not MCP servers — as its core architecture.** This is a deliberate engineering decision, not a gap.
|
|
@@ -542,11 +624,11 @@ AZCLAUDE is a lazy-loaded environment of 48 capability modules. It only loads wh
|
|
|
542
624
|
|
|
543
625
|
## Verified
|
|
544
626
|
|
|
545
|
-
|
|
627
|
+
1805 tests. Every template, command, capability, agent, hook, and CLI feature verified.
|
|
546
628
|
|
|
547
629
|
```bash
|
|
548
630
|
bash tests/test-features.sh
|
|
549
|
-
# Results:
|
|
631
|
+
# Results: 1805 passed, 0 failed, 1805 total
|
|
550
632
|
```
|
|
551
633
|
|
|
552
634
|
---
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "azclaude-copilot",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.8",
|
|
4
4
|
"description": "AI coding environment — 39 commands, 10 skills, 15 agents, memory, reflexes, evolution. Install: npx azclaude-copilot@latest, then open Claude Code.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"azclaude": "bin/cli.js",
|
|
@@ -36,6 +36,25 @@ If CLAUDE.md unfilled → run `/setup` with intent from copilot-intent.md first.
|
|
|
36
36
|
|
|
37
37
|
---
|
|
38
38
|
|
|
39
|
+
### Step 1b: Resume Interrupted Parallel Wave
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
cat .claude/parallel-wave-state.md 2>/dev/null
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
If the file exists with `status: in-flight` → a previous session was interrupted mid-parallel-dispatch.
|
|
46
|
+
|
|
47
|
+
**Do NOT skip this. Do NOT start a new wave until the interrupted wave is resolved.**
|
|
48
|
+
|
|
49
|
+
Follow the Resume Protocol from `capabilities/shared/parallel-coordination.md`:
|
|
50
|
+
1. Read the wave state file — it lists every milestone, branch, and last-known status
|
|
51
|
+
2. For each `running` milestone: check if `parallel/{slug}` branch exists and has commits
|
|
52
|
+
3. Branches with commits → mark `done`, proceed to merge
|
|
53
|
+
4. Branches without commits or missing → re-dispatch those milestones
|
|
54
|
+
5. After all milestones resolved → merge → delete `.claude/parallel-wave-state.md` → continue
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
39
58
|
### Step 2: Select Next Milestone Wave
|
|
40
59
|
|
|
41
60
|
**If plan.md has `Wave:` fields** (blueprint wrote them — read directly):
|
|
@@ -166,6 +166,78 @@ These rules are injected by orchestrator into every parallel milestone-builder p
|
|
|
166
166
|
|
|
167
167
|
---
|
|
168
168
|
|
|
169
|
+
## Wave State File — Context Loss Protection
|
|
170
|
+
|
|
171
|
+
During parallel execution, the orchestrator writes `.claude/parallel-wave-state.md` **before dispatching any agents**. This file survives context compaction and enables session resume.
|
|
172
|
+
|
|
173
|
+
### Format
|
|
174
|
+
|
|
175
|
+
```markdown
|
|
176
|
+
---
|
|
177
|
+
wave: {N}
|
|
178
|
+
started: {ISO timestamp}
|
|
179
|
+
status: in-flight
|
|
180
|
+
milestones: [M3, M4, M5]
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
| Milestone | Branch | Status | Commit | Notes |
|
|
184
|
+
|-----------|--------|--------|--------|-------|
|
|
185
|
+
| M3 — Auth endpoints | parallel/m3-auth | running | — | P1 slot |
|
|
186
|
+
| M4 — User profile | parallel/m4-profile | done | a1b2c3d | merged to worktree |
|
|
187
|
+
| M5 — Email service | parallel/m5-email | failed | — | timeout on test suite |
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Lifecycle
|
|
191
|
+
|
|
192
|
+
1. **Created** — by `/parallel` Step 4 or orchestrator Step 4, before agent dispatch
|
|
193
|
+
2. **Updated** — as each agent reports completion (status → `done`/`failed`, commit hash filled)
|
|
194
|
+
3. **Deleted** — by orchestrator Step 8 or `/parallel` Step 8, after all branches merged and cleanup done
|
|
195
|
+
|
|
196
|
+
### Rules
|
|
197
|
+
|
|
198
|
+
- The file MUST exist whenever parallel agents are in-flight
|
|
199
|
+
- If this file exists at session start → a previous wave was interrupted → trigger Resume Protocol
|
|
200
|
+
- Only the orchestrator or `/parallel` command writes this file — builders never touch it
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
## Resume Protocol — Recovering Interrupted Waves
|
|
205
|
+
|
|
206
|
+
When the orchestrator or `/parallel` finds `.claude/parallel-wave-state.md` at session start:
|
|
207
|
+
|
|
208
|
+
### Step 1: Read Wave State
|
|
209
|
+
```bash
|
|
210
|
+
cat .claude/parallel-wave-state.md
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### Step 2: Check Each Branch
|
|
214
|
+
For every milestone with `status: running` (was in-flight when session died):
|
|
215
|
+
```bash
|
|
216
|
+
# Does the branch exist?
|
|
217
|
+
git branch --list "parallel/{slug}"
|
|
218
|
+
|
|
219
|
+
# Does it have commits beyond the fork point?
|
|
220
|
+
git log main..parallel/{slug} --oneline 2>/dev/null | head -5
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
### Step 3: Classify Each Milestone
|
|
224
|
+
|
|
225
|
+
| Branch exists? | Has commits? | Action |
|
|
226
|
+
|---------------|-------------|--------|
|
|
227
|
+
| Yes | Yes | Mark `done` in wave state — ready to merge |
|
|
228
|
+
| Yes | No | Agent never started — re-dispatch |
|
|
229
|
+
| No | — | Branch was cleaned up or never created — re-dispatch |
|
|
230
|
+
|
|
231
|
+
### Step 4: Resume
|
|
232
|
+
- Milestones marked `done` or with commits → proceed to Merge Protocol
|
|
233
|
+
- Milestones needing re-dispatch → spawn new agents (same parameters as original dispatch)
|
|
234
|
+
- Update `.claude/parallel-wave-state.md` with new statuses before re-dispatching
|
|
235
|
+
|
|
236
|
+
### Step 5: Continue Normal Flow
|
|
237
|
+
After resume completes, continue with Merge Protocol → Plan Update → Cleanup as usual.
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
169
241
|
## Ownership Map Cleanup
|
|
170
242
|
|
|
171
243
|
After wave merge is complete:
|
|
@@ -173,4 +245,7 @@ After wave merge is complete:
|
|
|
173
245
|
# Remove ownership.md entries for the completed wave
|
|
174
246
|
# (or replace the table with a merge record)
|
|
175
247
|
echo "## Wave {N} merged — {timestamp}" >> .claude/ownership.md
|
|
248
|
+
|
|
249
|
+
# CRITICAL: Delete wave state file — prevents false resume on next session
|
|
250
|
+
rm -f .claude/parallel-wave-state.md
|
|
176
251
|
```
|
|
@@ -21,6 +21,18 @@ Load: `capabilities/shared/parallel-coordination.md`
|
|
|
21
21
|
|
|
22
22
|
---
|
|
23
23
|
|
|
24
|
+
## Step 0: Check for Interrupted Wave
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
cat .claude/parallel-wave-state.md 2>/dev/null
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
If the file exists with `status: in-flight` → a previous parallel session was interrupted.
|
|
31
|
+
Follow the **Resume Protocol** from `parallel-coordination.md` before starting a new wave.
|
|
32
|
+
Only proceed to Step 1 after the interrupted wave is fully resolved (merged or re-dispatched).
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
24
36
|
## Step 1: Parse Targets
|
|
25
37
|
|
|
26
38
|
```bash
|
|
@@ -68,9 +80,9 @@ If any milestone returns `Parallel Safe: NO` → exclude from parallel wave, run
|
|
|
68
80
|
|
|
69
81
|
---
|
|
70
82
|
|
|
71
|
-
## Step 4: Write Ownership Map
|
|
83
|
+
## Step 4: Write Ownership Map + Wave State
|
|
72
84
|
|
|
73
|
-
|
|
85
|
+
**4a. Ownership map** — create or update `.claude/ownership.md`:
|
|
74
86
|
|
|
75
87
|
```
|
|
76
88
|
## Active Parallel Session — {ISO timestamp}
|
|
@@ -83,6 +95,24 @@ Initiated by: /parallel command
|
|
|
83
95
|
| P2 | M{N} — {title} | parallel/m{n}-{slug} | {dirs from spec} | pending |
|
|
84
96
|
```
|
|
85
97
|
|
|
98
|
+
**4b. Wave state file** — write `.claude/parallel-wave-state.md` BEFORE dispatching agents:
|
|
99
|
+
|
|
100
|
+
```markdown
|
|
101
|
+
---
|
|
102
|
+
wave: {N}
|
|
103
|
+
started: {ISO timestamp}
|
|
104
|
+
status: in-flight
|
|
105
|
+
milestones: [{list}]
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
| Milestone | Branch | Status | Commit | Notes |
|
|
109
|
+
|-----------|--------|--------|--------|-------|
|
|
110
|
+
| M{N} — {title} | parallel/m{n}-{slug} | running | — | P1 slot |
|
|
111
|
+
| M{N} — {title} | parallel/m{n}-{slug} | running | — | P2 slot |
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
This file survives context compaction. If the session dies mid-wave, the next session reads this file to resume.
|
|
115
|
+
|
|
86
116
|
---
|
|
87
117
|
|
|
88
118
|
## Step 5: Dispatch All Agents Simultaneously
|
|
@@ -116,6 +146,7 @@ Worktree rules (MANDATORY):
|
|
|
116
146
|
After all agents complete:
|
|
117
147
|
- Collect all completion reports
|
|
118
148
|
- Mark each as COMPLETE or FAILED in ownership.md
|
|
149
|
+
- **Update `.claude/parallel-wave-state.md`** — set each milestone's Status to `done`/`failed`, fill Commit hash
|
|
119
150
|
|
|
120
151
|
---
|
|
121
152
|
|
|
@@ -150,6 +181,7 @@ git branch -d parallel/{slug-1} parallel/{slug-2}
|
|
|
150
181
|
|
|
151
182
|
Update `.claude/plan.md` — set merged milestones to `status: done`.
|
|
152
183
|
Update `.claude/ownership.md` — replace active table with merge record.
|
|
184
|
+
**Delete `.claude/parallel-wave-state.md`** — wave is complete, prevent false resume on next session.
|
|
153
185
|
|
|
154
186
|
Show final report:
|
|
155
187
|
```
|
|
@@ -17,6 +17,14 @@ This is different from `/persist` (end-of-session). Checkpoint = mid-flight snap
|
|
|
17
17
|
|
|
18
18
|
Read `.claude/memory/goals.md` — scan the "In progress" entries and "Current threads."
|
|
19
19
|
|
|
20
|
+
**Step 1b: Detect Active Parallel Wave**
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
cat .claude/parallel-wave-state.md 2>/dev/null
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
If the file exists → a parallel wave is active. Read it and include wave status in the checkpoint (Step 2).
|
|
27
|
+
|
|
20
28
|
---
|
|
21
29
|
|
|
22
30
|
## Step 2: Write Checkpoint File
|
|
@@ -48,6 +56,9 @@ files_in_progress: [{list from goals.md ## In progress}]
|
|
|
48
56
|
|
|
49
57
|
## Risk / open question
|
|
50
58
|
{Anything uncertain that needs resolution — or "None"}
|
|
59
|
+
|
|
60
|
+
## Active parallel wave (if any)
|
|
61
|
+
{Copy the full contents of .claude/parallel-wave-state.md here, or "No active wave"}
|
|
51
62
|
```
|
|
52
63
|
|
|
53
64
|
Create the directory if needed: `.claude/memory/checkpoints/`
|
|
@@ -233,21 +233,34 @@ try {
|
|
|
233
233
|
if (fs.existsSync(goalsPath)) {
|
|
234
234
|
const goalsContent = fs.readFileSync(goalsPath, 'utf8');
|
|
235
235
|
const header = `---\ndate: ${new Date().toISOString()}\nlabel: auto-compaction-guard-${pct}pct\nfiles_in_progress: []\n---\n\n`;
|
|
236
|
-
|
|
236
|
+
let cpContent = '## Auto-saved before compaction\n\n' + goalsContent;
|
|
237
|
+
|
|
238
|
+
// Include parallel wave state if an active wave exists
|
|
239
|
+
const waveStatePath = path.join(cfg, 'parallel-wave-state.md');
|
|
240
|
+
if (fs.existsSync(waveStatePath)) {
|
|
241
|
+
const waveContent = fs.readFileSync(waveStatePath, 'utf8');
|
|
242
|
+
cpContent += '\n\n## Active Parallel Wave (saved by compaction guard)\n\n' + waveContent;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
fs.writeFileSync(cpPath, header + cpContent);
|
|
237
246
|
fs.writeFileSync(autoSaveMarker, '');
|
|
238
247
|
}
|
|
239
248
|
|
|
240
249
|
console.log('');
|
|
241
250
|
console.log(`--- COMPACTION GUARD (${pct}%) ---`);
|
|
242
251
|
console.log(`Context at ${pct}% — AUTO-SAVED checkpoint to ${path.basename(cpPath)}`);
|
|
252
|
+
if (fs.existsSync(waveStatePath)) {
|
|
253
|
+
console.log('PARALLEL WAVE STATE INCLUDED — interrupted wave will auto-resume on next session.');
|
|
254
|
+
}
|
|
243
255
|
console.log('Run /snapshot NOW to save your reasoning and decisions (goals.md alone is not enough).');
|
|
244
256
|
console.log('--- END GUARD ---');
|
|
245
257
|
}
|
|
246
258
|
} else if (pct >= 70) {
|
|
247
259
|
console.log('');
|
|
248
|
-
console.log(
|
|
249
|
-
console.log(`
|
|
250
|
-
console.log(
|
|
260
|
+
console.log(`!!! SNAPSHOT REQUIRED (${pct}% context used) !!!`);
|
|
261
|
+
console.log(`Run /snapshot NOW — Claude will compact and lose your session reasoning soon.`);
|
|
262
|
+
console.log(`This warning repeats every message until you run /snapshot or context resets.`);
|
|
263
|
+
console.log(`!!! /snapshot !!! /snapshot !!! /snapshot !!!`);
|
|
251
264
|
}
|
|
252
265
|
}
|
|
253
266
|
} catch (_) {}
|