@axis-bootstrap/cli 0.1.0

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.
Files changed (38) hide show
  1. package/README.md +90 -0
  2. package/package.json +42 -0
  3. package/src/commands/audit.js +53 -0
  4. package/src/commands/cleanup.js +42 -0
  5. package/src/commands/doctor.js +137 -0
  6. package/src/commands/init.js +297 -0
  7. package/src/commands/link.js +31 -0
  8. package/src/commands/spdd.js +139 -0
  9. package/src/commands/state.js +21 -0
  10. package/src/index.js +113 -0
  11. package/src/lib/copy.js +19 -0
  12. package/src/lib/detect.js +70 -0
  13. package/src/lib/i18n.js +147 -0
  14. package/src/lib/paths.js +45 -0
  15. package/src/lib/ui.js +29 -0
  16. package/templates/CANVAS.md +48 -0
  17. package/templates/CONVENTIONS.md +43 -0
  18. package/templates/INSTRUCTIONS.md +49 -0
  19. package/templates/STATE.md +27 -0
  20. package/templates/bootstrap-skill/PLANNER.md +221 -0
  21. package/templates/bootstrap-skill/PROMPT-TEMPLATE.md +128 -0
  22. package/templates/bootstrap-skill/SKILL.md +56 -0
  23. package/templates/bootstrap-skill/references/CANVAS-REASONS.md +111 -0
  24. package/templates/bootstrap-skill/references/PATTERNS.md +372 -0
  25. package/templates/bootstrap-skill/references/PHASE-1-DISCOVERY.md +120 -0
  26. package/templates/bootstrap-skill/references/PHASE-2-SPEC.md +250 -0
  27. package/templates/bootstrap-skill/references/PHASE-3-HARNESS.md +331 -0
  28. package/templates/bootstrap-skill/references/PHASE-4-MEMORY.md +187 -0
  29. package/templates/bootstrap-skill/references/PHASE-5-VALIDATION.md +194 -0
  30. package/templates/bootstrap-skill/references/QUICKSTART.md +144 -0
  31. package/templates/bootstrap-skill/references/TEMPLATES.md +602 -0
  32. package/templates/bootstrap-skill/references/UNIVERSAL-MAP.md +216 -0
  33. package/templates/settings.json +29 -0
  34. package/templates/setup-ide-links.sh +33 -0
  35. package/templates/skills/abstraction-first.md +55 -0
  36. package/templates/skills/alignment.md +53 -0
  37. package/templates/skills/iterative-review.md +55 -0
  38. package/templates/skills/story-decompose.md +54 -0
@@ -0,0 +1,187 @@
1
+ # Phase 4 — Memory Layer Initialization
2
+
3
+ **Goal:** ensure the project has continuity between sessions — decisions, state, and conventions persist even when the dev changes, the IDE changes, or time passes.
4
+
5
+ **Input:** Spec Layer (Phase 2) and Harness Layer (Phase 3) confirmed.
6
+
7
+ **Output:** two active memory artifacts in the project.
8
+
9
+ ---
10
+
11
+ ## Foundation: ACE Principle (Agentic Context Engineering)
12
+
13
+ > Reference paper: **ACE — Agentic Context Engineering** (arxiv 2510.04618), which demonstrated +10.6% in agent benchmarks and +8.6% in finance with an approach that treats contexts as **evolutionary playbooks**.
14
+
15
+ **What changes compared to a history log:**
16
+
17
+ | Traditional approach | ACE approach (AXIS) |
18
+ | ------------------------------ | --------------------------------------------- |
19
+ | Append-only: accumulates everything | Active curation: removes obsolete, elevates useful |
20
+ | Grows indefinitely → noise | Controlled size → focus |
21
+ | History context | Strategy context |
22
+ | Session starts from zero | Session starts informed |
23
+
24
+ **Practical implication:** `STATE.md` is not a diary — it is a playbook. Each session the agent not only writes: it *refines*. Removes what was resolved. Elevates what proved useful. The result is that context *improves over time* instead of degrading.
25
+
26
+ ---
27
+
28
+ ## Why the Memory Layer Exists
29
+
30
+ Without it, long-running projects regress with each session:
31
+
32
+ - "Why did we decide X?" — lost
33
+ - "What was in progress?" — redone from scratch
34
+ - "What lesson did we learn from that bug?" — repeated
35
+ - Spec Kit issue #75: "great specs but every new chat starts from zero"
36
+
37
+ The Memory Layer is what makes the system **antifragile over time**.
38
+
39
+ ---
40
+
41
+ ## The Two Artifacts
42
+
43
+ | Artifact | Type | Update |
44
+ | ---------------- | ---------------------- | ------------------------------------------ |
45
+ | `STATE.md` | Live playbook (curated) | Each session — curate, not just append |
46
+ | `CONVENTIONS.md` | Meta (structure) | When the `.ai/` structure changes |
47
+
48
+ ---
49
+
50
+ ## Step 1 — `STATE.md`
51
+
52
+ Create `.ai/docs/STATE.md` with **six mandatory sections**, even if they start empty:
53
+
54
+ ```markdown
55
+ # Project State
56
+
57
+ ## Active Decisions
58
+ <!-- [YYYY-MM-DD] Decision X made because Y -->
59
+
60
+ ## In Progress
61
+ <!-- Feature Z: 70% complete, missing integration with API -->
62
+
63
+ ## Blockers
64
+ <!-- API X returning 429 in staging — waiting for vendor response -->
65
+
66
+ ## Deferred Ideas
67
+ <!-- Migrate to gRPC — evaluate when volume exceeds 10k req/min -->
68
+
69
+ ## Lessons Learned
70
+ <!-- Bulk insert: use createQueryBuilder, not save() for >100 records -->
71
+
72
+ ## Pending TODOs
73
+ - [ ]
74
+
75
+ ---
76
+
77
+ ## Handoff Protocol
78
+
79
+ At the end of any session with relevant changes, the agent updates this file with:
80
+ - What was done
81
+ - What is left
82
+ - Any context that would be lost
83
+
84
+ At the start of a session, the agent reads this file **before** anything else.
85
+ ```
86
+
87
+ **Ask the user before finalizing:**
88
+
89
+ > "Are there decisions already made, current blockers, past lessons, or deferred ideas that should go into `STATE.md` before the first real session?"
90
+
91
+ If there are, populate the sections with what the user provides. If not, leave with stub comments showing the expected format.
92
+
93
+ ### Session Handoff Protocol
94
+
95
+ Document inside `STATE.md` (at the bottom, as instruction for the agent) — as shown in the template above.
96
+
97
+ ---
98
+
99
+ ## Step 2 — `CONVENTIONS.md`
100
+
101
+ Create `.ai/CONVENTIONS.md`. Use template from [TEMPLATES.md → CONVENTIONS.md](TEMPLATES.md#conventionsmd). Minimum content:
102
+
103
+ 1. **Single Source of Truth principle** + symlink map
104
+ 2. **Templates** for creating new skills and rules (reference to TEMPLATES.md or local copy)
105
+ 3. **Rules for the agent:**
106
+ - Where to create files
107
+ - What never to do (duplicate between IDEs, create outside `.ai/`)
108
+ 4. **Knowledge Verification Chain** (codebase → docs → MCP/Context7 → web → mark as uncertain)
109
+ 5. **How to add support for new IDE** (3 `ln -s` commands)
110
+ 6. **Maintenance protocol** — triggers for updating docs
111
+
112
+ ---
113
+
114
+ ## Step 3 — Validation and Gate
115
+
116
+ Present to user:
117
+
118
+ ```markdown
119
+ ## Memory Layer Initialized
120
+
121
+ ### Files created
122
+ - .ai/docs/STATE.md (with 6 structured sections)
123
+ - .ai/CONVENTIONS.md
124
+
125
+ ### STATE.md populated with
126
+ - N active decisions
127
+ - N items in progress
128
+ - N blockers
129
+ - N deferred ideas
130
+ - N lessons
131
+ - N TODOs
132
+
133
+ ### Next step
134
+ Final validation in Phase 5.
135
+ ```
136
+
137
+ **Wait for confirmation before Phase 5.**
138
+
139
+ ---
140
+
141
+ ## Maintenance Loop (document for future use)
142
+
143
+ This section is recorded in `CONVENTIONS.md` for future reference:
144
+
145
+ **Triggers for documentation updates:**
146
+
147
+ | Event | Expected agent action |
148
+ | -------------------------------------------- | ---------------------------------------------- |
149
+ | Code changes a skill's workflow | Propose skill update before ending session |
150
+ | Architectural decision in the session | Propose update to `architecture.md` |
151
+ | Business rule emerges | Ask whether to document in skill/docs |
152
+ | Bug reveals undocumented behavior | Propose documenting |
153
+ | New integration/dependency | Evaluate new skill or expansion |
154
+ | Session paused with work in progress | Update `STATE.md` |
155
+
156
+ **Principle:** the agent does not update automatically without confirmation, but does not let it pass without alerting either. Becomes **documentation guardian**.
157
+
158
+ ---
159
+
160
+ ## Anti-patterns
161
+
162
+ - Leaving `STATE.md` with only stub comments without asking the user (misses the chance to capture fresh context)
163
+ - Skipping `CONVENTIONS.md` as it seems "obvious" — it is what keeps the structure alive
164
+ - **Appending without curating**: STATE.md with 500+ lines is a failure signal — context grows, focus shrinks
165
+
166
+ ---
167
+
168
+ ## ACE Curation Protocol
169
+
170
+ At the end of **every** session with changes, execute in sequence:
171
+
172
+ ```markdown
173
+ ## STATE.md Curation
174
+
175
+ 1. Move to "Active Decisions" what was decided in this session
176
+ 2. Remove from "In Progress" what was completed
177
+ 3. Remove from "Blockers" what was resolved
178
+ 4. Add to "Lessons Learned" any non-obvious insight
179
+ 5. Move to "Deferred" ideas that won't be executed now
180
+ ```
181
+
182
+ **STATE.md target size:** ≤ 80 lines. If exceeded, it signals that resolved items were not removed.
183
+
184
+ **At session start:**
185
+ 1. Read STATE.md *before* anything else
186
+ 2. Check if "In Progress" reflects the current reality
187
+ 3. Update the date in the STATE.md header
@@ -0,0 +1,194 @@
1
+ # Phase 5 — Validation & Handoff
2
+
3
+ **Goal:** validate that the bootstrap delivered a complete, functional system and make a clear handoff to the user.
4
+
5
+ **Input:** Phases 1-4 complete.
6
+
7
+ **Output:** validation report + list of next steps.
8
+
9
+ ---
10
+
11
+ ## Audit Mode
12
+
13
+ This phase also runs in standalone mode when the user asks to **audit an existing project**. In that case:
14
+
15
+ - Skip Phases 1-4
16
+ - Apply all checklists below
17
+ - Report what is absent or out of standards
18
+ - Do not create/modify anything without explicit confirmation
19
+
20
+ ---
21
+
22
+ ## Quality Gates — Structure
23
+
24
+ ```text
25
+ [ ] .ai/ folder exists at project root
26
+ [ ] .ai/INSTRUCTIONS.md exists and has 100-180 lines
27
+ [ ] At least 3 skills in .ai/skills/, each with a SKILL.md
28
+ [ ] Each SKILL.md has ≤ 60 lines
29
+ [ ] Each SKILL.md has frontmatter with `name` and `description`
30
+ [ ] Each `description` has 2-4 lines and mentions trigger terms
31
+ [ ] For software projects: at least 3 rules in .ai/rules/ with `applyTo`
32
+ [ ] At least 1 stub in .ai/docs/ (architecture.md, glossary.md, or equivalent)
33
+ [ ] .ai/CONVENTIONS.md exists and contains symlink map
34
+ [ ] .ai/docs/STATE.md exists with the 6 mandatory sections
35
+ ```
36
+
37
+ ---
38
+
39
+ ## Quality Gates — Harness
40
+
41
+ ```text
42
+ [ ] settings.json exists and is versioned (git ls-files lists it)
43
+ [ ] settings.json has allow/deny/ask filled coherently with the stack
44
+ [ ] PreToolUse destructive blocking hook configured (universal)
45
+ [ ] For software: PostToolUse hook with formatter configured
46
+ [ ] For software: Stop hook with tests configured
47
+ [ ] Scripts in scripts/ are executable (chmod +x)
48
+ [ ] Scripts end with exit 0 (do not block the agent on failure)
49
+ ```
50
+
51
+ ---
52
+
53
+ ## Quality Gates — Symlinks
54
+
55
+ ```text
56
+ [ ] CLAUDE.md → .ai/INSTRUCTIONS.md (resolves)
57
+ [ ] AGENTS.md → .ai/INSTRUCTIONS.md (resolves)
58
+ [ ] For each declared IDE: corresponding folder with correct symlinks
59
+ [ ] setup-ide-links.sh exists and is idempotent
60
+ [ ] Running setup-ide-links.sh twice generates no error
61
+ [ ] ls -la shows expected targets in all symlinks
62
+ ```
63
+
64
+ **Concrete smoke test:**
65
+
66
+ ```bash
67
+ # Confirm that each symlink resolves without error
68
+ for f in CLAUDE.md AGENTS.md .claude/CLAUDE.md .cursor/rules .cursor/skills; do
69
+ if [ -e "$f" ]; then
70
+ echo "OK: $f → $(readlink -f "$f")"
71
+ else
72
+ echo "MISSING: $f"
73
+ fi
74
+ done
75
+ ```
76
+
77
+ ---
78
+
79
+ ## Quality Gates — Memory
80
+
81
+ ```text
82
+ [ ] STATE.md has all 6 sections (Active Decisions, In Progress, Blockers,
83
+ Deferred Ideas, Lessons, TODOs)
84
+ [ ] STATE.md mentions the handoff protocol
85
+ [ ] CONVENTIONS.md describes where the AI can/cannot create files
86
+ [ ] CONVENTIONS.md includes Knowledge Verification Chain
87
+ ```
88
+
89
+ ---
90
+
91
+ ## Quantitative Metrics
92
+
93
+ Calculate and report:
94
+
95
+ | Metric | Target | How to measure |
96
+ | ------ | ------ | -------------- |
97
+ | Lines in `INSTRUCTIONS.md` | 100-180 | `wc -l` |
98
+ | Average lines per `SKILL.md` | 40-60 | `wc -l skills/*/SKILL.md \| awk` |
99
+ | Total skills | 3-10 | `ls -d skills/*/ \| wc -l` |
100
+ | Total rules | 3-7 (if software) | `ls rules/*.md \| wc -l` |
101
+ | Active symlinks | equal to number of declared IDEs + 2 (root) | `find . -type l \| wc -l` |
102
+ | Hooks installed | 1-3 | count in settings.json |
103
+
104
+ **Problem signals:**
105
+
106
+ - `INSTRUCTIONS.md` >200 lines → move details to skills/docs
107
+ - Any `SKILL.md` >80 lines → move content to `references/`
108
+ - >12 skills → excessive fragmentation, consider consolidation
109
+ - No rules created in software project → probable gap
110
+
111
+ ---
112
+
113
+ ## Cross-Validation
114
+
115
+ ```text
116
+ [ ] Skills mentioned in INSTRUCTIONS.md (table) exist in .ai/skills/
117
+ [ ] Rules mentioned in INSTRUCTIONS.md exist in .ai/rules/
118
+ [ ] Symlink map in CONVENTIONS.md matches the real symlinks
119
+ [ ] IDEs declared in Phase 1 have corresponding folders
120
+ ```
121
+
122
+ **If any cross-check fails**, fix before handoff.
123
+
124
+ ---
125
+
126
+ ## Handoff to User
127
+
128
+ Final message follows template in [PROMPT-TEMPLATE.md](../PROMPT-TEMPLATE.md#handoff-to-user). Structure:
129
+
130
+ ```markdown
131
+ ## Bootstrap Complete
132
+
133
+ ### What was created
134
+ - N files in .ai/
135
+ - N skills initialized: <list>
136
+ - N rules: <list>
137
+ - N stubs in docs/
138
+ - Memory layer with STATE, CONVENTIONS
139
+ - N symlinks distributing to <IDEs>
140
+ - N hooks in settings.json
141
+
142
+ ### Metrics
143
+ - INSTRUCTIONS.md: N lines (target 100-180) ✓
144
+ - SKILL.md average: N lines (target 40-60) ✓
145
+ - Symlinks: all resolve ✓
146
+ - Smoke tests: pass ✓
147
+
148
+ ### Suggested next steps (3-5)
149
+ 1. Detail the first priority skill — populate references/GUIDE.md in <skill>
150
+ 2. Validate settings.json with the team
151
+ 3. Configure CI to verify symlink resolution
152
+ 4. Test invocation by another IDE (multi-tool smoke test)
153
+
154
+ ### How to resume
155
+ - Next session: agent reads STATE.md first
156
+ - Future audit: invoke this skill again in "audit" mode
157
+ - Add new IDE: edit setup-ide-links.sh + run
158
+ ```
159
+
160
+ ---
161
+
162
+ ## Acceptable vs Blocking Gaps
163
+
164
+ **Acceptable** (report only, do not block):
165
+
166
+ - references/ still empty in skills (expected — filled with use)
167
+ - Domain-specific rules not yet written
168
+ - docs/ stubs without content
169
+ - Empty TODOs in STATE.md
170
+
171
+ **Blocking** (fix before handoff):
172
+
173
+ - INSTRUCTIONS.md absent or <50 lines
174
+ - Skills without `description` in frontmatter
175
+ - Broken symlinks
176
+ - `settings.json` not versioned
177
+
178
+ ---
179
+
180
+ ## Post-Adoption Audit (future use)
181
+
182
+ The user can re-invoke this skill weeks later to audit:
183
+
184
+ ```text
185
+ "Use axis-bootstrap in audit mode on this project."
186
+ ```
187
+
188
+ The agent:
189
+
190
+ 1. Skips Phases 1-4
191
+ 2. Applies all gates from this phase
192
+ 3. Identifies drift (e.g., INSTRUCTIONS.md grew to 250 lines; some skill lost description)
193
+ 4. Proposes corrections one by one
194
+ 5. **Does not correct without confirmation**
@@ -0,0 +1,144 @@
1
+ # QUICKSTART — AXIS in 5 Minutes
2
+
3
+ > For the full bootstrap (5 phases, 30 min), use the `axis-bootstrap` skill. This document is the fast path for those who want something working today and full structure later.
4
+
5
+ ---
6
+
7
+ ## What you'll have at the end
8
+
9
+ - Contextual `INSTRUCTIONS.md` (not monolithic)
10
+ - `settings.json` with destructive command blocking
11
+ - Active multi-IDE symlinks
12
+ - `STATE.md` with initial playbook
13
+ - Base to expand to full bootstrap
14
+
15
+ **Estimated time:** 5-10 minutes of interaction + 5 minutes of execution.
16
+
17
+ ---
18
+
19
+ ## Step 1 — Project identity (2 min)
20
+
21
+ Answer mentally or paste the answers to the agent:
22
+
23
+ 1. **What does the project do?** (1 sentence)
24
+ 2. **Main stack/tools?** (or "non-technical" if content/research)
25
+ 3. **Which IDE(s) do you use?** (Claude Code / Cursor / Windsurf / Copilot — mark all)
26
+ 4. **Is there anything the agent should NEVER do?** (e.g., push directly to main, delete production data)
27
+
28
+ ---
29
+
30
+ ## Step 2 — Minimal `INSTRUCTIONS.md` (2 min)
31
+
32
+ Create `.ai/INSTRUCTIONS.md` with this minimal structure (adapt):
33
+
34
+ ```markdown
35
+ # [Project Name]
36
+
37
+ [1-2 sentences about what the project does]
38
+
39
+ ## Stack
40
+ - [main technology]
41
+ - [other relevant ones]
42
+
43
+ ## How to run
44
+ [start command]
45
+
46
+ ## Critical rules
47
+ - Never [restriction 1 from previous step]
48
+ - Always confirm before [destructive action]
49
+ ```
50
+
51
+ > Limit: 50-80 lines for quick start. Expand to 100-180 in full bootstrap.
52
+
53
+ ---
54
+
55
+ ## Step 3 — Minimal `settings.json` (1 min)
56
+
57
+ Create `.claude/settings.json` (or equivalent for your IDE):
58
+
59
+ ```json
60
+ {
61
+ "permissions": {
62
+ "allow": [
63
+ "Read",
64
+ "Bash(git status)",
65
+ "Bash(git log *)",
66
+ "Bash(git diff *)",
67
+ "Edit(/.ai/**)"
68
+ ],
69
+ "deny": [
70
+ "Bash(rm -rf *)",
71
+ "Bash(git push --force*)",
72
+ "Bash(DROP *)",
73
+ "Bash(truncate *)"
74
+ ],
75
+ "ask": [
76
+ "Bash(git push *)",
77
+ "Edit(/.env*)"
78
+ ]
79
+ }
80
+ }
81
+ ```
82
+
83
+ **Add to git immediately:** `git add .claude/settings.json && git commit -m "chore: add axis harness settings"`
84
+
85
+ ---
86
+
87
+ ## Step 4 — Multi-IDE symlinks (1 min)
88
+
89
+ Run in terminal:
90
+
91
+ ```bash
92
+ # At project root
93
+ ln -sf .ai/INSTRUCTIONS.md CLAUDE.md
94
+ ln -sf .ai/INSTRUCTIONS.md AGENTS.md
95
+ mkdir -p .claude && ln -sf ../.ai/skills .claude/skills
96
+ mkdir -p .cursor && ln -sf ../.ai/skills .cursor/skills
97
+ mkdir -p .agents && ln -sf ../.ai/skills .agents/skills
98
+ mkdir -p .github && ln -sf ../.ai/INSTRUCTIONS.md .github/copilot-instructions.md
99
+ mkdir -p .github && ln -sf ../.ai/skills .github/skills
100
+ ```
101
+
102
+ Verify: `ls -la CLAUDE.md AGENTS.md .claude/skills`
103
+
104
+ ---
105
+
106
+ ## Step 5 — Initial `STATE.md` (1 min)
107
+
108
+ Create `.ai/docs/STATE.md`:
109
+
110
+ ```markdown
111
+ # Project State
112
+
113
+ ## In Progress
114
+ <!-- What is being done now -->
115
+
116
+ ## Blockers
117
+ <!-- Nothing at the moment -->
118
+
119
+ ## Active Decisions
120
+ <!-- [date] Adopted AXIS Framework -->
121
+
122
+ ## Lessons Learned
123
+ <!-- Empty — to fill throughout the project -->
124
+
125
+ ---
126
+
127
+ ## Handoff Protocol
128
+
129
+ At the end of sessions with relevant changes, update this file.
130
+ At the start of a session, read this file before anything else.
131
+ **Actively curate** — remove what is resolved.
132
+ ```
133
+
134
+ ---
135
+
136
+ ## Next Steps
137
+
138
+ When you have 30 minutes: run the full bootstrap to create domain skills, automation hooks, and CONVENTIONS.md.
139
+
140
+ ```text
141
+ Use the axis-bootstrap skill to complete the structure of this project.
142
+ ```
143
+
144
+ The agent will detect the existing INSTRUCTIONS.md, skip Phase 1 (discovery already done), and complete the missing layers.