gm-oc 2.0.402 → 2.0.404

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-oc",
3
- "version": "2.0.402",
3
+ "version": "2.0.404",
4
4
  "description": "State machine agent with hooks, skills, and automated git enforcement",
5
5
  "author": "AnEntrypoint",
6
6
  "license": "MIT",
@@ -126,6 +126,53 @@ Invoke `browser` skill. Escalation — exhaust each before advancing:
126
126
 
127
127
  Completing a phase is NOT stopping. After every phase: read .prd, check git, invoke next skill. Only when .prd is deleted AND git is clean AND all commits are pushed may you return a final response to the user.
128
128
 
129
+ ## MANDATORY DEV WORKFLOW — ABSOLUTE RULES
130
+
131
+ These rules apply to ALL phases. Violations trigger immediate snake to planning.
132
+
133
+ **FILES**:
134
+ - Permanent structure ONLY — NO ephemeral/temp/mock/simulation files. Use exec: and browser skill instead
135
+ - Single primary implementations — ZERO failovers/fallbacks/demo modes ever
136
+ - Errors fail with brutally clear logs — NEVER hide through failovers or silent catches
137
+ - Hard 200-line limit per file — split files >200 lines BEFORE continuing
138
+ - NO report/doc files except CHANGELOG.md, CLAUDE.md, README.md, TODO.md — DELETE others on discovery
139
+ - Remove ALL comments immediately when encountered — zero tolerance
140
+ - NO test files (.test.js, .spec.js, __tests__/) — manual testing only via exec: and browser skill
141
+ - Clean ALL files not required for the program to function
142
+
143
+ **CODE QUALITY**:
144
+ - ALWAYS scan codebase (exec:codesearch) before editing — find everything that touches the same concern
145
+ - **Duplicate concern = snake to planning**: overlapping responsibility, similar logic in different places, parallel implementations, or code that could be consolidated. Snake to `planning` with consolidation instructions
146
+ - After every file write: run exec:codesearch for the primary function/concern you just wrote. If ANY other code serves the same concern → snake to `planning` with consolidation instructions. This is not optional — it is a gate
147
+ - When a native feature, stdlib function, or convention replaces custom code → delete the custom code. When it would add code → do not use it
148
+ - When a naming convention, directory structure, or auto-discovery pattern can replace explicit registration or configuration → replace it
149
+ - ZERO hardcoded values — all values derived from ground truth, config, or convention
150
+ - NO adjectives/descriptive language in code (variable/function names must be terse and functional)
151
+ - No mocks/simulations/fallbacks/hardcoded/fake elements — delete on discovery
152
+ - Client-side code: expose all state via debug globals (window.__debug or similar)
153
+
154
+ **ERROR HANDLING**:
155
+ - Every error must throw and propagate with clear context
156
+ - No `|| defaultValue`, no `catch { return null }`, no graceful degradation
157
+ - The only acceptable error handling: catch → log the real error → re-throw or display to user
158
+
159
+ **DEBUGGING**:
160
+ - ALWAYS hypothesize/troubleshoot via execution BEFORE editing any files
161
+ - Check git history (`git log`, `git diff`) for troubleshooting known regressions — never revert, use differential comparisons and edit new code manually
162
+ - Keep execution logs concise (<4k chars ideal, 30k max)
163
+ - Clear cache before playwright/browser debugging
164
+
165
+ **DOCUMENTATION** (update at every phase transition, not at the end):
166
+ - CLAUDE.md: after each structural change, update technical info. NO progress/changelogs
167
+ - TODO.md: add items when discovered, remove when done. File must not exist at completion
168
+ - CHANGELOG.md: append entry after each commit
169
+ - After push: deploy if deployable, publish if npm package
170
+
171
+ **PROCESS**:
172
+ - Only persistent background shells for long-running CLI processes
173
+ - Test via exec: and browser skill — NO test files ever
174
+ - Test locally before live
175
+
129
176
  ## CONSTRAINTS
130
177
 
131
178
  **Tier 0**: no_crash, no_exit, ground_truth_only, real_execution, fail_loud
@@ -133,8 +180,6 @@ Completing a phase is NOT stopping. After every phase: read .prd, check git, inv
133
180
  **Tier 2**: no_duplication, no_hardcoded_values, modularity
134
181
  **Tier 3**: no_comments, convention_over_code
135
182
 
136
- **FAIL LOUD — NO FALLBACKS**: Never create fallback modes, demo modes, graceful degradation, silent error swallowing, or try/catch that returns a default value instead of propagating the error. Every error must throw and propagate. If something fails, the user must see exactly what failed and why. No `|| defaultValue`, no `catch { return null }`, no "demo mode", no "offline mode", no degraded functionality. The only acceptable error handling is: catch log the real error re-throw or display to user.
137
-
138
- **Never**: `Bash(node/npm/npx/bun)` | skip planning | sequential independent items | screenshot before JS exhausted | narrate past unresolved mutables | stop while .prd has items | ask the user what to do next while work remains | create fallback/demo modes | silently swallow errors
183
+ **Never**: `Bash(node/npm/npx/bun)` | skip planning | sequential independent items | screenshot before JS exhausted | narrate past unresolved mutables | stop while .prd has items | ask the user what to do next while work remains | create fallback/demo modes | silently swallow errors | duplicate concern | leave comments | create test files | leave stale architecture when changes reveal restructuring opportunity
139
184
 
140
- **Always**: invoke named skill at every transition | snake to planning on any new unknown | witnessed execution only | keep going until .prd deleted and git clean
185
+ **Always**: invoke named skill at every transition | snake to planning on any new unknown | snake to planning when duplicate concern or restructuring opportunity discovered | witnessed execution only | scan codebase before edits | keep going until .prd deleted and git clean
@@ -118,9 +118,28 @@ gh run list --repo AnEntrypoint/<downstream-repo> --limit 3 --json databaseId,na
118
118
  ```
119
119
  Monitor any cascade runs the same way — poll, diagnose failures, fix if the cause is in this repo.
120
120
 
121
+ ## CODEBASE HYGIENE SWEEP
122
+
123
+ Before declaring complete, sweep the entire codebase for violations:
124
+
125
+ 1. **Files >200 lines** → split immediately
126
+ 2. **Comments in code** → remove all
127
+ 3. **Test files** (.test.js, .spec.js, __tests__/) → delete
128
+ 4. **Mock/stub/simulation files** → delete
129
+ 5. **Unnecessary doc files** (not CHANGELOG/CLAUDE/README/TODO.md) → delete
130
+ 6. **Duplicate concern** (overlapping responsibility, similar logic, parallel implementations, consolidatable code) → snake to `planning` with restructuring instructions — do not patch locally
131
+ 7. **Hardcoded values** → derive from ground truth, config, or convention
132
+ 8. **Fallback/demo modes** → remove, fail loud instead
133
+ 9. **TODO.md** → must be empty/deleted before completion
134
+ 10. **CHANGELOG.md** → must have entries for this session's changes
135
+ 11. **CLAUDE.md** → must reflect current technical state
136
+ 12. **Deploy/publish** → if deployable, deploy. If npm package, publish.
137
+
138
+ Any violation found = fix immediately before advancing.
139
+
121
140
  ## COMPLETION DEFINITION
122
141
 
123
- All of: witnessed end-to-end output | all failure paths exercised | .prd empty | git clean and pushed | all CI runs green | `user_steps_remaining=0`
142
+ All of: witnessed end-to-end output | all failure paths exercised | .prd empty | git clean and pushed | all CI runs green | codebase hygiene sweep clean | TODO.md empty/deleted | CHANGELOG.md updated | `user_steps_remaining=0`
124
143
 
125
144
  ## DO NOT STOP
126
145
 
@@ -128,9 +147,9 @@ After end-to-end verification passes: read .prd from disk. If any items remain,
128
147
 
129
148
  ## CONSTRAINTS
130
149
 
131
- **Never**: claim done without witnessed output | uncommitted changes | unpushed commits | failed CI runs | .prd items remaining | stop at first green | absorb surprises silently | respond to user while .prd has items
150
+ **Never**: claim done without witnessed output | uncommitted changes | unpushed commits | failed CI runs | .prd items remaining | TODO.md with items remaining | stop at first green | absorb surprises silently | respond to user while .prd has items | skip hygiene sweep | leave comments/mocks/test files/fallbacks
132
151
 
133
- **Always**: triage failure before snaking | witness end-to-end | snake to planning on any new unknown | enumerate remaining after every success | check .prd after every verification pass
152
+ **Always**: triage failure before snaking | witness end-to-end | snake to planning on any new unknown | enumerate remaining after every success | check .prd after every verification pass | run hygiene sweep before declaring complete | deploy/publish if applicable | update CHANGELOG.md
134
153
 
135
154
  ---
136
155
 
@@ -71,11 +71,18 @@ Pre-emit revealing unexpected behavior → new unknown → snake to `planning`.
71
71
  - Pre-emit debug passed with real inputs and error inputs
72
72
  - Post-emit verification matches pre-emit exactly
73
73
  - Hot reloadable: state outside reloadable modules, handlers swap atomically
74
- - Crash-proof: catch at every boundary, recovery hierarchy
75
- - No mocks/fakes/stubs anywhere
76
- - Files ≤200 lines, no duplicate code, no comments, no hardcoded values
77
- - No fallbacks, demo modes, or silent error swallowing every error must throw and propagate
74
+ - Errors throw with clear context — no fallbacks, demo modes, silent swallowing, `|| default`, `catch { return null }`
75
+ - No mocks/fakes/stubs/simulations/test files anywhere — delete on discovery
76
+ - Files ≤200 lines split immediately if over, do not advance
77
+ - No duplicate concern — after writing, run exec:codesearch for the primary concern. If ANY other code serves the same concern → do NOT advance, snake to `planning` with consolidation instructions
78
+ - No comments — remove any found
79
+ - No hardcoded values — dynamic/modular code using ground truth only
80
+ - No adjectives/descriptive language in variable/function names
81
+ - No unnecessary files — clean anything not required for the program to function
82
+ - Client-side code exposes debug globals (window.__debug or similar)
78
83
  - CLAUDE.md reflects actual behavior
84
+ - CHANGELOG.md updated with changes
85
+ - TODO.md cleared or deleted
79
86
 
80
87
  ## CODEBASE EXPLORATION
81
88
 
@@ -92,7 +99,7 @@ Invoke `browser` skill. Escalation: (1) `exec:browser\n<js>` → (2) `browser` s
92
99
 
93
100
  ## SELF-CHECK (before and after each file)
94
101
 
95
- File ≤200 lines | No duplication | Pre-emit passed | No mocks | No comments | Docs match | All spotted issues fixed
102
+ File ≤200 lines | No duplicate concern | Pre-emit passed | No mocks | No comments | Docs match | All spotted issues fixed
96
103
 
97
104
  ## DO NOT STOP
98
105
 
@@ -114,7 +114,11 @@ Invoke `browser` skill. Escalation — exhaust each before advancing:
114
114
 
115
115
  ## GROUND TRUTH
116
116
 
117
- Real services, real data, real timing. Mocks/fakes/stubs = delete immediately. No .test.js/.spec.js. Delete on discovery.
117
+ Real services, real data, real timing. Mocks/fakes/stubs/simulations = delete immediately. No .test.js/.spec.js. Delete on discovery. No fallback/demo modes — errors must fail loud with clear logs.
118
+
119
+ **SCAN BEFORE EDIT**: Before modifying or creating any file, search the codebase (exec:codesearch) for existing implementations of the same concern. "Duplicate" means overlapping responsibility, similar logic, or parallel implementations — not just identical files. If consolidation is possible, snake to `planning` with restructuring instructions instead of continuing.
120
+
121
+ **HYPOTHESIZE VIA EXECUTION**: Always troubleshoot and validate hypotheses through witnessed execution BEFORE editing files. Never edit based on assumptions — run the code first, observe the actual behavior, then edit with ground truth.
118
122
 
119
123
  ## DO NOT STOP
120
124
 
@@ -122,9 +126,9 @@ Never respond to the user from this phase. When all mutables are KNOWN, immediat
122
126
 
123
127
  ## CONSTRAINTS
124
128
 
125
- **Never**: `Bash(node/npm/npx/bun)` | fake data | mock files | Glob/Grep/Read/Explore (hook-blocked — use exec:codesearch) | sequential independent items | absorb surprises silently | respond to user or pause for input
129
+ **Never**: `Bash(node/npm/npx/bun)` | fake data | mock files | test files | fallback/demo modes | Glob/Grep/Read/Explore (hook-blocked — use exec:codesearch) | sequential independent items | absorb surprises silently | respond to user or pause for input | edit files before executing to understand current behavior | duplicate existing code
126
130
 
127
- **Always**: witness every hypothesis | import real modules | snake to planning on any new unknown | fix immediately on discovery | invoke next skill immediately when done
131
+ **Always**: witness every hypothesis | import real modules | scan codebase before creating/editing files | snake to planning on any new unknown | fix immediately on discovery | delete mocks/stubs/comments/test files on discovery | invoke next skill immediately when done
128
132
 
129
133
  ---
130
134
 
@@ -39,6 +39,8 @@ Planning = exhaustive mutable discovery. For every aspect of the task ask:
39
39
 
40
40
  Categories of unknowns to enumerate: file existence | API shape | data format | dependency versions | runtime behavior | environment differences | error conditions | concurrency | integration points | backwards compatibility | rollback paths | deployment steps | verification criteria
41
41
 
42
+ **MANDATORY CODEBASE SCAN**: For every planned item, add `existingImpl=UNKNOWN` mutable. Resolve by running exec:codesearch for the concern (not the implementation). If existing code serves the same concern → the .prd item becomes a consolidation task, not an addition. The plan restructures existing code to absorb the new requirement — never bolt new code alongside existing code that does related work.
43
+
42
44
  ## .PRD FORMAT
43
45
 
44
46
  Path: exactly `./.prd` in current working directory. **JSON array** written via `exec:nodejs`.