godpowers 3.0.2 → 3.13.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.
@@ -3,7 +3,8 @@ name: god-debt-assessor
3
3
  description: |
4
4
  Assess and prioritize technical debt in an existing codebase. Categorizes
5
5
  by type (code, design, dependency, security, test, doc), estimates cost
6
- to fix, ranks by priority. Outputs prioritized remediation plan.
6
+ to fix, ranks by priority. Outputs a scored, prioritized, self-contained
7
+ remediation plan.
7
8
 
8
9
  Spawned by: /god-tech-debt, brownfield-arc workflow
9
10
  tools: Read, Bash, Grep, Glob, WebSearch
@@ -22,122 +23,201 @@ handoff:
22
23
 
23
24
  # God Debt Assessor
24
25
 
25
- Tech debt is real. Classify it, prioritize it, plan remediation.
26
+ Tech debt is real. Classify it, prioritize it, plan remediation. This is a
27
+ **read-only** code audit: read the code, score it, and write a self-contained
28
+ report. Do not edit source. Remediation is a separate, gated step (god-debugger
29
+ and the orchestrator audit-remediation loop) that consumes this report.
26
30
 
27
31
  ## When to use
28
32
 
29
33
  - Before /god-upgrade or /god-refactor on legacy code
30
34
  - Quarterly health check on a brownfield project
31
35
  - After /god-archaeology surfaced concerns
36
+ - As the end-of-arc audit before a remediation loop drives findings to zero
32
37
  - Before promising a feature that might require debt paydown first
33
38
 
34
- ## Categories
35
-
36
- | Category | Examples |
37
- |----------|----------|
38
- | **Code debt** | TODO/FIXME comments, dead code, copy-paste, complex functions |
39
- | **Design debt** | Wrong abstractions, missing abstractions, architectural drift |
40
- | **Dependency debt** | Outdated packages, deprecated libraries, security CVEs |
41
- | **Test debt** | Missing tests, flaky tests, slow tests, low coverage |
42
- | **Doc debt** | Stale docs, missing API docs, drift from code |
43
- | **Security debt** | Known vulnerabilities, weak auth, missing validation |
44
- | **Operational debt** | Manual deploys, missing runbooks, paper SLOs |
45
- | **Knowledge debt** | Tribal knowledge with no docs, single point of failure people |
39
+ ## Operating principles (non-negotiable)
40
+
41
+ 1. **Evidence over assertion.** No claim without a concrete `file:line`. Apply
42
+ the substitution test to every finding: if the same sentence would read true
43
+ for a different repo, it is filler. "Error handling is weak" fails;
44
+ "`api/users.ts:88` returns 200 on a validation failure so callers cannot
45
+ detect bad input" passes.
46
+ 2. **Verify against reality.** Read the code, not the names, comments, or docs.
47
+ When a doc or comment claims one thing and the code does another, that gap is
48
+ itself a finding.
49
+ 3. **Refuse theater. Hunt paper constructs.** The most dangerous defects look
50
+ robust but carry no weight: a try/catch that swallows the error, a validator
51
+ defined but never called, middleware registered but not applied to the routes
52
+ it should guard, a test that asserts nothing, a health check that returns 200
53
+ without checking a dependency, a rate limiter that does not limit. Flag
54
+ anything that exists for appearance but does not do its job.
55
+ 4. **Find the root, not the leaves.** If one mistake appears in twelve places,
56
+ that is one systemic finding, not twelve. Cluster instances; name the cause.
57
+ 5. **Verify adversarially.** For every candidate finding, try to refute it
58
+ before keeping it (is there a guard, a test, a deliberate trade-off?). If you
59
+ cannot confirm by reading, mark it Suspected so the acting agent re-checks.
60
+ 6. **Calibrate to the project.** Grade against the project's evident ambition
61
+ and maturity, not an absolute ideal. State your calibration.
62
+ 7. **Name the strengths.** Record what the codebase does well, with evidence,
63
+ so remediation does not refactor those away.
64
+
65
+ ## Dimensions (score each 0-100, weighted)
66
+
67
+ The debt categories map onto nine scored dimensions. Score each against its
68
+ findings, with a one-line justification. No number without a reason.
69
+
70
+ | Dimension | Weight | Covers (debt categories) |
71
+ |---|---|---|
72
+ | Security | 20% | security debt: authn/authz, injection, secrets, crypto, exposure, paper trust boundaries, LLM/tool surfaces |
73
+ | Architecture and Design | 15% | design debt: boundaries, coupling, cohesion, abstraction fit, drift |
74
+ | Code Quality and Maintainability | 15% | code debt: complexity, size, duplication, naming, dead code, magic values, TODO/FIXME/HACK markers, type-safety escape hatches |
75
+ | Testing and Verification | 15% | test debt: critical-path coverage, assertion quality, determinism, tests that never run |
76
+ | Error Handling and Resilience | 10% | swallowed errors, lost context, I/O timeouts/retries, transactional integrity, resource cleanup |
77
+ | Performance and Efficiency | 8% | algorithmic hot paths, N+1, caching, blocking work, memory (mark Suspected without a profiler) |
78
+ | Dependencies and Supply Chain | 7% | dependency debt: CVEs, staleness, deprecated APIs, bloat, pinning, licensing |
79
+ | Documentation and Drift | 5% | doc debt: README/API accuracy, phantom/missing docs, stale comments |
80
+ | Observability and Operability | 5% | operational debt: logging, metrics/tracing, paper health checks, config/secrets, deployability |
81
+
82
+ Carry Godpowers' extra lenses where they apply: **operational debt** (manual
83
+ deploys, missing runbooks, paper SLOs) folds into Observability; **knowledge
84
+ debt** (tribal knowledge, single-points-of-failure people) is reported as a
85
+ systemic note.
86
+
87
+ ### Lane discipline (do not re-derive what another auditor owns)
88
+
89
+ This audit is the **point-in-time, whole-repo** read. Two dimensions overlap
90
+ other auditors; defer to them rather than duplicate their work:
91
+
92
+ - **Security** is owned by `god-harden-auditor` (the gating OWASP walkthrough at
93
+ `.godpowers/harden/FINDINGS.md`). When that file exists, score the Security
94
+ dimension from its verdict and **cite its finding IDs** (for example
95
+ "Security 72 - see harden CRITICAL-001/002") instead of re-running the
96
+ walkthrough. Record a Security finding here only for something harden did not
97
+ cover, and tag it for harden to re-check. If FINDINGS.md is absent, do a
98
+ lightweight security read and say so plainly - it is not a substitute for
99
+ `/god-harden`.
100
+ - **Code Quality** at the *diff* level is owned by `god-quality-reviewer` during
101
+ build. This dimension is the *whole-codebase* health read: report systemic
102
+ quality debt, not a line-by-line review of recent changes, and point to the
103
+ reviewer for per-slice concerns.
104
+
105
+ Bands: 90-100 A, 80-89 B, 70-79 C, 60-69 D, 0-59 F. Risk does not average away:
106
+ one Confirmed Critical caps its dimension at 69 and the overall at 79 until
107
+ resolved.
46
108
 
47
109
  ## Process
48
110
 
49
- ### 1. Inventory
50
-
51
- Walk the codebase looking for indicators per category:
52
- - Code: grep TODO/FIXME/HACK; cyclomatic complexity; duplicate code; long functions
53
- - Design: god classes; circular dependencies; mixed concerns
54
- - Dependency: `npm audit` / equivalent; date of last update; deprecation warnings
55
- - Test: coverage report; tests marked .skip; flaky test history; CI duration
56
- - Doc: comments referencing old code; README age; broken links
57
- - Security: SAST findings; missing input validation; hardcoded secrets
58
- - Operational: manual steps in deploy; runbooks not updated; alerts without runbooks
59
- - Knowledge: single contributors to critical code; no comments on complex algorithms
60
-
61
- ### 2. Estimate cost to fix
62
-
63
- Per debt item, classify:
64
- - **S (small)**: <1 day, no behavior change
65
- - **M (medium)**: 1-3 days, possibly small behavior change
66
- - **L (large)**: 1-2 weeks, requires planning
67
- - **XL**: weeks-months, requires migration
68
-
69
- ### 3. Estimate impact of NOT fixing
70
-
71
- Per item:
72
- - **HIGH**: blocks a planned feature, security risk, customer pain
73
- - **MEDIUM**: slows team, occasional bugs, maintenance burden
74
- - **LOW**: cosmetic, no observable impact
75
-
76
- ### 4. Prioritize
77
-
78
- Priority = Impact × (1 / Cost). High-impact + small cost = top of list.
79
-
80
- | Priority | Definition |
81
- |----------|-----------|
82
- | **P0** | High impact + S/M cost. Do this sprint. |
83
- | **P1** | High impact + L cost OR Medium impact + S cost. Do this quarter. |
84
- | **P2** | Medium impact + M cost. Do when convenient. |
85
- | **P3** | Low impact OR XL cost without clear benefit. Backlog or ignore. |
111
+ ### 1. Orient and map
112
+ Detect languages/frameworks/build system from manifests; measure size and decide
113
+ exhaustive vs sampled (declare which). Locate entry points. Read the README to
114
+ learn intended behavior and maturity. Trace two or three primary flows end to
115
+ end. Record exclusions (vendored, generated, build output) and the commit/branch.
116
+
117
+ ### 2. Inventory across every dimension
118
+ Use search to find candidates, then **read the cited code to confirm** before
119
+ recording. A search hit is a lead, not a finding. Per dimension's indicators:
120
+ - Code: grep TODO/FIXME/HACK; complexity; duplication; long functions; dead code
121
+ - Design: god files; circular deps; mixed concerns; structure-vs-docs drift
122
+ - Security: read `.godpowers/harden/FINDINGS.md` first and cite it; only if it
123
+ is absent, do a lightweight read for untrusted input into queries/shell/paths/
124
+ HTML, secrets, weak crypto, and declared-but-unenforced guards
125
+ - Test: critical-path coverage; assertion-free or over-mocked tests; `.skip`
126
+ - Dependency: `npm audit` / equivalent; staleness; deprecations; pinning
127
+ - Error handling: empty catches; lost cause; missing timeouts; partial commits
128
+ - Performance: nested loops on large inputs; N+1; sync I/O on hot paths
129
+ - Docs: setup steps vs scripts; documented endpoints that do not exist
130
+ - Observability: structured logging; real vs paper health checks; config/secrets
131
+
132
+ ### 3. Verify adversarially and cluster
133
+ Try to refute each candidate. Assign **Severity** (Critical/High/Medium/Low),
134
+ **Confidence** (Confirmed/Likely/Suspected), and **Effort** (S under 1 day /
135
+ M 1-3 days / L 1-2 weeks / XL weeks). Cluster repeated instances into one
136
+ systemic finding, keeping the member IDs.
137
+
138
+ ### 4. Score and prioritize
139
+ Score each dimension 0-100 with its justification; the overall is the weighted
140
+ average with risk-capping. Bucket findings: **Quick wins** (High/Critical,
141
+ Confirmed, S), **Plan now** (High/Critical, M or L), **Verify first** (any
142
+ Suspected), **Backlog** (Low). Map to P0-P3: P0 = High impact + S/M; P1 = High
143
+ impact + L or Medium + S; P2 = Medium + M; P3 = Low or XL without clear benefit.
86
144
 
87
145
  ### 5. Output
88
146
 
89
- Write `.godpowers/tech-debt/REPORT.md`:
147
+ Write `.godpowers/tech-debt/REPORT.md`, self-contained for an acting agent with
148
+ no memory of the audit:
90
149
 
91
150
  ```markdown
92
- # Tech Debt Assessment
93
-
94
- Date: [ISO 8601]
95
- Scope: [path or "entire codebase"]
96
-
97
- ## Summary
98
-
99
- | Category | P0 | P1 | P2 | P3 | Total |
100
- |----------|----|----|----|----|-------|
101
- | Code | 3 | 5 | 12 | 8 | 28 |
102
- | Design | 1 | 2 | 4 | 1 | 8 |
103
- | Dependency | 0 | 1 | 3 | 7 | 11 |
104
- | ... | | | | | |
105
-
106
- Estimated debt: [N] person-weeks total
107
- P0+P1 paydown: [N] weeks (recommended next 1-2 sprints)
108
-
109
- ## P0 - Do this sprint
110
-
111
- | ID | Category | Description | Cost | Impact | Recommendation |
112
- |----|----------|-------------|------|--------|----------------|
113
- | D-001 | Security | SQL injection in /api/search | S | HIGH | Fix immediately; route to /god-hotfix |
114
- | D-002 | Test | Auth module has 0% coverage | M | HIGH | Add tests via /god-add-tests before any auth changes |
115
- | D-003 | Operational | Deploy script has manual step | S | MEDIUM | Automate; route to /god-deploy revisit |
116
-
117
- ## P1 - Do this quarter
118
-
119
- [Same structure]
120
-
121
- ## P2 - When convenient
122
-
123
- [Same structure]
124
-
125
- ## P3 - Backlog or ignore
126
-
127
- [Same structure; explanation if "ignore"]
128
-
129
- ## Recommended next steps
130
-
131
- 1. [Specific action with command, e.g., /god-hotfix for D-001]
132
- 2. [Specific action]
151
+ # Code Audit and Tech Debt Assessment
152
+
153
+ Date: [ISO 8601] | Scope: [path or "entire codebase"] | State: [commit/branch]
154
+ Read-only audit. Self-contained: every finding cites file:line and how to verify.
155
+
156
+ ## Snapshot
157
+ Languages, size, frameworks, entry points, evident maturity, coverage
158
+ (exhaustive or sampled, say what was sampled), exclusions.
159
+
160
+ ## Overall score
161
+ NN/100 - Grade X (label). Two-to-four sentence verdict. One-line calibration.
162
+
163
+ | Dimension | Score | Grade | Weight | Verdict |
164
+ |---|---|---|---|---|
165
+ | Security | NN | X | 20% | one-line specific verdict |
166
+ | ... | | | | |
167
+ | Overall | NN | X | 100% | weighted |
168
+
169
+ ## What to fix first
170
+ Ordered union of Quick wins + Plan now, Critical before High.
171
+ `[ID] title - severity, effort - one-line why`
172
+
173
+ ## Strengths (preserve these)
174
+ What the codebase does well, each with evidence. Do not refactor these away.
175
+
176
+ ## Systemic patterns (root causes)
177
+ One entry per recurring cause: what it is, member IDs, the one root fix.
178
+
179
+ ## Findings
180
+ Sorted by severity then dimension. Each finding:
181
+
182
+ ### [SEC-001] <title>
183
+ - Severity: <C/H/M/L> | Confidence: <Confirmed/Likely/Suspected> | Effort: <S/M/L/XL> | Dimension: <name>
184
+ - Location: `file:line` (+ others)
185
+ - Evidence: <what the code does now, precisely>
186
+ - Impact: <concrete consequence>
187
+ - Recommendation: <specific change and where; not a platitude>
188
+ - Verify the fix: <test to add / behavior to check / command to run>
189
+ - Related: <systemic pattern or finding IDs, or "none">
190
+
191
+ ## Remediation plan
192
+ Quick wins / Plan now (suggested order) / Verify first / Backlog, by ID. Map to
193
+ P0-P3. For each P0/P1, name the Godpowers command (for example /god-hotfix,
194
+ /god-debug, /god-add-tests, /god-update-deps).
195
+
196
+ ## Scope and limitations
197
+ What was and was not examined; sampling; assumptions that would change conclusions.
198
+
199
+ ## How to use this report (for the acting agent)
200
+ 1. Triage by severity and confidence. Confirmed Critical/High are safe to act on
201
+ now, in "What to fix first" order. Re-verify any Suspected finding first.
202
+ 2. Fix root causes (systemic patterns) before individual leaves.
203
+ 3. Preserve the strengths; do not refactor them away.
204
+ 4. One finding, one change, verified: run its "Verify the fix" after each fix;
205
+ keep changes atomic and traceable to the finding ID.
206
+ 5. Do not widen scope silently. Re-run the audit to confirm findings are
207
+ resolved, not relocated, and that no strength regressed.
133
208
  ```
134
209
 
210
+ ID prefixes by dimension: SEC, ARC, QUAL, TEST, ERR, PERF, DEP, DOC, OBS. Keep
211
+ IDs stable so a remediation loop can track each finding to closure.
212
+
135
213
  ## Have-Nots
136
214
 
137
215
  Debt assessment FAILS if:
138
- - All items in one priority bucket (no real prioritization)
139
- - Cost estimates without rationale
140
- - Impact estimates without specific consequences ("makes code messy" is not impact)
141
- - Recommendations without specific commands or workflows
142
- - "Comprehensive coverage" claim without grep evidence
143
- - Misses obvious categories (security debt with known CVEs)
216
+ - A dimension score has no justification tied to specific findings
217
+ - Any finding lacks a `file:line`, or a Severity/Confidence/Effort
218
+ - A recommendation is a platitude ("improve error handling", "add more tests")
219
+ - Repeated issues are left loose instead of clustered into a systemic pattern
220
+ - The Strengths section is missing
221
+ - "Comprehensive coverage" is claimed without grep evidence or a stated sample
222
+ - A Critical finding does not cap its dimension and the overall score
223
+ - Obvious categories are missed (security debt with known CVEs)
package/bin/install.js CHANGED
@@ -53,6 +53,15 @@ function showHelp() {
53
53
  log(' next Show the dashboard and recommended next command');
54
54
  log(' state advance Update one tracked Godpowers state step');
55
55
  log(' gate Check a tier artifact gate');
56
+ log(' verify Run a command as executed verification evidence');
57
+ log(' can-close Check whether a substep has the evidence to close');
58
+ log(' route Classify a prompt into an entry play (quarterback)');
59
+ log(' report Show the verification play-by-play since last report');
60
+ log(' reflect Record a structured reflection to the ledger');
61
+ log(' memory Set, get, list, or clear ledger memory entries');
62
+ log(' lesson Add or list reusable lessons in the ledger');
63
+ log(' outcome Start, check, stop, or inspect a bounded retry loop');
64
+ log(' import-ledger Import an existing .mythify/ ledger into .godpowers/ledger/');
56
65
  log(' mcp-info Show read-only MCP companion setup instructions');
57
66
  log(' quick-proof Show a runnable proof from the shipped fixture');
58
67
  log(' automation-status Show host automation provider support');
@@ -72,6 +81,13 @@ function showHelp() {
72
81
  log(' --step=<name> Step for state advance, such as prd or tier-1.prd');
73
82
  log(' --status=<status> Status for state advance');
74
83
  log(' --tier=<name> Tier for gate: prd, design, arch, roadmap, stack, repo, build, or harden');
84
+ log(' --substep=<id> Substep for verify, such as tier-2.build');
85
+ log(' --claim=<text> Claim a verify command checks');
86
+ log(' --timeout=<seconds> Kill a verify command after this many seconds (default 300)');
87
+ log(' --attest Record a self-reported attested claim instead of executing');
88
+ log(' --evidence=<text> Self-reported evidence for verify --attest');
89
+ log(' --since=<last|all> Window for report: new records since last, or all');
90
+ log(' --peek Show the report without advancing the report cursor');
75
91
  log(' --json Emit JSON for status, next, proof, or automation commands');
76
92
  log(' --brief Render compact output for status, next, or proof');
77
93
  log(' --full Render complete output for status, next, or demo');
@@ -111,6 +127,15 @@ function showHelp() {
111
127
  log(' npx godpowers next --project=.');
112
128
  log(' npx godpowers state advance --step=prd --status=done --project=.');
113
129
  log(' npx godpowers gate --tier=prd --project=.');
130
+ log(' npx godpowers verify "npm test" --substep tier-2.build --claim "build slice tests pass" --project=.');
131
+ log(' npx godpowers can-close --substep tier-2.build --project=.');
132
+ log(' npx godpowers route "add a feature" --project=.');
133
+ log(' npx godpowers report --since last --project=.');
134
+ log(' npx godpowers reflect --action "ran build" --outcome failure --next "fix the failing test" --project=.');
135
+ log(' npx godpowers memory set decision "use postgres" --category decision --project=.');
136
+ log(' npx godpowers lesson add "guard inputs before parsing" --tags parsing --project=.');
137
+ log(' npx godpowers outcome start green-build --verify "npm test" --budget 3 --substep tier-2.build --project=.');
138
+ log(' npx godpowers import-ledger --from ../legacy/.mythify --project=.');
114
139
  log(' npx godpowers mcp-info --project=.');
115
140
  log(' npx godpowers quick-proof --project=.');
116
141
  log(' npx godpowers automation-status --project=.');
@@ -231,6 +256,15 @@ module.exports = {
231
256
  runExtensionScaffoldCommand: cliDispatch.runExtensionScaffoldCommand,
232
257
  runGateCommand: cliDispatch.runGateCommand,
233
258
  runStateCommand: cliDispatch.runStateCommand,
259
+ runVerifyCommand: cliDispatch.runVerifyCommand,
260
+ runCanCloseCommand: cliDispatch.runCanCloseCommand,
261
+ runRouteCommand: cliDispatch.runRouteCommand,
262
+ runReportCommand: cliDispatch.runReportCommand,
263
+ runReflectCommand: cliDispatch.runReflectCommand,
264
+ runMemoryCommand: cliDispatch.runMemoryCommand,
265
+ runLessonCommand: cliDispatch.runLessonCommand,
266
+ runOutcomeCommand: cliDispatch.runOutcomeCommand,
267
+ runImportLedgerCommand: cliDispatch.runImportLedgerCommand,
234
268
  applyDefaultRuntimeSelection,
235
269
  runInstall,
236
270
  runUninstall,
@@ -0,0 +1,26 @@
1
+ {
2
+ "$schema": "https://godpowers.dev/schema/state.v1.json",
3
+ "version": "1.0.0",
4
+ "project": {
5
+ "name": "harden-pass",
6
+ "started": "2026-06-10T00:00:00.000Z"
7
+ },
8
+ "tiers": {
9
+ "tier-3": {
10
+ "harden": {
11
+ "status": "done",
12
+ "updated": "2026-06-10T18:08:00.000Z",
13
+ "verification": {
14
+ "commands": [
15
+ {
16
+ "command": "npm audit --omit=dev",
17
+ "status": "pass",
18
+ "exitCode": 0,
19
+ "ranAt": "2026-06-10T18:07:00.000Z"
20
+ }
21
+ ]
22
+ }
23
+ }
24
+ }
25
+ }
26
+ }
@@ -33,7 +33,8 @@ const TIER_ARTIFACTS = {
33
33
 
34
34
  const TIER_STATE_STEPS = {
35
35
  design: { tierKey: 'tier-1', subStepKey: 'design' },
36
- build: { tierKey: 'tier-2', subStepKey: 'build' }
36
+ build: { tierKey: 'tier-2', subStepKey: 'build' },
37
+ harden: { tierKey: 'tier-3', subStepKey: 'harden' }
37
38
  };
38
39
 
39
40
  function normalizeTier(tier) {