@esoteric-logic/praxis-harness 1.2.1 → 2.0.1

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 (58) hide show
  1. package/README.md +14 -34
  2. package/base/CLAUDE.md +23 -25
  3. package/base/hooks/auto-format.sh +40 -0
  4. package/base/hooks/identity-check.sh +55 -0
  5. package/base/hooks/secret-scan.sh +1 -1
  6. package/base/hooks/settings-hooks.json +61 -0
  7. package/base/hooks/vault-checkpoint.sh +1 -9
  8. package/base/rules/context-management.md +3 -50
  9. package/base/rules/execution-loop.md +41 -61
  10. package/base/rules/git-workflow.md +7 -7
  11. package/base/rules/profile.md +10 -7
  12. package/base/rules/vault.md +13 -4
  13. package/base/{rules/architecture.md → skills/architecture-patterns/SKILL.md} +12 -14
  14. package/base/skills/code-gc/SKILL.md +0 -1
  15. package/base/{rules/communication.md → skills/communication-standards/SKILL.md} +13 -12
  16. package/base/{commands/context-reset.md → skills/context-reset/SKILL.md} +2 -1
  17. package/base/skills/context7-lookup/SKILL.md +53 -0
  18. package/base/{commands/debug.md → skills/debug/SKILL.md} +6 -4
  19. package/base/{commands/discover.md → skills/discover/SKILL.md} +4 -2
  20. package/base/skills/discuss/SKILL.md +96 -0
  21. package/base/{commands/gsd-execute.md → skills/execute/SKILL.md} +9 -12
  22. package/base/skills/fast/SKILL.md +28 -0
  23. package/base/{commands/kit.md → skills/kit/SKILL.md} +4 -3
  24. package/base/skills/managing-git-identities/SKILL.md +98 -0
  25. package/base/skills/next/SKILL.md +33 -0
  26. package/base/{commands/plan.md → skills/plan/SKILL.md} +40 -10
  27. package/base/skills/plan-writer/SKILL.md +72 -0
  28. package/base/skills/pre-commit-lint/SKILL.md +7 -5
  29. package/base/skills/quick/SKILL.md +42 -0
  30. package/base/{commands/review.md → skills/review/SKILL.md} +34 -10
  31. package/base/{commands/risk.md → skills/risk/SKILL.md} +2 -0
  32. package/base/skills/scaffold-exist/SKILL.md +9 -8
  33. package/base/skills/scaffold-new/SKILL.md +1 -2
  34. package/base/skills/scaffold-new/references/claude-progress-template.json +0 -10
  35. package/base/skills/scaffold-new/references/repo-CLAUDE-md-template.md +0 -1
  36. package/base/skills/secret-scan/SKILL.md +59 -0
  37. package/base/skills/session-retro/SKILL.md +3 -20
  38. package/base/{commands/ship.md → skills/ship/SKILL.md} +4 -2
  39. package/base/skills/{code-simplifier → simplify}/SKILL.md +6 -7
  40. package/base/{commands/spec.md → skills/spec/SKILL.md} +15 -7
  41. package/base/{commands/standup.md → skills/standup/SKILL.md} +2 -10
  42. package/base/skills/status-update/SKILL.md +50 -0
  43. package/base/skills/vault-gc/SKILL.md +0 -1
  44. package/base/{commands/gsd-verify.md → skills/verify/SKILL.md} +9 -6
  45. package/base/skills/verify-app/SKILL.md +5 -6
  46. package/kits/infrastructure/KIT.md +2 -15
  47. package/kits/web-designer/KIT.md +4 -17
  48. package/package.json +2 -3
  49. package/scripts/lint-harness.sh +7 -3
  50. package/templates/claude-progress.json +0 -10
  51. package/base/commands/gsd-discuss.md +0 -53
  52. package/base/commands/ralph.md +0 -110
  53. package/base/commands/simplify.md +0 -15
  54. package/base/rules/code-quality.md +0 -65
  55. package/base/rules/security.md +0 -40
  56. package/base/skills/prd-writer/SKILL.md +0 -108
  57. package/base/skills/prd-writer/references/prd-template.md +0 -22
  58. package/base/skills/subagent-review/SKILL.md +0 -126
package/README.md CHANGED
@@ -8,7 +8,7 @@ A layered harness for [Claude Code](https://docs.anthropic.com/en/docs/claude-co
8
8
 
9
9
  Praxis gives Claude Code a three-layer operating system:
10
10
 
11
- **Universal base** — always loaded. [GSD](https://github.com/gsd-build/get-shit-done) structures work (spec → plan → execute → verify). [Superpowers](https://github.com/obra/superpowers) enforces quality (TDD, debugging, code review). [Ralph](https://github.com/snarktank/ralph) runs autonomous execution loops.
11
+ **Universal base** — always loaded. Praxis structures work (discuss → plan → execute → verify → simplify → ship). Built-in quality enforcement (debugging, code review, simplification).
12
12
 
13
13
  **AI-Kits** — activated on demand via `/kit:<name>`. Each kit bundles domain-specific rules, skills, MCP servers, and slash commands. Activate the web-designer kit and your components get design system enforcement, accessibility auditing, and production lint. Deactivate with `/kit:off`.
14
14
 
@@ -31,32 +31,23 @@ npx praxis-harness uninstall # remove Praxis-owned files from ~/.claude/
31
31
 
32
32
  ## After install
33
33
 
34
- Open Claude Code and run:
35
-
36
- ```
37
- /plugin marketplace add obra/superpowers-marketplace
38
- /plugin install superpowers@superpowers-marketplace
39
- /plugin marketplace add snarktank/ralph
40
- /plugin install ralph-skills@ralph-marketplace
41
- ```
42
-
43
- Verify with `/help` — you should see GSD, Superpowers, and Praxis commands.
34
+ Verify with `/help` you should see Praxis commands (`/discuss`, `/execute`, `/verify`, `/plan`, `/ship`, `/kit:*`).
44
35
 
45
36
  ## Workflow
46
37
 
47
- The standard GSD workflow for feature development:
38
+ The standard Praxis workflow for feature development:
48
39
 
49
40
  ```
50
41
  /standup → orient (reads status.md, surfaces stale state)
51
- /gsd:discuss → frame the problem (SPEC questions, scope guard)
42
+ /discuss → frame the problem (conversational, scope guard)
52
43
  /discover → research options with confidence levels (before /spec)
53
- /gsd:plan-phase → plan milestones (with dependency ordering + boundaries)
54
- /gsd:execute → implement one milestone at a time (file-group isolation)
55
- /gsd:verify → validate (test/lint/typecheck/build, self-review, UNIFY)
44
+ /plan → plan milestones (with dependency ordering + boundaries)
45
+ /execute → implement one milestone at a time (file-group isolation)
46
+ /verify → validate (test/lint/typecheck/build, self-review, UNIFY)
56
47
  /session-retro → capture learnings, update vault
57
48
  ```
58
49
 
59
- For pure bugfixes: `/debug` (test-first debugging, skips GSD).
50
+ For pure bugfixes: `/debug` (test-first debugging, skips the full loop).
60
51
  For code review: `/review` (launches subagent review at any time).
61
52
  For technical research: `/discover` (structured options evaluation before decisions).
62
53
 
@@ -64,10 +55,10 @@ For technical research: `/discover` (structured options evaluation before decisi
64
55
 
65
56
  | Command | Purpose |
66
57
  |---------|---------|
67
- | `gsd-discuss` | Frame the problem, SPEC questions, scope guard |
68
- | `gsd-execute` | Implement one milestone with file-group isolation + boundary enforcement |
69
- | `gsd-verify` | Validate milestone (test/lint/build), self-review, UNIFY phase summary |
70
- | `ralph` | Autonomous multi-story execution from a PRD |
58
+ | `discuss` | Conversational problem framing, SPEC synthesis, scope guard |
59
+ | `execute` | Implement one milestone with file-group isolation + boundary enforcement |
60
+ | `verify` | Validate milestone (test/lint/build), self-review, UNIFY phase summary |
61
+
71
62
  | `plan` | Create a dated work plan with milestone dependencies + checkpoints |
72
63
  | `spec` | Create a structured spec or ADR with conflict detection |
73
64
  | `discover` | Structured technical discovery with confidence-rated options |
@@ -86,17 +77,6 @@ Key additions in this version:
86
77
  - **context-management** — context brackets (FRESH/MODERATE/DEPLETED/CRITICAL) adapt behavior to session stage
87
78
  - **vault** — Obsidian vault integration
88
79
 
89
- ## Ralph
90
-
91
- Ralph is the autonomous execution mode for multi-story work. Use it when you have >5 independent stories that don't require human checkpoints.
92
-
93
- 1. Write a PRD using `/prd-writer` (structured story format with file groups and estimates)
94
- 2. Run `/ralph` to begin autonomous execution
95
- 3. Each story runs in a fresh context with its own verify cycle
96
- 4. Blocked stories are recorded and skipped — reported at run end
97
-
98
- Ralph is not a replacement for GSD — it runs GSD internally per story. Use GSD for work that needs cross-story reasoning or architectural decisions.
99
-
100
80
  ## Architecture
101
81
 
102
82
  ```
@@ -108,7 +88,7 @@ Ralph is not a replacement for GSD — it runs GSD internally per story. Use GSD
108
88
  │ Skills chain + domain rules + MCPs │
109
89
  ├────────────────────────────────────────┤
110
90
  │ Universal base (always loaded) │
111
- GSD Superpowers → Ralph
91
+ Praxis workflow engine
112
92
  ├────────────────────────────────────────┤
113
93
  │ Vault layer │
114
94
  │ Obsidian │
@@ -118,7 +98,7 @@ Ralph is not a replacement for GSD — it runs GSD internally per story. Use GSD
118
98
  └────────────────────────────────────────┘
119
99
  ```
120
100
 
121
- **Workflow hierarchy:** GSD owns the outer loop (discuss → plan → execute → verify). Superpowers enforces quality inside execution (TDD, review, debug). Ralph runs autonomous multi-story iterations. Kits inject domain context into this workflow — they don't replace it.
101
+ **Workflow hierarchy:** Praxis owns the outer loop (discuss → plan → execute → verify simplify ship). Kits inject domain context into this workflow — they don't replace it.
122
102
 
123
103
  ## Available kits
124
104
 
package/base/CLAUDE.md CHANGED
@@ -13,14 +13,11 @@ You are a senior engineering partner. Think before you build. Verify before you
13
13
  - Every option presented MUST include a recommendation and why.
14
14
 
15
15
  ## Workflow Hierarchy
16
- - **GSD** owns the outer loop: discuss → plan → execute → verify → simplify → ship.
17
- Always start feature work with GSD.
18
- - **Superpowers** enforces quality inside execution (TDD, review, debug).
19
- Its skills auto-activate — never invoke them alongside GSD phases.
20
- - **Ralph** runs autonomous multi-story iterations from the terminal.
16
+ - **Praxis** owns the outer loop: discuss → plan → execute → verify → simplify → ship.
17
+ Always start feature work with `/discuss` or `/next`.
21
18
  - **Kits** inject domain context into this workflow — they don't replace it.
22
- - Never invoke `/superpowers:write-plan` alongside `/gsd:plan-phase`.
23
- - Pure bugfixes: skip GSD, use Superpowers debugging directly.
19
+ - Pure bugfixes: skip the full loop, use `/debug` directly.
20
+ - Trivial changes (typos, config): use `/fast` to skip planning.
24
21
  - After every implementation: run `/simplify` to clean up code before verify.
25
22
  - Use `/verify-app` for end-to-end checks, `/ship` when ready to commit+push+PR.
26
23
 
@@ -40,15 +37,14 @@ permanent institutional memory. Don't wait for session-retro — fix the rule im
40
37
  ## Non-Negotiables (fire every session)
41
38
 
42
39
  **Before any non-trivial task:**
43
- - WHAT / DONE-WHEN / CONSTRAINTS / NON-GOALS — answer all four before starting.
40
+ - PROBLEM / DELIVERABLE / ACCEPTANCE / BOUNDARIES — answer all four before starting.
44
41
 
45
42
  **Stop-and-Fix Rule:** Validation fails → fix now → re-validate → proceed.
46
43
  If cannot fix in 3 attempts: STOP. Report What / So What / Now What.
47
44
 
48
45
  **Before every commit:**
49
- 1. Secret scan: `rg "(sk-|ghp_|pplx-|AKIA|Bearer [A-Za-z0-9+/]{20,})" $(git diff --staged --name-only)`
50
- 2. Lint + typecheckno commits with warnings or errors.
51
- 3. `git --no-pager config user.email` → must match expected identity. If mismatch: STOP.
46
+ See `~/.claude/rules/git-workflow.md` § Pre-Commit Invariants. These are also enforced
47
+ by hooks (secret-scan, identity-check)see `~/.claude/settings.json`.
52
48
 
53
49
  **Before writing any templated file:** Scan for unreplaced `{placeholder}` patterns. Zero must remain.
54
50
 
@@ -92,15 +88,15 @@ Missing servers are non-blocking — features degrade gracefully.
92
88
 
93
89
  ## After Compaction — Bootstrap
94
90
  1. Read project CLAUDE.md (always first)
95
- 2. Check `claude-progress.json` if `.ralph_state.current_story` is set: read it NOW, it is authoritative
96
- 3. Active task? → read active plan current milestone only
91
+ 2. Active task? read active plan current milestone only
97
92
  No active task? → read `status.md`
98
93
  4. Load rules only for what the current task touches:
99
- - Terraform/Azure → `~/.claude/rules/terraform.md`
94
+ - Terraform/Azure → `~/.claude/rules/terraform.md`, `~/.claude/rules/azure.md`
100
95
  - GitHub Actions → `~/.claude/rules/github-actions.md`
101
96
  - PowerShell scripts → `~/.claude/rules/powershell.md`
102
97
  - Git operation → `~/.claude/rules/git-workflow.md`
103
- - Security concern`~/.claude/rules/security.md`
98
+ - Client-facing writingauto-loaded by `communication-standards` skill
99
+ - Architecture/specs → auto-loaded by `architecture-patterns` skill
104
100
 
105
101
  ## Core Anti-Patterns (NEVER)
106
102
  - Silently swallow errors or use empty catch blocks
@@ -125,19 +121,15 @@ Kit manifests live in `~/.claude/kits/<name>/KIT.md`.
125
121
 
126
122
  ## Rules Registry — Load on Demand Only
127
123
 
128
- ### Universal — always active
124
+ ### Universal — always active (6 rules)
129
125
  | File | Purpose |
130
126
  |------|---------|
131
- | `~/.claude/rules/profile.md` | Who the user is, active projects, identities |
127
+ | `~/.claude/rules/profile.md` | Who the user is, identities, working style |
132
128
  | `~/.claude/rules/execution-loop.md` | SPEC/PLAN/VALIDATE loop enforcement |
133
- | `~/.claude/rules/coding.md` | Context7 mandate, error handling, no hardcodes |
134
- | `~/.claude/rules/code-quality.md` | Language-agnostic quality standards |
135
- | `~/.claude/rules/git-workflow.md` | Commits, branches, identity verification |
136
- | `~/.claude/rules/security.md` | Secrets, credentials, auth patterns |
137
- | `~/.claude/rules/communication.md` | Client writing, no AI attribution |
138
- | `~/.claude/rules/vault.md` | Second brain integration — Obsidian vault |
139
- | `~/.claude/rules/architecture.md` | ADR format, What/So What/Now What, risk docs |
140
- | `~/.claude/rules/context-management.md` | GSD/Ralph anti-rot, context reset protocol |
129
+ | `~/.claude/rules/coding.md` | Code quality, security, complexity thresholds, Context7 mandate |
130
+ | `~/.claude/rules/git-workflow.md` | Commits, branches, identity verification, pre-commit checks |
131
+ | `~/.claude/rules/vault.md` | Second brain integration — vault backend, file purposes |
132
+ | `~/.claude/rules/context-management.md` | Context anti-rot, phase scoping, context reset protocol |
141
133
 
142
134
  ### Scoped — load only when paths match
143
135
  | File | Loads when |
@@ -146,3 +138,9 @@ Kit manifests live in `~/.claude/kits/<name>/KIT.md`.
146
138
  | `~/.claude/rules/terraform.md` | `**/*.tf`, `**/*.tfvars` |
147
139
  | `~/.claude/rules/github-actions.md` | `.github/workflows/**` |
148
140
  | `~/.claude/rules/powershell.md` | `**/*.ps1`, `**/*.psm1` |
141
+
142
+ ### Auto-invocable skills (replace former universal rules)
143
+ | Skill | Triggers when |
144
+ |-------|--------------|
145
+ | `communication-standards` | Writing client-facing docs, proposals, status reports, commits, PRs |
146
+ | `architecture-patterns` | Writing ADRs, specs, system design, risk docs, blocker reports |
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env bash
2
+ # PostToolUse hook — auto-formats files after edit.
3
+ # Always exits 0 (advisory, never blocks).
4
+ set -uo pipefail
5
+
6
+ INPUT=$(cat)
7
+ FILE_PATH=$(echo "$INPUT" | jq -r '.tool_input.file_path // .tool_input.path // empty' 2>/dev/null)
8
+
9
+ if [[ -z "$FILE_PATH" || ! -f "$FILE_PATH" ]]; then
10
+ exit 0
11
+ fi
12
+
13
+ EXT="${FILE_PATH##*.}"
14
+
15
+ case "$EXT" in
16
+ tf|tfvars)
17
+ if command -v terraform &>/dev/null; then
18
+ terraform fmt "$FILE_PATH" 2>/dev/null
19
+ fi
20
+ ;;
21
+ py)
22
+ if command -v ruff &>/dev/null; then
23
+ ruff format --quiet "$FILE_PATH" 2>/dev/null
24
+ elif command -v black &>/dev/null; then
25
+ black --quiet "$FILE_PATH" 2>/dev/null
26
+ fi
27
+ ;;
28
+ ts|tsx|js|jsx|json|css)
29
+ if command -v prettier &>/dev/null; then
30
+ prettier --write "$FILE_PATH" 2>/dev/null
31
+ fi
32
+ ;;
33
+ go)
34
+ if command -v gofmt &>/dev/null; then
35
+ gofmt -w "$FILE_PATH" 2>/dev/null
36
+ fi
37
+ ;;
38
+ esac
39
+
40
+ exit 0
@@ -0,0 +1,55 @@
1
+ #!/usr/bin/env bash
2
+ # PreToolUse hook — blocks git commit if email doesn't match expected identity.
3
+ # Reads expected emails from praxis.config.json identity section.
4
+ # Exit 0 = allow, Exit 2 = block with message.
5
+ set -euo pipefail
6
+
7
+ INPUT=$(cat)
8
+
9
+ # Only fire on Bash tool calls that contain "git commit"
10
+ COMMAND=$(echo "$INPUT" | jq -r '.tool_input.command // empty' 2>/dev/null)
11
+ if [[ -z "$COMMAND" ]] || ! echo "$COMMAND" | grep -q "git commit"; then
12
+ exit 0
13
+ fi
14
+
15
+ # Read identity config
16
+ CONFIG="$HOME/.claude/praxis.config.json"
17
+ if [[ ! -f "$CONFIG" ]]; then
18
+ exit 0
19
+ fi
20
+
21
+ CWD=$(pwd)
22
+ ACTUAL_EMAIL=$(git --no-pager config user.email 2>/dev/null || echo "")
23
+
24
+ # Check work path match
25
+ WORK_PATH=$(jq -r '.identity.work.path_match // empty' "$CONFIG" 2>/dev/null)
26
+ WORK_EMAIL=$(jq -r '.identity.work.email // empty' "$CONFIG" 2>/dev/null)
27
+ PERSONAL_PATH=$(jq -r '.identity.personal.path_match // empty' "$CONFIG" 2>/dev/null)
28
+ PERSONAL_EMAIL=$(jq -r '.identity.personal.email // empty' "$CONFIG" 2>/dev/null)
29
+
30
+ EXPECTED_EMAIL=""
31
+ if [[ -n "$WORK_PATH" ]] && echo "$CWD" | grep -q "$WORK_PATH"; then
32
+ EXPECTED_EMAIL="$WORK_EMAIL"
33
+ elif [[ -n "$PERSONAL_PATH" ]] && echo "$CWD" | grep -q "$PERSONAL_PATH"; then
34
+ EXPECTED_EMAIL="$PERSONAL_EMAIL"
35
+ else
36
+ # Unknown path — allow but warn
37
+ echo "WARNING: CWD $CWD does not match known identity paths." >&2
38
+ exit 0
39
+ fi
40
+
41
+ if [[ -n "$EXPECTED_EMAIL" && "$ACTUAL_EMAIL" != "$EXPECTED_EMAIL" ]]; then
42
+ echo "BLOCKED: Git identity mismatch." >&2
43
+ echo " Expected: $EXPECTED_EMAIL" >&2
44
+ echo " Actual: $ACTUAL_EMAIL" >&2
45
+ echo " CWD: $CWD" >&2
46
+ # Check if includeIf is configured and suggest fix
47
+ if git config --global --get-regexp 'includeIf' &>/dev/null; then
48
+ echo " Note: includeIf is configured in ~/.gitconfig — verify CWD matches an includeIf path." >&2
49
+ else
50
+ echo " Fix: git config --local user.email \"$EXPECTED_EMAIL\"" >&2
51
+ fi
52
+ exit 2
53
+ fi
54
+
55
+ exit 0
@@ -14,7 +14,7 @@ if [[ -z "$FILE_PATH" || ! -f "$FILE_PATH" ]]; then
14
14
  fi
15
15
 
16
16
  # Scan the file for secret patterns
17
- SECRET_PATTERN='(sk-[a-zA-Z0-9]{20,}|ghp_[a-zA-Z0-9]{36,}|pplx-[a-zA-Z0-9]{20,}|AKIA[0-9A-Z]{16}|Bearer [A-Za-z0-9+/]{20,})'
17
+ SECRET_PATTERN='(sk-[a-zA-Z0-9]{20,}|ghp_[a-zA-Z0-9]{36,}|pplx-[a-zA-Z0-9]{20,}|AKIA[0-9A-Z]{16}|Bearer [A-Za-z0-9+/]{20,}|DefaultEndpointsProtocol|AccountKey=)'
18
18
 
19
19
  if rg -q "$SECRET_PATTERN" "$FILE_PATH" 2>/dev/null; then
20
20
  MATCHES=$(rg -n "$SECRET_PATTERN" "$FILE_PATH" 2>/dev/null | head -5)
@@ -0,0 +1,61 @@
1
+ {
2
+ "hooks": {
3
+ "PreToolUse": [
4
+ {
5
+ "matcher": "Write|Edit|MultiEdit",
6
+ "hooks": [
7
+ {
8
+ "type": "command",
9
+ "command": "bash ~/.claude/hooks/secret-scan.sh"
10
+ }
11
+ ]
12
+ },
13
+ {
14
+ "matcher": "Bash",
15
+ "hooks": [
16
+ {
17
+ "type": "command",
18
+ "command": "bash ~/.claude/hooks/identity-check.sh"
19
+ }
20
+ ]
21
+ }
22
+ ],
23
+ "PostToolUse": [
24
+ {
25
+ "matcher": "Write|Edit|MultiEdit",
26
+ "hooks": [
27
+ {
28
+ "type": "command",
29
+ "command": "bash ~/.claude/hooks/auto-format.sh"
30
+ }
31
+ ]
32
+ }
33
+ ],
34
+ "Stop": [
35
+ {
36
+ "matcher": "",
37
+ "hooks": [
38
+ {
39
+ "type": "command",
40
+ "command": "bash ~/.claude/hooks/post-session-lint.sh"
41
+ },
42
+ {
43
+ "type": "prompt",
44
+ "prompt": "Review the conversation. Did you complete all tasks the user requested? Are there uncommitted changes that should be committed? Are there vault files (status.md, plan) that should be updated? Answer yes/no for each."
45
+ }
46
+ ]
47
+ }
48
+ ],
49
+ "PreCompact": [
50
+ {
51
+ "matcher": "",
52
+ "hooks": [
53
+ {
54
+ "type": "command",
55
+ "command": "bash ~/.claude/hooks/vault-checkpoint.sh"
56
+ }
57
+ ]
58
+ }
59
+ ]
60
+ }
61
+ }
@@ -37,11 +37,6 @@ if [[ -f "$STATUS_FILE" ]]; then
37
37
  [[ -z "$LOOP_POSITION" ]] && LOOP_POSITION="unknown"
38
38
  fi
39
39
 
40
- RALPH_STORY="inactive"
41
- if [[ -f "$PROGRESS_FILE" ]]; then
42
- RALPH_STORY=$(jq -r '.ralph_state.current_story // "inactive"' "$PROGRESS_FILE" 2>/dev/null)
43
- fi
44
-
45
40
  cat > "$CHECKPOINT_FILE" <<EOF
46
41
  ---
47
42
  tags: [checkpoint, compact]
@@ -60,12 +55,9 @@ $PWD
60
55
  ## Active Plan
61
56
  $CURRENT_PLAN
62
57
 
63
- ## GSD Phase
58
+ ## Loop Position
64
59
  $LOOP_POSITION
65
60
 
66
- ## Ralph State
67
- $RALPH_STORY
68
-
69
61
  ## Note
70
62
  This checkpoint was auto-written by the PreCompact hook.
71
63
  Read this file after compaction to restore context.
@@ -1,11 +1,11 @@
1
1
  # Context Management — Rules
2
2
  # Scope: All projects, all sessions
3
- # Prevents context rot via GSD phase discipline and Ralph story sizing
3
+ # Prevents context rot via phase discipline
4
4
 
5
- ## GSD Phase Discipline — Invariants (BLOCK on violation)
5
+ ## Phase Discipline — Invariants (BLOCK on violation)
6
6
 
7
7
  ### Phase-scoped context loading
8
- - Load ONLY context required for the current GSD phase.
8
+ - Load ONLY context required for the current phase.
9
9
  SPEC needs requirements and constraints — not implementation details.
10
10
  IMPLEMENT needs the plan and relevant source files — not research notes.
11
11
  - At the end of each phase: write a phase summary to the active plan file.
@@ -21,50 +21,6 @@
21
21
  IMPLEMENT → VALIDATE: test output and lint output are the evidence.
22
22
  - Use subagents for exploration, research, and review to protect the main context.
23
23
 
24
- ## Ralph Story Sizing — Invariants (BLOCK on violation)
25
-
26
- ### Size constraint
27
- - Each Ralph PRD story must be completable in a single context window (~10k output tokens).
28
- - Right-sized stories: add one component, one migration, one service method,
29
- one test suite, or one configuration change.
30
- - Too large: any story requiring >3 file groups or >1 architectural decision.
31
- Split before execution.
32
- - Stories requiring cross-story reasoning belong in GSD, not Ralph.
33
- Ralph stories must be independently verifiable.
34
-
35
- ### State contract
36
- - `claude-progress.json` is the ONLY state bridge between Ralph iterations.
37
- - The `ralph_state` object is authoritative:
38
- ```json
39
- {
40
- "mode": "idle | active",
41
- "prd_path": null,
42
- "completed_stories": [],
43
- "current_story": null
44
- }
45
- ```
46
- - Ralph reads `ralph_state` at iteration start, writes at iteration end.
47
- - Never reference conversation history as source of truth in Ralph mode.
48
-
49
- ## When to Use GSD vs Ralph — Conventions (WARN on violation)
50
-
51
- | Trigger | Use | Reason |
52
- |---------|-----|--------|
53
- | <5 stories, needs reasoning continuity | GSD | Decisions compound across stories |
54
- | Architectural decisions required | GSD | Context must persist through tradeoff analysis |
55
- | Exploratory or ambiguous scope | GSD | Needs human-in-the-loop at phase gates |
56
- | >5 independent stories | Ralph | Parallelizable, no cross-story dependencies |
57
- | Overnight/unattended execution | Ralph | Fresh context per story prevents drift |
58
- | Mechanical transformations (migrations, renames) | Ralph | Repetitive, well-scoped, low judgment |
59
-
60
- Default to GSD. Use Ralph only when stories are clearly independent and well-scoped.
61
-
62
- ## Compaction Safety — Invariants (BLOCK on violation)
63
-
64
- ### Ralph mid-run takes precedence
65
- - If `claude-progress.json` → `.ralph_state.current_story` is set, ALWAYS read it — even if an active plan exists.
66
- - Ralph mid-run state is authoritative over plan state. The story must complete or be explicitly blocked before plan-level work resumes.
67
-
68
24
  ## Subagent Discipline — Conventions (WARN on violation)
69
25
 
70
26
  ### Subagent scope
@@ -119,9 +75,6 @@ conversation length heuristic (not token count — we cannot read session JSONL)
119
75
  ## Verification Commands
120
76
 
121
77
  ```bash
122
- # Check that claude-progress.json has ralph_state field
123
- jq '.ralph_state' {vault_path}/claude-progress.json
124
-
125
78
  # Verify active plan file exists and has phase summaries
126
79
  ls -la {vault_path}/plans/
127
80
 
@@ -1,84 +1,64 @@
1
1
  # Execution Loop — Rules
2
2
  # Scope: All projects, all sessions
3
- # Extracted from ~/.claude/CLAUDE.md to reduce root file size
3
+ # Invariants only. Phase details live in the commands that implement them.
4
4
 
5
- ## Core Loop (MANDATORYevery non-trivial task)
5
+ ## Loop Order (referencecommands are authoritative)
6
+ `/discuss` → `/plan` → `/execute` → `/verify` → `/simplify` → `/ship`
6
7
 
7
- ### Phase 1: SPEC
8
- Answer four questions before any code or file is written:
9
- - **WHAT**: Concrete deliverable (not vague goals)
10
- - **DONE-WHEN**: Specific checks that prove completion
11
- - **CONSTRAINTS**: Performance, compatibility, style requirements
12
- - **NON-GOALS**: What this task explicitly does NOT include
13
- If ambiguous: ask 2–3 clarifying questions before proceeding.
8
+ Each command file contains its own steps. This file defines only the
9
+ cross-cutting invariants that apply regardless of which phase is active.
14
10
 
15
- ### Risk Check (MANDATORY if any apply)
16
- Run `/risk` before proceeding to PLAN if the task:
11
+ ## Invariants BLOCK on violation
12
+
13
+ ### SPEC before code
14
+ No code or file changes until PROBLEM / DELIVERABLE / ACCEPTANCE / BOUNDARIES are answered.
15
+ `/discuss` synthesizes these from conversation. If discuss was skipped,
16
+ the implementer must answer all four before proceeding.
17
+
18
+ ### Risk check gate
19
+ Run `/risk` before `/plan` if the task:
17
20
  - Touches infrastructure files (`*.tf`, `*.bicep`, `*.yml` in `.github/workflows/`)
18
21
  - Touches authentication, credentials, or secrets handling
19
22
  - Modifies >3 files across different domains
20
- - Has a NON-GOALS list that explicitly defers something risky
23
+ - Has BOUNDARIES (out of scope) that explicitly defer something risky
21
24
 
22
- If any condition is met: `/risk` must produce at minimum one risk entry before `/gsd:plan-phase`.
25
+ ### Plan before implementation
26
+ Do NOT begin implementation until a plan exists and is approved.
27
+ The plan is the sole implementation guide — not conversation history.
23
28
 
24
- ### Phase 2: PLAN
25
- - Break work into milestones small enough to complete and verify in one pass.
26
- - Each milestone MUST have: description, acceptance criteria, validation command.
27
- - Save plan to `{vault_path}/plans/YYYY-MM-DD_[task-slug].md` with frontmatter:
28
- ```yaml
29
- ---
30
- created: YYYY-MM-DD
31
- status: active
32
- tags: [relevant, tags]
33
- ---
34
- ```
35
- - Update `{vault_path}/status.md` → `current_plan:` field.
36
- - Do NOT begin implementation until the plan is approved.
29
+ ### One milestone at a time
30
+ Keep diffs scoped. Do not expand scope without explicit approval.
31
+ Never let uncommitted work span multiple milestones.
37
32
 
38
- ### Phase 3: IMPLEMENT
39
- - One milestone at a time. Keep diffs scoped.
40
- - Do not expand scope without explicit approval.
41
- - Use extended thinking for tasks touching >3 files or requiring architectural decisions.
42
-
43
- ### Phase 4: VALIDATE
33
+ ### Validate with evidence
44
34
  After EACH milestone — show actual output, not assertions:
45
- 1. Run test suite → show output
46
- 2. Run linter → show output, fix ALL warnings
47
- 3. Run typecheck (if applicable) → show output
48
- 4. Run build (if applicable) → show output
49
- 5. Report: PASS or FAIL with specifics
50
-
51
- ### Phase 5: REPAIR (Stop-and-Fix)
52
- If ANY validation fails:
53
- - Do NOT proceed to the next milestone.
54
- - Fix NOW. Re-validate. Then proceed.
55
- - If cannot fix in 3 attempts: STOP.
56
- Report: **What** (full error + 3 attempts) → **So What** (root cause) → **Now What** (next steps)
35
+ 1. Test suite output
36
+ 2. Linter output (fix ALL warnings)
37
+ 3. Typecheck output (if applicable)
38
+ 4. Build output (if applicable)
39
+ Report: PASS or FAIL with specifics.
57
40
 
58
- ### Phase 6: COMMIT
59
- - Commit at milestone completion. See git-workflow.md.
60
- - Never let uncommitted work span multiple milestones.
41
+ ### Stop-and-fix
42
+ If ANY validation fails: fix NOW, re-validate, then proceed.
43
+ If cannot fix in 3 attempts: STOP.
44
+ Report: **What** (full error + 3 attempts) → **So What** (root cause) → **Now What** (next steps)
61
45
 
62
- ### Phase 7: LOG
63
- - Update `{vault_path}/status.md`: what was done, decisions made, what's next.
64
- - Mark completed milestone status in the plan file.
65
- - Update `{vault_path}/_index.md` goals if project direction changed.
66
- - Vault indexing is automatic (obsidian) or not needed (other backends).
46
+ ### Commit at milestone boundaries
47
+ Commit when verify passes. See git-workflow.md.
67
48
 
68
- ### Phase 8: REPEAT
69
- Next milestone. Loop until plan complete.
49
+ ### Log to vault
50
+ After each milestone: update status.md, mark milestone complete in plan file.
51
+ After ALL milestones: update _index.md goals if project direction changed.
70
52
 
71
53
  ## Self-Review Protocol
72
54
  After ALL milestones, before reporting done:
73
- 1. Use a subagent to review the diff as a critical code reviewer.
74
- Prompt: "Review this diff for bugs, edge cases, error handling gaps, security issues,
75
- and violations of project conventions. Rate each: Critical / Major / Minor."
76
- — Subagent receives ONLY: the diff, the SPEC, relevant rules files. NOT the conversation history.
55
+ 1. Launch a subagent to review the full diff as a critical code reviewer.
56
+ Subagent receives ONLY: the diff, the SPEC (from plan file), relevant rules.
57
+ NOT the conversation history.
77
58
  2. Address all Critical and Major findings.
78
59
  3. Re-validate after fixes.
79
60
  4. If reviewer found >3 issues: run review again (max 3 rounds).
80
61
 
81
62
  ## Context Management
82
- See `~/.claude/rules/context-management.md` for complete context discipline:
83
- GSD phase scoping, Ralph story sizing, context reset protocol.
84
- - Use subagents (Task tool) for exploration, research, and review.
63
+ See `~/.claude/rules/context-management.md` for:
64
+ Phase scoping, subagent discipline, context reset protocol.
@@ -2,12 +2,12 @@
2
2
  # Scope: All projects with git repos
3
3
 
4
4
  ## Identity — Invariants (BLOCK on violation)
5
- <!-- CUSTOMIZE: Replace with your git identities -->
6
- <!-- Example identity table: -->
7
- <!-- | Type | gitconfig | SSH Key | Email | includeIf Path | -->
8
- <!-- |------|-----------|---------|-------|----------------| -->
9
- <!-- | Work | ~/.gitconfig-work | ~/.ssh/id_ed25519_work | you@company.com | ~/Projects/Work/ | -->
10
- <!-- | Personal | ~/.gitconfig-personal | ~/.ssh/id_ed25519_personal | you@personal.com | ~/Projects/Personal/ | -->
5
+ <!-- NOTE: This is a TEMPLATE. install.sh generates the real file with actual identities. -->
6
+
7
+ | Type | gitconfig | SSH Key | Email | Path Match |
8
+ |------|-----------|---------|-------|------------|
9
+ | Work | {identity.work.gitconfig} | {identity.work.ssh_key} | {identity.work.email} | {identity.work.path_match} |
10
+ | Personal | {identity.personal.gitconfig} | {identity.personal.ssh_key} | {identity.personal.email} | {identity.personal.path_match} |
11
11
 
12
12
  **Verification:** `git --no-pager config user.email`
13
13
  **On mismatch:** STOP. Report `expected: X, got: Y`. Do not commit.
@@ -32,7 +32,7 @@
32
32
  - Keep working tree clean — no untracked debris, no partial stages.
33
33
 
34
34
  ## Pre-Commit Invariants (BLOCK on violation)
35
- 1. Secret scan staged files: `rg "(sk-|ghp_|pplx-|AKIA|Bearer [A-Za-z0-9+/]{20,})" $(git diff --staged --name-only)`
35
+ 1. Secret scan staged files: `rg "(sk-|ghp_|pplx-|AKIA|Bearer [A-Za-z0-9+/]{20,}|DefaultEndpointsProtocol|AccountKey=)" $(git diff --staged --name-only)`
36
36
  2. Confirm `git config user.email` matches expected identity for this repo path.
37
37
  3. Run stack linter (see terraform.md, github-actions.md as applicable).
38
38
  4. Run typecheck if applicable — no commits with type errors.