@esoteric-logic/praxis-harness 1.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 (79) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +192 -0
  3. package/base/CLAUDE.md +148 -0
  4. package/base/commands/context-reset.md +72 -0
  5. package/base/commands/debug.md +63 -0
  6. package/base/commands/discover.md +49 -0
  7. package/base/commands/gsd-discuss.md +53 -0
  8. package/base/commands/gsd-execute.md +60 -0
  9. package/base/commands/gsd-verify.md +78 -0
  10. package/base/commands/kit.md +62 -0
  11. package/base/commands/plan.md +91 -0
  12. package/base/commands/ralph.md +110 -0
  13. package/base/commands/review.md +81 -0
  14. package/base/commands/risk.md +53 -0
  15. package/base/commands/ship.md +74 -0
  16. package/base/commands/spec.md +121 -0
  17. package/base/commands/standup.md +57 -0
  18. package/base/rules/architecture.md +51 -0
  19. package/base/rules/azure.md +90 -0
  20. package/base/rules/code-quality.md +65 -0
  21. package/base/rules/coding.md +139 -0
  22. package/base/rules/communication.md +69 -0
  23. package/base/rules/context-management.md +136 -0
  24. package/base/rules/execution-loop.md +84 -0
  25. package/base/rules/git-workflow.md +51 -0
  26. package/base/rules/github-actions.md +48 -0
  27. package/base/rules/powershell.md +72 -0
  28. package/base/rules/profile.md +31 -0
  29. package/base/rules/security.md +40 -0
  30. package/base/rules/terraform.md +48 -0
  31. package/base/rules/vault.md +134 -0
  32. package/base/skills/code-gc/SKILL.md +205 -0
  33. package/base/skills/code-simplifier/SKILL.md +132 -0
  34. package/base/skills/prd-writer/SKILL.md +108 -0
  35. package/base/skills/prd-writer/references/prd-template.md +22 -0
  36. package/base/skills/pre-commit-lint/SKILL.md +71 -0
  37. package/base/skills/scaffold-exist/SKILL.md +85 -0
  38. package/base/skills/scaffold-new/SKILL.md +177 -0
  39. package/base/skills/scaffold-new/references/claude-progress-template.json +24 -0
  40. package/base/skills/scaffold-new/references/gitignore-template.txt +65 -0
  41. package/base/skills/scaffold-new/references/repo-CLAUDE-md-template.md +87 -0
  42. package/base/skills/scaffold-new/references/vault-index-template.md +31 -0
  43. package/base/skills/scaffold-new/references/vault-learnings-template.md +21 -0
  44. package/base/skills/scaffold-new/references/vault-status-template.md +21 -0
  45. package/base/skills/scaffold-new/references/vault-tasks-template.md +20 -0
  46. package/base/skills/session-retro/SKILL.md +146 -0
  47. package/base/skills/subagent-review/SKILL.md +126 -0
  48. package/base/skills/vault-gc/SKILL.md +93 -0
  49. package/base/skills/verify-app/SKILL.md +156 -0
  50. package/bin/praxis.js +385 -0
  51. package/kits/infrastructure/KIT.md +66 -0
  52. package/kits/infrastructure/commands/infra-apply.md +44 -0
  53. package/kits/infrastructure/commands/infra-compliance.md +65 -0
  54. package/kits/infrastructure/commands/infra-drift.md +45 -0
  55. package/kits/infrastructure/commands/infra-plan.md +45 -0
  56. package/kits/infrastructure/install.sh +43 -0
  57. package/kits/infrastructure/rules/infrastructure.md +82 -0
  58. package/kits/infrastructure/teardown.sh +14 -0
  59. package/kits/web-designer/KIT.md +76 -0
  60. package/kits/web-designer/commands/web-audit.md +67 -0
  61. package/kits/web-designer/commands/web-component.md +54 -0
  62. package/kits/web-designer/commands/web-init.md +42 -0
  63. package/kits/web-designer/commands/web-tokens-sync.md +49 -0
  64. package/kits/web-designer/install.sh +41 -0
  65. package/kits/web-designer/rules/web-design.md +79 -0
  66. package/kits/web-designer/teardown.sh +26 -0
  67. package/package.json +28 -0
  68. package/scripts/health-check.sh +160 -0
  69. package/scripts/lint-harness.sh +195 -0
  70. package/scripts/onboard-mcp.sh +326 -0
  71. package/scripts/update.sh +88 -0
  72. package/templates/_index.md +33 -0
  73. package/templates/adr.md +28 -0
  74. package/templates/claude-progress.json +24 -0
  75. package/templates/plan.md +46 -0
  76. package/templates/project-index.md +31 -0
  77. package/templates/session-note.md +21 -0
  78. package/templates/status.md +27 -0
  79. package/templates/tasks.md +27 -0
@@ -0,0 +1,177 @@
1
+ ---
2
+ name: scaffold-new
3
+ disable-model-invocation: true
4
+ description: Scaffold a brand new project into the full harness. Invoke with /scaffold-new only.
5
+ Creates repo CLAUDE.md, vault subtree, git identity verification, gitignore,
6
+ pre-commit hook, and Project Registry entry. Side-effect skill — never auto-triggers.
7
+ ---
8
+
9
+ # scaffold-new Skill
10
+
11
+ ## Vault Path Resolution
12
+ Read vault_path from `~/.claude/praxis.config.json` at the start of every invocation.
13
+ If config is missing: STOP. Tell user to run `praxis/install.sh`.
14
+
15
+ ## NON-GOALS — Rules Loading
16
+ - Do NOT load `git-workflow.md` — identity and init handled inline
17
+ - Do NOT load `security.md` — not relevant during scaffolding
18
+ - Do NOT load `terraform.md` or `github-actions.md` — no infra files touched
19
+
20
+ ## Overview
21
+ Scaffolds a new project in phases:
22
+ 1. **Phase 0**: Validate git identity before anything touches disk
23
+ 2. **Phase 1**: Gather project metadata
24
+ 3. **Phase 2**: Scaffold repo `CLAUDE.md`
25
+ 4. **Phase 3**: Scaffold vault subtree
26
+ 5. **Phase 3.5**: Scaffold `claude-progress.json`
27
+ 6. **Phase 4**: Vault search check
28
+ 7. **Phase 5**: Git init (if new repo)
29
+ 8. **Phase 5.5**: Install git hooks (optional)
30
+ 9. **Phase 6**: Update Project Registry + agenda.md
31
+ 10. **Phase 7**: Confirm and open Obsidian
32
+
33
+ ---
34
+
35
+ ## Phase 0 — Identity Guard
36
+
37
+ From the user's stated project type, resolve the expected identity.
38
+ <!-- CUSTOMIZE: Replace with your git identities in profile.md -->
39
+ Read identity table from `~/.claude/rules/git-workflow.md`.
40
+
41
+ **Validation steps:**
42
+ 1. Confirm `{repo_root}` falls under the correct `includeIf` directory.
43
+ If not: **STOP**. Report the mismatch.
44
+ 2. If repo exists: run `git --no-pager config user.email` and confirm match.
45
+ If mismatch: **STOP**. Report `expected: X, got: Y`.
46
+ 3. Store resolved values: `{identity_profile}`, `{ssh_key}`, `{identity_email}`
47
+
48
+ ---
49
+
50
+ ## Phase 1 — Gather Info
51
+
52
+ Before asking, run vault duplicate check:
53
+ ```bash
54
+ obsidian search query="{slug}" path="01_Projects" limit=3
55
+ ```
56
+
57
+ Ask in one message:
58
+ - **Project name** — display name
59
+ - **Project slug** — kebab-case (confirm derivation from name)
60
+ - **One-line description**
61
+ - **Type** — Work / Personal
62
+ - **Tech stack** — 1–5 items, comma-separated
63
+ - **Repo root path**
64
+ - **Repo URL** — (use `TBD` if not yet created)
65
+ - **New or existing repo?**
66
+
67
+ **Computed values:**
68
+ ```
69
+ vault_path = {config.vault_path}/01_Projects/{type}/_active/{slug}
70
+ today_date = current date YYYY-MM-DD
71
+ ```
72
+
73
+ ---
74
+
75
+ ## Phase 2 — Scaffold repo CLAUDE.md
76
+
77
+ 1. Read `references/repo-CLAUDE-md-template.md`
78
+ 2. Apply full substitution map. All placeholders must resolve.
79
+ 3. Scan output for remaining `{placeholder}` patterns. Resolve before writing.
80
+ 4. Write to `{repo_root}/CLAUDE.md`
81
+
82
+ ---
83
+
84
+ ## Phase 3 — Scaffold Vault
85
+
86
+ Create directories:
87
+ ```bash
88
+ mkdir -p {vault_path}/plans {vault_path}/notes {vault_path}/specs {vault_path}/research
89
+ ```
90
+
91
+ Create files from templates in `references/`:
92
+ - `_index.md` from `vault-index-template.md`
93
+ - `status.md` from `vault-status-template.md` (`current_plan:` empty)
94
+ - `tasks.md` from `vault-tasks-template.md`
95
+ - `notes/learnings.md` from `vault-learnings-template.md`
96
+ - `.gitignore` from `gitignore-template.txt` (new repos only)
97
+
98
+ ---
99
+
100
+ ## Phase 3.5 — Scaffold claude-progress.json
101
+
102
+ From `references/claude-progress-template.json`. Apply substitution map.
103
+ Write to `{vault_path}/claude-progress.json`.
104
+
105
+ ---
106
+
107
+ ## Phase 4 — Vault Search Check
108
+
109
+ Vault indexing is automatic for `obsidian` backend. No manual re-index needed.
110
+ Verify the new project is searchable: `obsidian search query="{slug}" limit=1`
111
+ On failure: warn, do not block.
112
+
113
+ ---
114
+
115
+ ## Phase 5 — Git Init (if new repo)
116
+
117
+ ```bash
118
+ git init {repo_root}
119
+ git -C {repo_root} add CLAUDE.md
120
+ git -C {repo_root} commit -m "chore: initialize project scaffold"
121
+ ```
122
+ After commit: verify `git config user.email` matches. If mismatch: **STOP**.
123
+
124
+ ---
125
+
126
+ ## Phase 5.5 — Git Hooks (ask first)
127
+
128
+ Ask: "Generate and install a pre-commit lint hook?"
129
+ If yes: invoke the `pre-commit-lint` skill.
130
+ If no: skip silently.
131
+
132
+ ---
133
+
134
+ ## Phase 6 — Update Project Registry
135
+
136
+ Append to vault CLAUDE.md Project Registry table and agenda.md.
137
+ Vault indexing is automatic.
138
+
139
+ ---
140
+
141
+ ## Phase 7 — Confirm & Open Vault
142
+
143
+ Open the vault in the user's app (backend-conditional):
144
+ - `obsidian` → `open "obsidian://open?vault=Obsidian"`
145
+ - `logseq` → `open "logseq://graph/{vault_name}"`
146
+ - `plain` / `custom` → print vault path for user to open manually
147
+
148
+ Print summary table with all created files and bootstrap sequence.
149
+
150
+ ---
151
+
152
+ ## Execution Checklist
153
+
154
+ - [ ] Phase 0: Identity resolved and validated
155
+ - [ ] Phase 1: All metadata collected
156
+ - [ ] Phase 2: `{repo_root}/CLAUDE.md` — zero unreplaced placeholders
157
+ - [ ] Phase 3: Vault subtree created
158
+ - [ ] Phase 3.5: `claude-progress.json` created
159
+ - [ ] Phase 4: Vault search check (automatic indexing)
160
+ - [ ] Phase 5: Git identity verified
161
+ - [ ] Phase 5.5: Hook decision made
162
+ - [ ] Phase 6: Registry and agenda updated
163
+ - [ ] Phase 7: Summary printed
164
+
165
+ ## Error Handling
166
+
167
+ | Condition | Action |
168
+ |-----------|--------|
169
+ | Identity mismatch | STOP. Report. Do not commit. |
170
+ | Files already exist | Ask before overwriting |
171
+ | Unreplaced placeholder | Resolve before writing |
172
+ | Vault search fails | Warn only |
173
+
174
+ ## Removal Conditions
175
+ - Phase 0: Remove after 20+ consecutive correct identity resolutions over 60 days
176
+ - Phase 3.5: Remove when a dedicated MCP tool handles machine-readable state
177
+ - Phase 5.5: Remove when hooks managed globally via dotfiles bootstrap
@@ -0,0 +1,24 @@
1
+ {
2
+ "project": "{slug}",
3
+ "display_name": "{Project Name}",
4
+ "created": "{YYYY-MM-DD}",
5
+ "type": "{type}",
6
+ "identity": "{identity_profile}",
7
+ "repo_root": "{repo_root}",
8
+ "vault_path": "{vault_path}",
9
+ "stack": ["{stack_item_1}", "{stack_item_2}", "{stack_item_3}"],
10
+ "milestones": [],
11
+ "features": [],
12
+ "ralph_state": {
13
+ "mode": "idle",
14
+ "prd_path": null,
15
+ "current_story": null,
16
+ "completed_stories": [],
17
+ "blocked_stories": [],
18
+ "learnings": [],
19
+ "last_iteration": null,
20
+ "session_count": 0
21
+ },
22
+ "last_session": null,
23
+ "sessions": []
24
+ }
@@ -0,0 +1,65 @@
1
+ # .gitignore
2
+ # Generated by praxis scaffold-new — review before committing to shared repos
3
+
4
+ # ── Claude / AI Harness ───────────────────────────────────────────────────
5
+ CLAUDE.md
6
+ .claude/
7
+ .mcp.json
8
+ *.claude-session
9
+ agent-memory.jsonl
10
+ .context7-cache/
11
+
12
+ # ── Vault References ──────────────────────────────────────────────────────
13
+ .vault-path
14
+ .obsidian-local/
15
+ .obsidian/workspace
16
+ .obsidian/workspace.json
17
+ .logseq/
18
+
19
+ # ── OS and Editor Noise ───────────────────────────────────────────────────
20
+ .DS_Store
21
+ Thumbs.db
22
+ .vscode/settings.json
23
+ .vscode/launch.json
24
+ .idea/
25
+
26
+ # ── Secrets and Credentials ───────────────────────────────────────────────
27
+ .env
28
+ .env.*
29
+ !.env.example
30
+ !.env.template
31
+ *.pem
32
+ *.key
33
+ *.p12
34
+ *.pfx
35
+ local.settings.json
36
+ secrets.json
37
+
38
+ # ── Terraform ─────────────────────────────────────────────────────────────
39
+ .terraform/
40
+ .terraform.lock.hcl
41
+ terraform.tfstate
42
+ terraform.tfstate.*
43
+ *.tfplan
44
+ *.tfvars
45
+ !*.tfvars.example
46
+
47
+ # ── Node.js ───────────────────────────────────────────────────────────────
48
+ node_modules/
49
+ dist/
50
+ build/
51
+
52
+ # ── Python ────────────────────────────────────────────────────────────────
53
+ __pycache__/
54
+ *.py[cod]
55
+ .venv/
56
+ venv/
57
+ *.egg-info/
58
+ .mypy_cache/
59
+ .ruff_cache/
60
+
61
+ # ── Logs and Temp ─────────────────────────────────────────────────────────
62
+ *.log
63
+ *.tmp
64
+ *.cache
65
+ .cache/
@@ -0,0 +1,87 @@
1
+ # {Project Name}
2
+ <!-- MAP: This file is ~60 lines. If you're adding explanation, it belongs in ~/.claude/rules/ -->
3
+
4
+ ## Overview
5
+ {one-line description}
6
+
7
+ ## Global Rules
8
+ Inherits execution engine from `~/.claude/CLAUDE.md`.
9
+ Phases (SPEC → PLAN → IMPLEMENT → VALIDATE → REPAIR → COMMIT → LOG → REPEAT),
10
+ self-review protocol, and code quality standards apply without exception.
11
+
12
+ ## Identity
13
+ - **Type**: {type}
14
+ - **Git profile**: {identity_profile}
15
+ - **SSH key**: {ssh_key}
16
+ - **Email**: {identity_email}
17
+ - **includeIf path**: {repo_root}
18
+
19
+ If `git config user.email` does not return `{identity_email}`, STOP before any commit.
20
+
21
+ ## Vault Project
22
+ - **Vault path**: {vault_path}
23
+ - **Project index**: `{vault_path}/_index.md`
24
+
25
+ Code lives here. Knowledge, decisions, and plans live in the vault.
26
+
27
+ | Purpose | Location |
28
+ |---------|----------|
29
+ | Project metadata | `{vault_path}/_index.md` |
30
+ | Execution plans | `{vault_path}/plans/` |
31
+ | Execution state | `{vault_path}/status.md` |
32
+ | Machine-readable state | `{vault_path}/claude-progress.json` |
33
+ | Agent learnings | `{vault_path}/notes/learnings.md` |
34
+ | Specs & decisions | `{vault_path}/specs/` |
35
+
36
+ ## Tech Stack
37
+ - {stack_item_1}
38
+ - {stack_item_2}
39
+ - {stack_item_3}
40
+
41
+ ## Commands
42
+ ```bash
43
+ dev: # fill in as project develops
44
+ test: # fill in as project develops
45
+ lint: # fill in as project develops
46
+ build: # fill in as project develops
47
+ format: # fill in as project develops
48
+ ```
49
+
50
+ ## Code Style
51
+ - Prefer simple, readable code over clever abstractions
52
+ - After finishing implementation, run `/simplify` to clean up
53
+ - If a fix feels hacky, find a cleaner solution before finishing
54
+ - No AI-generated comments or attributions in code or commits
55
+
56
+ ## Verification
57
+ - Before marking any task complete, run the test suite
58
+ - Check logs before claiming a bug is fixed
59
+ - End every task instruction with a verification step
60
+ - Use `/verify-app` for end-to-end checks
61
+
62
+ ## Conventions
63
+ - **Commits**: conventional commits (feat:, fix:, docs:, refactor:, test:, chore:)
64
+ - **Branches**: `{type}/{description}` (e.g., `feat/add-auth`, `fix/nsg-rule`)
65
+ - **Plans**: `{vault_path}/plans/YYYY-MM-DD_[task-slug].md`
66
+ - **Learnings**: `{vault_path}/notes/learnings.md` using [LEARN:tag] schema
67
+
68
+ ## Error Learning
69
+ <!-- When a mistake is corrected, write a new rule here to prevent recurrence -->
70
+ <!-- Each rule should be specific and actionable -->
71
+
72
+ ## Project-Specific Rules
73
+ <!-- Add rules discovered during development -->
74
+
75
+ ## After Compaction — Bootstrap Sequence
76
+
77
+ **Step 1** — Read this file top to bottom first.
78
+ **Step 2** — Active task? → read active plan. No task? → read status.md.
79
+ **Step 3** — Load stack rules only if the current task touches them.
80
+
81
+ ## Compact Preservation
82
+ When compacting, always preserve:
83
+ - Active plan path
84
+ - Current milestone
85
+ - Last 3 decisions and rationale
86
+ - Any STOP conditions or blockers
87
+ - Ralph state (if active): current story, completed stories
@@ -0,0 +1,31 @@
1
+ ---
2
+ tags: [index, {slug}]
3
+ status: active
4
+ repo: {repo_url}
5
+ local_path: {repo_root}
6
+ vault_path: {vault_path}
7
+ tech_stack: [{stack_item_1}, {stack_item_2}, {stack_item_3}]
8
+ started: {YYYY-MM-DD}
9
+ ---
10
+
11
+ # {Project Name}
12
+
13
+ ## Overview
14
+ {one-line description}
15
+
16
+ ## Links
17
+ - **Repo**: [GitHub]({repo_url})
18
+ - **Local**: {repo_root}
19
+ - **Vault**: {vault_path}
20
+
21
+ ## Active Goals
22
+ - [ ] Define initial milestones
23
+ - [ ] Complete project scaffold
24
+
25
+ ## Key Decisions
26
+ <!-- Link decision records here as they are created -->
27
+
28
+ ## Execution State
29
+ - **Status file**: [[{slug}/status]] (What / So What / Now What)
30
+ - **Machine state**: `{vault_path}/claude-progress.json`
31
+ - **Active plan**: see `current_plan:` in status.md
@@ -0,0 +1,21 @@
1
+ ---
2
+ tags: [learnings, {slug}]
3
+ date: {YYYY-MM-DD}
4
+ source: agent
5
+ ---
6
+ # {Project Name} — Learnings
7
+
8
+ Agent corrections and discovered patterns for this project.
9
+ Uses the [LEARN:tag] schema from the execution engine.
10
+
11
+ Tags: `bugfix`, `convention`, `perf`, `security`, `tooling`, `arch`, `process`
12
+
13
+ <!-- Example entry:
14
+
15
+ ## [LEARN:tooling] Terraform fmt must run before plan
16
+ - **What**: `terraform plan` succeeded but CI failed on formatting check
17
+ - **So What**: Wasted a full CI cycle on a preventable formatting error
18
+ - **Now What**: Always run `terraform fmt -recursive` before `terraform plan`.
19
+ - **Date**: 2026-03-12
20
+
21
+ -->
@@ -0,0 +1,21 @@
1
+ ---
2
+ tags: [status, {slug}]
3
+ date: {YYYY-MM-DD}
4
+ source: agent
5
+ ---
6
+ # {Project Name} — Status
7
+
8
+ current_plan:
9
+ last_updated: {YYYY-MM-DD HH:MM}
10
+
11
+ ## What (Current State)
12
+ <!-- What is done. What is in progress. What is blocked. Facts only. -->
13
+
14
+ ## So What (Implications & Decisions)
15
+ <!-- Why the current state matters. Key decisions and their rationale. -->
16
+
17
+ ## Now What (Next Actions)
18
+ <!-- Ordered list of what comes next, informed by the above. -->
19
+
20
+ ## Test Debt
21
+ <!-- Flag any skipped tests from spike/prototype work. -->
@@ -0,0 +1,20 @@
1
+ ---
2
+ tags: [tasks, {slug}]
3
+ date: {YYYY-MM-DD}
4
+ source: agent
5
+ ---
6
+ # {Project Name} — Tasks
7
+
8
+ ## Active
9
+ <!-- Current work items in flight -->
10
+
11
+ ## Backlog
12
+ <!-- Prioritized list of upcoming work -->
13
+ - [ ] Define initial milestones
14
+ - [ ] Complete project scaffold
15
+
16
+ ## Blocked
17
+ <!-- Items blocked by dependencies or decisions -->
18
+
19
+ ## Completed
20
+ <!-- Done items — move here from Active when complete -->
@@ -0,0 +1,146 @@
1
+ ---
2
+ name: session-retro
3
+ disable-model-invocation: true
4
+ description: End-of-session retrospective. Invoke manually with /session-retro only.
5
+ Writes [LEARN:tag] entries, proposes rule updates, updates claude-progress.json,
6
+ triggers vault-gc lightweight check. Side-effect skill — never auto-triggers.
7
+ allowed-tools: Bash, Read, Write, Edit
8
+ ---
9
+
10
+ # session-retro Skill
11
+
12
+ ## Vault Path Resolution
13
+ Read vault_path from `~/.claude/praxis.config.json`. If missing: write to fallback location.
14
+
15
+ ## DONE-WHEN
16
+ - [ ] Session summary written (3–5 bullets)
17
+ - [ ] Violations and corrections extracted
18
+ - [ ] [LEARN:tag] entries written to correct learnings.md
19
+ - [ ] Rule proposals surfaced (user approves before writing)
20
+ - [ ] `claude-progress.json` last_session updated
21
+ - [ ] vault-gc lightweight check triggered
22
+ - [ ] `/clear` suggested if session had >2 corrections or scope drift
23
+
24
+ ## NON-GOALS
25
+ - Does not write rules without user approval
26
+ - Does not auto-close or modify open plan files
27
+ - Does not run full vault-gc audit (lightweight only)
28
+
29
+ ---
30
+
31
+ ## Ralph Integration
32
+ When `claude-progress.json` → `ralph_state.mode == "active"`:
33
+ - Run Phase 1 (summary) — required
34
+ - Skip Phase 2 (violation extraction — no user corrections in Ralph)
35
+ - Run Phase 3 (LEARN entries) — required
36
+ - Skip Phase 4 (rule proposals — no user to approve)
37
+ - Run Phase 5 (update claude-progress.json) — required
38
+ - Push `current_story` to `completed_stories`
39
+ - Set `current_story` to null
40
+ - Increment `session_count`
41
+ - Write `last_iteration` timestamp
42
+ - Run Phase 6 (vault-gc lightweight) — required
43
+ - Run Phase 7 (health) — write to `ralph_state`, always suggest `/clear`
44
+ - Exit 0 always — never block a Ralph iteration
45
+
46
+ ---
47
+
48
+ ## Phase 1 — Summarize Session
49
+
50
+ Review conversation. Produce 3–5 bullet summary:
51
+ - What was accomplished (concrete deliverables, decisions)
52
+ - What was attempted but not completed (and why)
53
+ - Any scope drift from original intent
54
+
55
+ ## Phase 2 — Extract Violations and Corrections
56
+
57
+ Scan session for:
58
+ 1. **Corrections**: times user corrected Claude's output
59
+ 2. **Rule violations**: things a rules file should have blocked
60
+ 3. **Missing rules**: patterns that recurred with no rule
61
+ 4. **Process violations**: SPEC/PLAN/VALIDATE loop skipped
62
+
63
+ Classify each: type, tag (`bugfix|convention|perf|security|tooling|arch|process`), impact.
64
+
65
+ ## Phase 3 — Write [LEARN:tag] Entries
66
+
67
+ For each finding with clear root cause:
68
+ - Project-specific → `{vault_path}/notes/learnings.md`
69
+ - Global/harness pattern → harness project learnings.md
70
+ - Check for duplicates via `obsidian search` before writing
71
+
72
+ Format:
73
+ ```markdown
74
+ ## [LEARN:{tag}] {Short title}
75
+ - **What**: What went wrong or was discovered
76
+ - **So What**: Why this matters
77
+ - **Now What**: What to do instead
78
+ - **Date**: {YYYY-MM-DD}
79
+ ```
80
+
81
+ Vault indexing is automatic.
82
+
83
+ ## Phase 4 — Propose Rule Updates
84
+
85
+ For findings where a rule SHOULD have blocked the behavior:
86
+ 1. Identify which `~/.claude/rules/` file it belongs in
87
+ 2. Draft as Invariant (BLOCK) or Convention (WARN)
88
+ 3. Present to user with reason. **Do NOT write without approval.**
89
+ 4. If declined: log decline in the [LEARN:tag] entry
90
+
91
+ ## Phase 5 — Update claude-progress.json
92
+
93
+ Append session entry:
94
+ ```json
95
+ {
96
+ "date": "{YYYY-MM-DD}",
97
+ "summary": "{1-line}",
98
+ "accomplishments": [],
99
+ "learn_entries": 0,
100
+ "rule_proposals": 0,
101
+ "corrections": 0
102
+ }
103
+ ```
104
+
105
+ ## Phase 6 — vault-gc Lightweight Check
106
+
107
+ Run inline staleness check across all `status.md` files in active projects.
108
+ - Silent if 0 stale
109
+ - One line if 1–2 stale
110
+ - Escalate if 3+ stale
111
+
112
+ ## Phase 7 — Session Health Assessment
113
+
114
+ | Signal | Threshold | Action |
115
+ |--------|-----------|--------|
116
+ | Corrections from user | >2 | Suggest `/clear` |
117
+ | Scope drift | Any | Note in summary |
118
+ | Same correction repeated | 2+ | Rule proposal mandatory |
119
+
120
+ ## Output Format
121
+ ```
122
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
123
+ SESSION RETRO — {today_date}
124
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
125
+
126
+ Summary
127
+ {bullets}
128
+
129
+ Learnings: {n} | Rules: {n} | Corrections: {n}
130
+
131
+ {vault-gc output if non-empty}
132
+ {/clear suggestion if warranted}
133
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
134
+ ```
135
+
136
+ ## Error Handling
137
+
138
+ | Condition | Action |
139
+ |-----------|--------|
140
+ | Can't detect project | Ask, or write to fallback |
141
+ | `claude-progress.json` missing | Create from template |
142
+ | Vault search fails | Warn only |
143
+ | User declines all proposals | Log declines, proceed |
144
+
145
+ ## Removal Condition
146
+ Remove when session transcripts are parsed automatically and [LEARN:tag] entries generated without Claude.