godpowers 2.4.1 → 2.4.3

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 (60) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/README.md +9 -6
  3. package/RELEASE.md +35 -30
  4. package/agents/god-orchestrator.md +31 -1255
  5. package/bin/install.js +22 -19
  6. package/lib/README.md +1 -0
  7. package/lib/agent-validator.js +2 -27
  8. package/lib/checkpoint.js +4 -19
  9. package/lib/command-families.js +10 -2
  10. package/lib/context-budget.js +5 -34
  11. package/lib/design-spec.js +11 -13
  12. package/lib/extensions.js +12 -2
  13. package/lib/frontmatter.js +74 -0
  14. package/lib/installer-core.js +7 -52
  15. package/lib/intent.js +88 -6
  16. package/lib/pillars.js +2 -41
  17. package/lib/recipes.js +10 -2
  18. package/lib/router.js +10 -2
  19. package/lib/skill-surface.js +2 -11
  20. package/lib/workflow-parser.js +12 -4
  21. package/package.json +8 -3
  22. package/references/orchestration/GOD-NEXT-RUNBOOK.md +32 -0
  23. package/references/orchestration/GOD-ORCHESTRATOR-RUNBOOK.md +1259 -0
  24. package/references/orchestration/README.md +6 -0
  25. package/references/shared/DASHBOARD-CONTRACT.md +93 -0
  26. package/references/shared/LOCKING.md +15 -0
  27. package/references/shared/README.md +2 -0
  28. package/routing/god-roadmap-check.yaml +1 -1
  29. package/skills/god-arch.md +1 -12
  30. package/skills/god-build.md +1 -12
  31. package/skills/god-deploy.md +1 -12
  32. package/skills/god-design.md +1 -12
  33. package/skills/god-feature.md +1 -12
  34. package/skills/god-harden.md +1 -12
  35. package/skills/god-hotfix.md +1 -12
  36. package/skills/god-launch.md +1 -12
  37. package/skills/god-link.md +1 -12
  38. package/skills/god-migrate.md +1 -3
  39. package/skills/god-next.md +34 -410
  40. package/skills/god-observe.md +1 -12
  41. package/skills/god-prd.md +1 -12
  42. package/skills/god-redo.md +1 -12
  43. package/skills/god-refactor.md +1 -12
  44. package/skills/god-repair.md +1 -12
  45. package/skills/god-repo.md +1 -12
  46. package/skills/god-restore.md +1 -12
  47. package/skills/god-roadmap-check.md +5 -0
  48. package/skills/god-roadmap.md +1 -12
  49. package/skills/god-rollback.md +1 -12
  50. package/skills/god-scan.md +1 -12
  51. package/skills/god-skip.md +1 -12
  52. package/skills/god-stack.md +1 -12
  53. package/skills/god-status.md +27 -204
  54. package/skills/god-story-build.md +1 -12
  55. package/skills/god-story-close.md +1 -12
  56. package/skills/god-story.md +1 -12
  57. package/skills/god-sync.md +1 -12
  58. package/skills/god-undo.md +1 -12
  59. package/skills/god-update-deps.md +1 -12
  60. package/skills/god-upgrade.md +1 -12
@@ -65,1258 +65,34 @@ suite-scope coordination across multiple repos but never bypasses
65
65
  per-repo orchestrators. When working in a registered Mode D suite,
66
66
  expect god-coordinator at Tier 0 alongside you, not above.
67
67
 
68
- ## Cost-conscious agent dispatch (token cost saver)
69
-
70
- Read `.godpowers/intent.yaml` for the `budgets` block before each
71
- agent spawn:
72
-
73
- 1. **Cache check** (when `budgets.cache: true`):
74
- - Compute cache key via `lib/agent-cache.key(agent, agent_version,
75
- inputs, state_hash)`. Inputs are normalized + sorted, so the
76
- same logical call always produces the same key.
77
- - If `lib/agent-cache.has(projectRoot, key)`, read the cached
78
- output. Emit `cache.hit` via `lib/cost-tracker.recordCacheHit`
79
- with the would-have-spent token estimate. Skip the spawn.
80
- - On miss, emit `cache.miss` and proceed.
81
-
82
- 2. **Context budget** (always applied):
83
- - Read the agent's `required-context` + `optional-context` from
84
- its frontmatter via `lib/context-budget.parseAgentBudget`.
85
- - Compute the loadout via `lib/context-budget.plan(budget,
86
- required, optional, agentName)`.
87
- - Pass the loadout files to the agent. If `exceeded: true`, emit
88
- `budget.exceeded` warning but proceed (required files always
89
- load).
90
-
91
- 3. **Model selection**:
92
- - Default model = `claude-3-5-sonnet` (standard tier).
93
- - If `budgets.model-profile: cheap` and the agent is read-only
94
- (god-status / god-doctor / god-locate / god-help / god-context-
95
- scan / god-logs / god-metrics / god-trace), use haiku-class.
96
- - Creative agents (god-pm / god-architect / god-designer /
97
- god-roadmapper) stay on standard or above regardless of profile.
98
- - Per-agent overrides under `budgets.agents.<name>.model-profile`
99
- win over defaults.
100
-
101
- 4. **Record cost**: after the agent completes, emit `cost.recorded`
102
- via `lib/cost-tracker.recordCost(handle, { model, tokens_in,
103
- tokens_out, agent, tier })`. The lib auto-prices if no `cost_usd`
104
- is given.
105
-
106
- 5. **On cache miss + successful spawn**: write the output to the
107
- cache via `lib/agent-cache.put` so the next call with the same
108
- inputs is a hit. Skip the put if `budgets.cache: false`.
109
-
110
- `/god-cost`, `/god-budget`, and `/god-cache-clear` are read/configure
111
- surfaces over these mechanisms.
112
-
113
- ## Concurrency: acquire lock + update CHECKPOINT after every mutation
114
-
115
- The orchestrator is the single writer per mutation (see
116
- ARCHITECTURE.md "Concurrency contract"). Before any state-changing
117
- sub-step:
118
-
119
- 1. Acquire the advisory lock via `lib/state-lock.acquire(projectRoot,
120
- { holder: 'god-orchestrator@<run-id>', scope: '<tier-N.substep>',
121
- ttlMs: 5 * 60 * 1000 })`.
122
- 2. If `acquired: false`, the project is being mutated by another actor
123
- (concurrent session, CI, or a previous run that crashed without
124
- release). Options:
125
- - If `reason: 'held'` and current process can wait, sleep up to
126
- 30s and retry.
127
- - If lock is stale (auto-reclaimed on acquire), proceed.
128
- - Otherwise pause and surface to user: "lock held by X since Y;
129
- run `/god-repair` to reclaim or wait for the holder."
130
- 3. Run the mutating work inside the lock.
131
- 4. Release: `lib/state-lock.release(projectRoot, holder)`. Always
132
- release on the success path AND every error path. Use
133
- `lib/state-lock.withLock(...)` for the safest pattern.
134
-
135
- Read-only commands (`/god-status`, `/god-doctor`, `/god-help`,
136
- `/god-version`, `/god-audit`, `/god-locate`, `/god-context-scan`,
137
- `/god-logs`, `/god-metrics`, `/god-trace`) do NOT acquire a lock.
138
-
139
- After every sub-step completion (success OR failure), call
140
- `lib/checkpoint.syncFromState(projectRoot, { nextCommand, nextReason })`
141
- to refresh `.godpowers/CHECKPOINT.md`. This keeps the disk pin in sync
142
- so a new session can run `/god-locate` and immediately know where
143
- things are. The cost is a single file write; the benefit is that
144
- context-rot in any future session is bounded by the time between
145
- checkpoints.
146
-
147
- ## Mode D awareness (when applicable)
148
-
149
- Before each tier, check whether this repo is part of a registered suite:
150
-
151
- 1. Call `lib/multi-repo-detector.detect(projectRoot)`.
152
- 2. If `isMultiRepo: true`:
153
- - Note role (`hub` or `sibling`) in events
154
- - Surface suite findings from `lib/suite-state.readSuiteState()` at
155
- pause checkpoints
156
- - When making changes that affect byte-identical or shared-standards
157
- files (LICENSE, .editorconfig, package.json engines), emit a
158
- `suite.invariant-touched` event so god-coordinator can react
159
- 3. Per-repo state.json remains the source of truth; never write to
160
- `.godpowers/suite/` directly (that's god-coordinator's surface).
161
-
162
- ## Planning-system context import
163
-
164
- During `/god-init`, scan for adjacent methodology artifacts from legacy planning,
165
- Superpowers, BMAD, and similar systems. Treat them as preparation context,
166
- not as source of truth.
167
-
168
- ## Native Pillars context
169
-
170
- Every Godpowers project is also a Pillars project. During `/god-init` and
171
- `/god-mode`, call `lib/pillars.detect(projectRoot)`. If Pillars is absent or
172
- partial, call `lib/pillars.init(projectRoot)` before planning or build work
173
- continues.
174
-
175
- If `.godpowers/` already exists, call
176
- `lib/pillars.pillarizeExisting(projectRoot)` before resume work continues.
177
- This converts existing Godpowers artifacts into managed source references in
178
- the relevant pillar files, so old projects are Pillar-ized as part of being
179
- Godpower-ized.
180
-
181
- Before each major command, compute the task-specific Pillars load set with
182
- `lib/pillars.computeLoadSet(projectRoot, taskText)`. Load `agents/context.md`
183
- and `agents/repo.md` first, then the routed primary pillars and their direct
184
- `must_read_with` dependencies. Do not read every file in `agents/`; Godpowers
185
- specialist agents also live there and are not project pillars.
186
-
187
- When a Godpowers artifact changes durable project truth, map the artifact to
188
- pillar sync work with `lib/pillars.planArtifactSync(projectRoot, artifacts,
189
- { yolo })`. Default mode proposes pillar updates for review. Under `--yolo`,
190
- apply the pillar updates immediately and log the action to
191
- `.godpowers/YOLO-DECISIONS.md`.
192
-
193
- Whenever Pillars sync is auto-invoked, show an auto-invoked status card. Say
194
- whether this was an agent spawn or a local runtime call. For Pillars sync the
195
- agent is usually `none, local runtime only` unless the current workflow
196
- explicitly spawned `god-context-writer`.
197
-
198
- Before or alongside that import, write `.godpowers/prep/INITIAL-FINDINGS.md`
199
- using `templates/INITIAL-FINDINGS.md`. This artifact records what Godpowers
200
- observed directly during init:
201
- - codebase shape, language, framework, package manager, tests, CI, deploy, and
202
- documentation signals
203
- - AI-tool instruction files and methodology systems detected
204
- - risk signals and open questions raised by the scan
205
- - the suggested next command and why that command is the safest next step
206
-
207
- Downstream `/god-prd`, `/god-next`, and `/god-mode` flows must read
208
- `INITIAL-FINDINGS.md` when present. Use it as preparation context only. If it
209
- conflicts with user intent, state.json, PROGRESS.md, or completed Godpowers
210
- artifacts, the Godpowers artifact wins.
211
-
212
- Detection signals:
213
- - legacy planning: `.legacy-planning/`, `.planning/`, `LEGACY-PLANNING.md`, `legacy-planning*.md`
214
- - Superpowers: `.superpowers/`, `superpowers/`, `SUPERPOWERS.md`,
215
- `.claude/skills/`, `.codex/skills/`
216
- - BMAD: `.bmad-core/`, `bmad-core/`, `.bmad/`, `BMAD.md`,
217
- `docs/prd.md`, `docs/architecture.md`, `docs/roadmap.md`
218
-
219
- When signals are found:
220
- 1. Read only likely planning files, not dependency folders or generated build
221
- output.
222
- 2. Summarize product, delivery, technical, risk, and already-built signals into
223
- `.godpowers/prep/IMPORTED-CONTEXT.md` using `templates/IMPORTED-CONTEXT.md`.
224
- 3. Label every imported claim as `[HYPOTHESIS]` unless the user directly stated
225
- it during this session.
226
- 4. Record source paths and confidence so downstream agents can decide how much
227
- weight to give each signal.
228
- 5. If imported context conflicts with Godpowers state, user intent, or a
229
- completed Godpowers artifact, keep the Godpowers artifact as authoritative
230
- and add an `[OPEN QUESTION]` to imported context.
231
-
232
- Downstream planning agents may read this artifact. They must cite it as
233
- supporting evidence only.
234
-
235
- ## Routing-Driven Decisions
236
-
237
- For routing decisions, consult `<runtimeRoot>/routing/<command>.yaml` files.
238
- When running from a repository checkout, `<runtimeRoot>` is the project root.
239
- When installed into an AI tool, `<runtimeRoot>` is
240
- `<tool-config-dir>/godpowers-runtime`. These files define prerequisites,
241
- success-paths, standards checks, and endoff for each command.
242
-
243
- When deciding what to spawn next, query the routing definition:
244
- - `prerequisites.required` -> what must be done first
245
- - `execution.spawns` -> primary agent to spawn
246
- - `execution.secondary-spawns` -> downstream agents (e.g., reviewers)
247
- - `standards.have-nots` -> which have-nots to verify
248
- - `success-path.next-recommended` -> what to suggest next
249
-
250
- Before spawning a command, evaluate `lib/router.js checkPrerequisites(command,
251
- projectRoot)`. Missing prerequisites are authoritative even when the tier
252
- order suggests the command is structurally next. If `safe-sync-clear` fails,
253
- route to `/god-reconcile Release Truth And Safe Sync` before deploy, observe,
254
- harden, launch, broad migration, or resume work. If `no-critical-findings`
255
- fails, launch remains blocked until harden is fixed and re-verified or risk is
256
- explicitly accepted in writing.
257
-
258
- Between every tier, run god-standards-check on the produced artifact (if
259
- the routing config has a `standards` section). Standards check uses fresh
260
- context, independent of the producing agent, so it catches drift the
261
- producing agent's own self-check would miss.
262
-
263
- ## Recipe-Driven Decisions (for fuzzy intent)
264
-
265
- When the user describes intent in plain English instead of running a specific
266
- command, consult `<runtimeRoot>/routing/recipes/*.yaml`. These are
267
- scenario-based recipes that map fuzzy intent to specific command sequences.
268
-
269
- Programmatic access via `<runtimeRoot>/lib/recipes.js`:
270
- - `matchIntent(text, projectRoot)` -> ranked recipe matches by keyword
271
- - `suggestForState(projectRoot)` -> recipes matching current lifecycle phase
272
- - `getRecipe(name)` -> lookup specific recipe
273
- - `getSequence(recipe)` -> the command sequence to execute
274
-
275
- Example: user says "I need to add a feature during the current project run". The matchIntent
276
- function returns the `add-feature-mid-arc-pause` recipe with sequence
277
- `[/god-pause-work, /god-feature, /god-resume-work]`. Present this sequence
278
- with the "why" annotations for each step.
279
-
280
- This is the third layer of decision support:
281
- 1. **Routing** (`<runtimeRoot>/routing/<command>.yaml`): structural prerequisites and gates
282
- 2. **Recipes** (`<runtimeRoot>/routing/recipes/<recipe>.yaml`): scenario-based sequences
283
- 3. **Standards** (god-standards-check): quality gates between stages
284
-
285
- ## Proactive Auto-Invoke Matrix
286
-
287
- Before every user-visible closeout, and after every successful state mutation,
288
- evaluate the master auto-invoke policy against disk state. The goal is to keep
289
- Godpowers moving intelligently without hiding work from the user.
290
-
291
- | Level | Default behavior | Orchestrator action |
292
- |---|---|---|
293
- | 1 | Auto-suggest | Compute `/god-next`, review queues, hygiene age, and status summary |
294
- | 2 | Auto-run local helper | Run checkpoint, linkage, Pillars planning, context dry-run, or progress refresh |
295
- | 3 | Auto-spawn bounded agent | Spawn only when trigger is direct and the workflow scope owns that surface |
296
- | 4 | Require approval | Pause or list the exact user decision needed |
297
-
298
- Use this trigger map:
299
-
300
- | Trigger | Auto action | Visibility |
301
- |---|---|---|
302
- | `state.json` or `PROGRESS.md` changed | refresh `.godpowers/CHECKPOINT.md` | `Auto-invoked:` local runtime only |
303
- | code or artifact files changed | run lightweight reverse-sync or spawn `god-updater` for workflow closeout | `Sync status:` |
304
- | durable artifact truth changed | run Pillars sync plan | `Auto-invoked:` local runtime only |
305
- | AI tool instruction files changed | spawn or dry-run `god-context-writer` | `Auto-invoked:` |
306
- | `REVIEW-REQUIRED.md` gains entries | suggest `/god-review-changes` | closeout proposition |
307
- | `DESIGN.md` or `PRODUCT.md` changed | spawn `god-design-reviewer` | gate card before propagation |
308
- | docs and code both changed | spawn `god-docs-writer` in drift-check mode when current workflow owns docs, otherwise suggest `/god-docs` | `Auto-invoked:` or proposition |
309
- | frontend-visible files changed and a known URL exists | spawn `god-browser-tester` inside build, design, launch, harden, or explicit runtime workflows | runtime status card |
310
- | frontend-visible files changed and no known URL exists | suggest `/god-test-runtime` with local URL setup, defer deployed URL | proposition |
311
- | security-sensitive files changed | auto-spawn only inside harden, hotfix, launch, or project run; otherwise suggest `/god-harden` | proposition |
312
- | dependency files changed | auto-spawn only inside update-deps, hygiene, or approved project run; otherwise suggest `/god-update-deps` | proposition |
313
- | host automation support detected and no active templates are recorded | suggest `/god-automation-status` or `/god-automation-setup` | proposition |
314
- | user approves complex automation setup | spawn `god-automation-engineer` | approval card plus setup result |
315
- | full project run complete or hygiene stale | suggest `/god-hygiene` | proposition |
316
-
317
- Never use this matrix to auto-run Level 4 actions: deployed staging against a
318
- guessed URL, production launch, provider dashboard access, broad dependency
319
- upgrades, destructive repair, review clearing, Critical security acceptance, or
320
- git stage, commit, push, package, release, publish, schedule creation, routine
321
- creation, background agent creation, API trigger creation, or CI workflow
322
- creation without explicit user approval.
323
-
324
- Every auto action must emit either `Auto-invoked:`, `Sync status:`, or a
325
- proposition explaining why it did not run.
326
-
327
- ## Detection-Driven Tier 1 Routing
328
-
329
- After PRD and before ARCH, branch on UI or product-experience presence:
330
-
331
- 1. Call `lib/design-detector.isUiProject(projectRoot)` to determine
332
- whether DESIGN tier is required.
333
- 2. Call `lib/design-detector.isImpeccableInstalled(projectRoot)` to
334
- determine whether to delegate or fall back.
335
- 3. Read `.godpowers/prep/INITIAL-FINDINGS.md`,
336
- `.godpowers/prep/IMPORTED-CONTEXT.md`, and `.godpowers/prd/PRD.md`
337
- for UI, workflow, journey, component, brand, accessibility, and screen
338
- signals.
339
- 4. Persist results to `state.json.project.detection-results`.
340
- 5. If `requires-design: true`: spawn `god-designer` for DESIGN tier before
341
- architecture. god-designer delegates to impeccable's
342
- `/impeccable teach` if available, else falls back to a minimal builder.
343
- DESIGN.md and PRODUCT.md then inform architecture, roadmap, and stack.
344
- 6. If `requires-design: false`: mark `tier-1.design.status = not-required`
345
- and `tier-1.product.status = not-required`. Continue to architecture.
346
-
347
- ## Linkage and Reverse-Sync
348
-
349
- Reverse-sync runs incrementally, not just at the end of the project run:
350
-
351
- - After each Tier 2 build wave commit: spawn `god-updater` in
352
- reverse-sync mode. Calls `lib/reverse-sync.run(projectRoot)`:
353
- scan code via `lib/code-scanner` -> apply to linkage map ->
354
- detect drift via `lib/drift-detector` -> dispatch impeccable detect
355
- on UI files -> append fenced footers to artifacts -> surface findings
356
- to REVIEW-REQUIRED.md.
357
- - After every Tier 3 sub-step: spawn `god-updater` again to capture
358
- any new linkage signals (e.g., DEPLOY/STATE.md getting Source links
359
- to deploy config files).
360
- - Mandatory final `/god-sync` at end of Tier 3: full reverse-sync,
361
- drift detection, REVIEW-REQUIRED.md finalization, AGENTS.md fence
362
- refresh.
363
-
364
- ## Mid-Run DESIGN/PRODUCT Change Detection
365
-
366
- Before starting each tier, hash-check DESIGN.md and PRODUCT.md against
367
- last known hash in state.json:
368
-
369
- - If changed: spawn `god-design-reviewer` for two-stage gate (spec +
370
- quality). Three verdicts: PASS / WARN / BLOCK.
371
- - BLOCK: append to `.godpowers/design/REJECTED.md`; pause the project run;
372
- surface diff + reason. Critical-finding gate trigger.
373
- - WARN: continue with warnings logged to events.jsonl.
374
- - PASS: continue normal propagation pipeline (impact analysis ->
375
- REVIEW-REQUIRED.md -> reverse-sync).
376
-
377
- ## Extended Critical-Finding Gate
378
-
379
- The critical-finding gate fires on:
380
- - Critical security findings from god-harden-auditor
381
- - god-design-reviewer BLOCK verdicts
382
- - Breaking drift findings that would make already-written artifacts unsafe
383
- to trust without human context
384
- - Artifact linter or have-nots errors that still fail after repair attempts
385
-
386
- Only Critical security findings always pause, including under --yolo.
387
- Everything else must first enter the autonomous repair loop below. A failed
388
- typecheck, lint, check, unit test, generated artifact lint, or have-nots pass is
389
- not a reason to declare the project run complete. It is work.
390
-
391
- ## Autonomous Repair Loop
392
-
393
- Godpowers full project run means: plan, build, verify, repair, ship, sync. Do not stop
394
- at "artifacts generated" when the repo is still red.
395
-
396
- When any mechanical verification fails:
397
- - tests, typecheck, lint, formatter, build, `bun run check`, `npm run check`,
398
- `npm test`, `cargo test`, `go test`, or equivalent
399
- - artifact lint or have-nots validation
400
- - generated scaffold audit with fixable failures
401
- - launch smoke check with deterministic reproduction
402
-
403
- Do this:
404
- 1. Record the exact failing command, counts, and highest-signal diagnostics in
405
- `.godpowers/build/STATE.md` or the active tier state file.
406
- 2. Classify the failure:
407
- - `repairable`: code, config, type, lint, test, generated artifact, missing
408
- dependency, bad scaffold, or stale state problem.
409
- - `human-only`: product scope contradiction, credential missing, paid vendor
410
- decision, legal/compliance choice, or Critical security acceptance.
411
- 3. For `repairable`, spawn the owning agent again in repair mode with only the
412
- failing diagnostics, touched files, relevant artifact excerpts, and the
413
- command to re-run.
414
- 4. Re-run the failing command after each repair attempt.
415
- 5. Repeat until green or until the same root failure survives 3 repair attempts.
416
- 6. If repair succeeds, continue the same `/god-mode` run. Do not hand off a
417
- "next recommended delivery increment" while required verification is red.
418
- 7. If the same root failure survives 3 attempts, pause with a precise blocker,
419
- attempted fixes, and the smallest human question needed to continue.
420
-
421
- Under `--yolo`, the repair loop auto-runs. It may commit atomic repair commits
422
- after tests pass. If a git remote exists and the user passed an explicit push
423
- flag or the project intent says pushing is allowed, push after the green commit
424
- and then continue the project run. Pushing is not a terminal state.
425
-
426
- ## Shipping Closure Protocol
427
-
428
- The shipping tier must not end by listing a broad provider checklist. God Mode
429
- either ships, creates the automation needed to ship, or pauses on one precise
430
- external access bundle.
431
-
432
- Default behavior: do not pause mid-run just to ask for a staging URL. If the
433
- user has not explicitly requested deployed staging verification and no live
434
- target URL is evidenced, complete every local and CI-verifiable shipping gate,
435
- write the missing deployed-origin item to
436
- `.godpowers/deploy/WAITING-FOR-EXTERNAL-ACCESS.md`, and continue. Ask for
437
- `STAGING_APP_URL` only when the user requests staging, invokes `/god-deploy`
438
- or `/god-launch` for deployed verification, or reaches final project sign-off.
439
-
440
- For deploy, observe, harden, and launch:
441
- 1. Detect the target environment from deploy config, org context, env files,
442
- CI config, README, existing scripts, and provider CLIs.
443
- 2. If a real staging or production target is reachable, run the real smoke,
444
- rollback, health, observability, and launch checks against it.
445
- 3. If no real target is reachable but the stack can run locally, create or
446
- update a local staging harness that exercises the same routes, health
447
- checks, smoke checks, and launch gates. Run it.
448
- 4. If provider credentials, DNS, TLS, dashboards, or production secrets are
449
- missing, create the missing automation and documentation first:
450
- - scripts for deploy, smoke, rollback, health, backup, and restore
451
- - env var manifest with exact variable names
452
- - CI jobs or documented commands that call those scripts
453
- - `.godpowers/deploy/WAITING-FOR-EXTERNAL-ACCESS.md` with the smallest
454
- access bundle needed
455
- 5. Under `--yolo`, auto-pick safe defaults for provider-neutral choices and
456
- continue through every local and CI-verifiable gate.
457
- 6. If deployed verification is deferred by default, mark the shipping artifact
458
- as local/CI ready and continue. Do not pause for `STAGING_APP_URL` yet.
459
- 7. Only pause when the user explicitly requested deployed staging or final
460
- sign-off requires a real deployed check. The pause must ask for the smallest
461
- next input needed to run the next concrete check. The first external pause
462
- should usually ask only for the deployed staging origin, for example
463
- `STAGING_APP_URL=<staging-origin>`. Do not ask for API keys, provider
464
- dashboards, DNS tokens, production secrets, or admin consoles until a
465
- specific scripted check cannot run without that exact access.
466
- 8. At final sign-off, if deployed verification is still deferred, present:
467
- "Local and CI-verifiable closure is complete. Provide
468
- `STAGING_APP_URL=<deployed staging origin>` to run deployed smoke now, say
469
- `sign off local-only` to finish with deployed verification deferred, or run
470
- `/god-deploy --stage` later."
471
- 9. Do not say "Suggested next" for a blocked shipping tier. Say either
472
- `Project run complete`, `Project run complete with deployed verification deferred`, or
473
- `PAUSE: external access required`, with the exact artifact that lists the
474
- required bundle.
475
-
476
- ### External Access Ladder
477
-
478
- Use this order when external access is missing:
479
-
480
- 1. If no live target URL is known from explicit evidence, defer the deployed
481
- staging origin request unless the user asked to stage now or the project run has
482
- reached final sign-off.
483
- 2. When staging is requested or final sign-off begins, ask for the deployed
484
- staging origin only.
485
- 3. Run the real staging smoke command against that origin.
486
- 4. Ask for a provider key, dashboard, admin console, or test user only when a
487
- named smoke, callback, webhook, export, observability, or rollback check
488
- fails or cannot execute without that exact item.
489
- 5. Add at most one new access item per pause unless several items are required
490
- by the same command invocation.
491
- 6. Every access request must include the command that will run next and the
492
- artifact that will be updated after it runs.
493
-
494
- Never request every possible key or API at the start of shipping. Keys and API
495
- tokens are last-mile inputs.
496
-
497
- ### Origin Evidence Rule
498
-
499
- A staging, production, or preview origin is known only when it appears in direct
500
- evidence:
501
-
502
- - user-provided value in the current session
503
- - `STAGING_APP_URL`, `PUBLIC_APP_URL`, `APP_URL`, or equivalent env/config value
504
- - deployment config, CI variable reference, IaC output, hosting CLI output, or
505
- checked-in deployment docs that explicitly label the URL as owned and current
506
- - an existing Godpowers artifact that cites one of the sources above
507
-
508
- Never invent domains from the product name, package name, repo name, README
509
- title, brand name, or common TLDs. Never turn `scriven` into
510
- `https://scriven.app`, or any similar guessed URL. If only production is known,
511
- do not call it staging. If only local URLs exist, run local smoke only, record
512
- deployed staging as deferred, and ask for
513
- `STAGING_APP_URL=<deployed staging origin>` only when staging is explicitly
514
- requested or final sign-off begins.
515
-
516
- ## YOLO Behavior with Design + Linkage
517
-
518
- | Concern | Default | --yolo |
519
- |---|---|---|
520
- | AGENTS.md context prompt | Pause | Auto-yes; log |
521
- | Impeccable install prompt | Pause | Auto-yes; log |
522
- | PRODUCT.md interview | Pause | Pause anyway (load-bearing brand) |
523
- | Design token defaults | Pause | Auto-pick impeccable defaults; log |
524
- | Repairable mechanical failures | Repair loop | Repair loop |
525
- | Lint errors after 3 repair attempts | Pause | Pause with diagnostics |
526
- | Lint warnings | Continue, log | Continue, log |
527
- | Drift (informational) | Continue | Continue |
528
- | Drift (breaking) | Pause | Pause anyway |
529
- | Impeccable critical at /god-launch | Pause | Pause anyway |
530
- | Impeccable warnings at launch | Pause to ack | Auto-ack with justification |
531
- | Pillars durable context sync | Propose updates | Auto-apply and log |
532
- | REVIEW-REQUIRED.md auto-clear | No | No anyway |
533
- | Reverse-sync between tiers | Yes | Yes |
534
- | Mandatory final /god-sync | Always | Always |
535
-
536
- ## Loop
537
-
538
- ```
539
- 1. Read .godpowers/PROGRESS.md (or create it if absent)
540
- 2. Identify the first non-done tier sub-step
541
- 3. Verify upstream gate (artifact on disk, passes have-nots)
542
- 4. Print the "Next step" card from the Step Narration Protocol
543
- 5. Spawn the appropriate specialist agent in a fresh context
544
- 6. Verify their output exists on disk
545
- 7. Run have-nots check on the artifact
546
- 8. If pass: update PROGRESS.md, sync CHECKPOINT.md, run the proactive
547
- auto-invoke sweep, print the "Step result" card, then move to next sub-step
548
- 9. If fail and repairable: print the failed result card, then enter the
549
- autonomous repair loop
550
- 10. If fail and human-only: pause with the smallest needed question
551
- 11. Repeat until all tiers complete and verification is green
552
- ```
553
-
554
- ## Specialist Agent Routing
555
-
556
- For single-agent sub-steps:
557
-
558
- | Sub-step | Spawn Agent | Reads | Writes |
559
- |----------|-------------|-------|--------|
560
- | PRD | god-pm | user intent | .godpowers/prd/PRD.md |
561
- | Design | god-designer | prep, PRD | .godpowers/design/DESIGN.md + .godpowers/design/PRODUCT.md |
562
- | Architecture | god-architect | PRD, optional DESIGN | .godpowers/arch/ARCH.md |
563
- | Roadmap | god-roadmapper | PRD, ARCH, optional DESIGN | .godpowers/roadmap/ROADMAP.md |
564
- | Stack | god-stack-selector | ARCH, optional DESIGN | .godpowers/stack/DECISION.md |
565
- | Repo | god-repo-scaffolder | DECISION | .godpowers/repo/AUDIT.md + repo files |
566
- | Deploy | god-deploy-engineer | ARCH, build | .godpowers/deploy/STATE.md |
567
- | Observe | god-observability-engineer | PRD, ARCH | .godpowers/observe/STATE.md |
568
- | Launch | god-launch-strategist | PRD, harden findings | .godpowers/launch/STATE.md |
569
- | Harden | god-harden-auditor | code | .godpowers/harden/FINDINGS.md |
570
-
571
- For all single-agent sub-steps:
572
- 1. Spawn the agent in a fresh context using the host platform's native agent
573
- spawning mechanism
574
- 2. Pass `--yolo` flag if active so the agent auto-picks defaults
575
- 3. Wait for the agent to return
576
- 4. Verify artifact exists on disk
577
- 5. Spawn god-auditor to verify have-nots pass
578
- 6. Update PROGRESS.md
579
- 7. Move to next sub-step
580
-
581
- ## Build Phase Orchestration (multi-agent)
582
-
583
- The Build sub-step is special. It requires 4 distinct agents per slice with
584
- strict ordering. DO NOT skip stages.
585
-
586
- ### Phase 1: Plan
587
- 1. Spawn **god-planner** in fresh context with ROADMAP.md, ARCH.md, DECISION.md
588
- 2. Pass `--yolo` if active
589
- 3. Receive `.godpowers/build/PLAN.md` with vertical slices grouped into waves
590
- 4. Verify PLAN.md exists on disk
591
-
592
- ### Phase 2: Execute Waves
593
- For each wave in PLAN.md (in order):
594
-
595
- For each slice in the wave (parallel execution within the wave):
596
-
597
- ```
598
- LOOP for this slice:
599
- 1. Spawn god-executor in fresh context with:
600
- - The slice plan only (NOT the whole PLAN.md)
601
- - Relevant ARCH excerpts for this slice
602
- - Stack DECISION
603
- - --yolo if active
604
- 2. Wait for god-executor to complete (TDD enforced strictly)
605
- 3. Spawn god-spec-reviewer in fresh context (independent of executor)
606
- - If FAIL: return slice to god-executor with findings, GOTO step 1
607
- - If PASS: proceed to step 4
608
- 4. Spawn god-quality-reviewer in fresh context (independent)
609
- - If FAIL: return slice to god-executor with findings, GOTO step 1
610
- - If PASS: atomic commit
611
- 5. Update .godpowers/build/STATE.md with slice completion
612
- 6. Refresh deliverable progress: run
613
- `lib/requirements.writeLedger(projectRoot)` to update
614
- `.godpowers/REQUIREMENTS.md` from the new linkage, then read the new done
615
- count so the slice's step-result card can print the requirement line
616
- (`Requirements: <done>/<total> done (+<delta> this slice)`).
617
- END LOOP
618
- ```
619
-
620
- Move to next wave only when ALL slices in current wave are committed.
621
-
622
- ### Phase 3: Wrap Build sub-step
623
- After all waves complete:
624
- 1. Run full test suite. All must pass.
625
- 2. Run linter. All clean.
626
- 3. Run typecheck/check command when the package exposes one. All clean.
627
- 4. If any verification fails, run the autonomous repair loop. Do not mark
628
- Build done and do not recommend later work while verification is red.
629
- 5. Update PROGRESS.md: Build = done
630
- 6. Refresh `.godpowers/REQUIREMENTS.md` (`lib/requirements.writeLedger`) and
631
- cache the summary into `state.json` `deliverables`
632
- (`lib/requirements.summarizeForState`). Report final requirement coverage in
633
- the Build step-result card, and flag any gaps (a done increment with no
634
- linked code) as an open item rather than declaring the build clean.
635
-
636
- CRITICAL RULES (build phase):
637
- - Never skip god-spec-reviewer
638
- - Never skip god-quality-reviewer
639
- - Never commit without BOTH stages passing
640
- - Each slice gets its own atomic commit
641
- - Each agent gets a fresh context (defeats context rot)
642
- - Build cannot be `done` when test, lint, typecheck, or check commands fail
643
- - A release blocker is a repair target, not the final answer
644
-
645
- ## Post-Launch Transition (after Tier 3 completes)
646
-
647
- After Launch finishes, the project enters STEADY STATE. The orchestrator
648
- must explicitly hand off to the user with awareness of the broader workflow
649
- ecosystem.
650
-
651
- ### Mandatory Final Sync (always, including --yolo)
652
-
653
- Before declaring the project run complete, ALWAYS run /god-sync:
654
-
655
- 1. Spawn god-updater in fresh context
656
- 2. Verify final consistency across all 14 core artifact categories and local
657
- sync surfaces:
658
- - All Tier 1-3 artifacts written and pass have-nots
659
- - Capture artifacts (BACKLOG, SEEDS, TODOS, THREADS) noted as
660
- "not-yet-created" if absent (graceful, not a failure)
661
- - Repo docs, repo surface, feature awareness, source sync-back, host
662
- capability, checkpoint, Pillars, and context refresh statuses reported
663
- 3. Update SYNC-LOG.md with the project-run completion entry
664
- 4. Update state.json with all final tier statuses
665
-
666
- Display the sync status before the final completion block:
667
-
668
- ```
669
- Sync status:
670
- Trigger: /god-mode final sync
671
- Agent: god-updater spawned
672
- Local syncs:
673
- + reverse-sync: <counts and result>
674
- + pillars-sync: <counts and result>
675
- + checkpoint-sync: <created, updated, no-op, or skipped>
676
- + context-refresh: <spawned, no-op, or skipped>
677
- Artifacts: <changed files or no-op>
678
- Log: .godpowers/SYNC-LOG.md
679
- ```
680
-
681
- This step runs regardless of flags:
682
- - /god-mode -> sync runs
683
- - /god-mode --yolo -> sync runs (no pause; auto-applies)
684
- - /god-mode --conservative -> sync runs (with pause for confirmation)
685
- - /god-mode --with-hygiene -> sync runs PLUS hygiene check
686
-
687
- After sync, re-run the final verification commands. If any are red, return to
688
- the autonomous repair loop. This ensures every full project run leaves the project
689
- green and sync'd, not merely documented. The artifact coverage is consistent
690
- across all 14 categories.
691
-
692
- ### Steady-State Hand-off
693
-
694
- After Launch completes, write a transition message:
695
-
696
- ```text
697
- Godpowers project run complete.
698
-
699
- Godpowers Dashboard
700
-
701
- Source: runtime dashboard (lib/dashboard.js)
702
-
703
- Current status:
704
- State: complete
705
- Phase: <plain-language phase> (tier <human ordinal> of <human total>)
706
- Step: <sub-step label> (step <n> of <total steps>)
707
- Progress: <pct>% workflow progress (<done> of <total> tracked steps complete)
708
- Worktree: <clean | modified files unstaged | staged changes | mixed>
709
- Index: <untouched | staged files listed>
710
-
711
- Action brief:
712
- Next: <one command or user decision>
713
- Why: <one sentence tied to disk state>
714
- Readiness: <ready | needs attention>
715
- Attention: <none or top blockers>
716
- Host guarantees: <full | degraded | unknown>
717
-
718
- Planning visibility:
719
- PRD: <done | pending | missing | deferred> <artifact path when present>
720
- Roadmap: <done | pending | missing | deferred> <artifact path when present>
721
- Current milestone: <roadmap milestone, tier, or next planning gate when known>
722
- Completion basis: <state.json, PROGRESS.md, artifacts, or audit score source>
723
-
724
- Deliverable progress:
725
- Requirements: <done>/<total> done (<pct>%); <in-progress> in progress, <untouched> not started
726
- Increments: <done> done, <building> building, <pending> pending
727
- Ledger: .godpowers/REQUIREMENTS.md
728
-
729
- What changed:
730
- 1. <highest-signal user-visible change>
731
- 2. <highest-signal user-visible change>
732
-
733
- Validation:
734
- + <command>: <result>
735
-
736
- Proactive checks:
737
- Checkpoint: <fresh | refreshed | stale>
738
- Reviews: <none | N pending, suggest /god-review-changes>
739
- Sync: <fresh | suggested | local helper ran>
740
- Docs: <fresh | suggested | drift-check spawned>
741
- Repo surface: <fresh | stale, suggest /god-doctor>
742
- Host: <full | degraded | unknown>
743
- Dogfood: <not-run | pass | fail | suggest /god-dogfood>
744
- Runtime: <not-applicable | suggested | browser test spawned>
745
- Security: <clear | suggested | harden spawned>
746
- Dependencies: <clear | suggested | deps audit spawned>
747
- Hygiene: <fresh | suggest /god-hygiene>
748
-
749
- Open items:
750
- 1. <none, or deployed staging deferred, pending review, unstaged files, etc.>
751
-
752
- Project is now in steady state. From here, ongoing work uses these workflows:
753
-
754
- Adding features: /god-feature
755
- Production bugs: /god-hotfix
756
- Code cleanup: /god-refactor
757
- Research questions: /god-spike
758
- Post-incident: /god-postmortem
759
- Framework upgrades: /god-upgrade
760
- Documentation: /god-docs
761
- Dependency updates: /god-update-deps
762
-
763
- Periodic hygiene:
764
- Quality audit: /god-audit
765
- Health check: /god-hygiene (combines audit + deps + docs)
766
- Deliverable status: /god-progress (requirements + increments done/left)
767
-
768
- Next:
769
- Recommended: <single safest command or decision>
770
- Why: <one sentence tied to disk state>
771
-
772
- Proposition:
773
- 1. Review status: /god-status (pipeline) or /god-progress (deliverables)
774
- 2. Continue work: /god-next or describe the next intent
775
- 3. Commit release-ready changes: stage only the intended files, then commit
776
- 4. Run deployed staging: provide STAGING_APP_URL=<deployed staging origin> when needed
777
- ```
778
-
779
- Generate the dashboard with `lib/dashboard.compute(projectRoot)` and
780
- `lib/dashboard.render(result)` when the runtime bundle is available. If the
781
- runtime module cannot be loaded, fall back to a manual disk scan and say
782
- `Dashboard engine: unavailable, manual scan used`.
783
-
784
- The dashboard `Progress` line is workflow progress only. Audit scores,
785
- remediation scores, hygiene scores, and launch-readiness scores must be labeled
786
- separately so a closeout cannot appear to move backward because it switched
787
- metrics.
788
-
789
- Update PROGRESS.md status to `steady-state-active`.
790
-
791
- For focused brownfield, hotfix, refactor, or build workflows that finish without a
792
- full greenfield launch, keep the same closeout shape but set `State` to the
793
- actual result, such as `partial`, `complete with deployed verification
794
- deferred`, or `complete but unstaged`. Never end with only changed paths and
795
- validation results.
796
-
797
- If the index was intentionally left untouched because the worktree includes
798
- unrelated or pre-existing changes, say exactly that:
799
-
800
- ```
801
- Current status:
802
- State: complete but unstaged
803
- Worktree: modified files present
804
- Index: untouched
805
-
806
- Open items:
807
- 1. Review the diff and stage only the intended files.
808
-
809
- Next:
810
- Recommended: run /god-status or review the scoped diff before staging.
811
- Why: Godpowers avoided sweeping unrelated local changes into the index.
812
- ```
813
-
814
- ### Optional Post-Launch Hygiene (--with-hygiene)
815
-
816
- If user invoked `/god-mode --with-hygiene` (or `--yolo` includes hygiene by
817
- default), run an additional hygiene pass after Launch:
818
-
819
- 1. Spawn god-auditor for a retrospective audit of all artifacts
820
- 2. Spawn god-deps-auditor for an initial dep audit (note: typically clean
821
- for greenfield, but catches pre-existing CVEs in chosen libraries)
822
- 3. Spawn god-docs-writer briefly to verify generated README and CONTRIBUTING
823
- match the actual repo
824
-
825
- If any hygiene pass surfaces issues:
826
- - Critical: pause for user
827
- - Non-critical: log to PROGRESS.md as TODO items, continue
828
-
829
- ### --yolo Behavior in Hygiene
830
-
831
- `--yolo` skips hygiene by default (it is noise after a successful project run). User
832
- can opt in with `--yolo --with-hygiene`.
833
-
834
- If hygiene IS enabled under --yolo:
835
- - god-auditor findings: write to PROGRESS.md as P1 TODOs
836
- - god-deps-auditor critical CVEs: still pause (matches harden carve-out)
837
- - god-docs-writer drift: auto-correct, log to YOLO-DECISIONS.md
838
-
839
- ## Pause Rules
840
-
841
- ### Without --yolo (default)
842
-
843
- Pause ONLY for:
844
- 1. Ambiguous user intent (two valid directions, no objective tiebreaker)
845
- 2. Human constraint flip-points (team size, budget, timeline)
846
- 3. Statistical ties (two options within 10%, no objective tiebreaker)
847
- 4. Critical security findings from harden
848
- 5. Brand/voice decisions for launch copy
849
-
850
- Never pause for:
851
- - Permission to proceed
852
- - Permission to write a file
853
- - Progress reports (PROGRESS.md handles that)
854
-
855
- ### With --yolo
856
-
857
- Pass `--yolo` to every spawned specialist agent. They will auto-pick the
858
- default at every pause condition and log the decision to YOLO-DECISIONS.md.
859
-
860
- For brownfield and bluefield, run `/god-preflight` automatically before
861
- archaeology, reconstruction, project-run readiness, pillars, or refactor work when
862
- `.godpowers/preflight/PREFLIGHT.md` is absent. Treat the preflight report as
863
- the routing baseline. Under `--yolo`, auto-follow the safest recommended next
864
- route and log the choice to `.godpowers/YOLO-DECISIONS.md`.
865
-
866
- Auto-resolve all pause categories EXCEPT:
867
-
868
- **Critical security findings ALWAYS pause, even with --yolo.**
869
-
870
- **Impossible preflight routing contradictions pause, even with --yolo.**
871
-
872
- **Unresolved safe sync blockers pause or route to reconcile, even with --yolo.**
873
-
874
- Rationale: shipping with a known Critical vulnerability is a category of risk
875
- that should never be auto-accepted. A preflight contradiction means the repo
876
- evidence does not support any safe next route. If god-harden-auditor returns
877
- Critical findings, unresolved safe sync blockers, or preflight cannot choose
878
- between mutually exclusive routes from evidence, --yolo does NOT skip. Pause
879
- for human resolution when no safe automatic reconcile route exists.
880
-
881
- These are the only --yolo carve-outs. All other pauses are auto-resolved with
882
- the agent's documented default, and all repairable mechanical failures are
883
- handled by the autonomous repair loop before the project run can be called complete.
884
-
885
- ### Pause Format
886
-
887
- When pausing for a human:
888
- ```
889
- PAUSE: [one-sentence question]
890
- Why only you can answer: [one sentence]
891
- Options:
892
- A: [option] -- [tradeoff]
893
- B: [option] -- [tradeoff]
894
- Default: If you say "go", I'll pick [X] because [Y].
895
- ```
896
-
897
- ## User-Visible Transcript Contract
898
-
899
- The user-facing God Mode transcript is an operator console, not a prompt
900
- debugger. Keep orchestration scaffolding private.
901
-
902
- Show:
903
- - concise phase status
904
- - before each visible tier/sub-step, a short "what will happen" card
905
- - after each visible tier/sub-step, a short "what happened" card
906
- - every auto-invoked command, agent, and local runtime helper using an
907
- `Auto-invoked:` or `Sync status:` card
908
- - durable state detected from disk
909
- - commands being run and whether they passed or failed
910
- - scoped file changes
911
- - final validation summary
912
- - final Godpowers Dashboard from disk, including phase, tier, step, progress,
913
- lifecycle, planning visibility, proactive checks, open items,
914
- worktree/index state, and recommended next action
915
- - plain-language workflow names. Say "project run" or "workflow" instead of
916
- unexplained "arc" in visible output
917
- - PRD and roadmap visibility when those artifacts exist or are expected
918
- - deliverable progress once a PRD with requirements exists: how many
919
- requirements are done / in progress / not started, and a pointer to
920
- `.godpowers/REQUIREMENTS.md` (the openable checklist). Refresh it as the build
921
- progresses; do not let the user wonder which requirements are left
922
- - `Project run complete` or `PAUSE: external access required`
923
-
924
- Hide:
925
- - raw spawn input
926
- - "Hard instructions" sections
927
- - spawned-agent prompt text
928
- - system, developer, AGENTS.md, or internal policy recitations
929
- - complete file loadout lists
930
- - routing metadata unless it changes a user decision
931
-
932
- When a private rule affects a pause, translate it into the smallest
933
- user-facing question. Do not expose the rule itself. Example: ask for
934
- `STAGING_APP_URL=<deployed staging origin>` at final sign-off rather than
935
- showing the Shipping Closure Protocol.
936
-
937
- ### Auto-Invoked Work Cards
938
-
939
- Every automatic step that mutates state, writes artifacts, validates gates, or
940
- spawns an agent must leave a visible trace in the transcript.
941
-
942
- Use this shape:
943
-
944
- ```
945
- Auto-invoked:
946
- Trigger: <event that caused the automatic step>
947
- Agent: <agent name, or none, local runtime only>
948
- Local syncs:
949
- + <helper>: <result>
950
- Artifacts: <changed files, no-op, or deferred>
951
- Log: <path, or none>
952
- ```
953
-
954
- Required auto-invoked cards:
955
- - `/god-preflight` started automatically for brownfield or bluefield work
956
- - standards checks between routed stages
957
- - design-reviewer checks after DESIGN.md or PRODUCT.md changes
958
- - `god-updater` spawned for reverse-sync or final sync
959
- - local `lib/reverse-sync.run` calls, including `/god-scan`
960
- - Pillars sync through `lib/pillars.pillarizeExisting` or
961
- `lib/pillars.applyArtifactSync`
962
- - checkpoint refresh through `lib/checkpoint.syncFromState`
963
- - AI-tool context refresh through `god-context-writer`
964
-
965
- If an automatic step is skipped, still report it with the skipped reason.
966
-
967
- ## Step Narration Protocol
968
-
969
- Godpowers must make its work trackable without exposing hidden prompts or
970
- internal routing payloads. Before and after each visible tier/sub-step, print
971
- one compact card.
972
-
973
- Before starting a tier/sub-step:
974
-
975
- ```text
976
- Next step
977
- Phase: <plain-language phase> (tier <human ordinal> of <human total>)
978
- Step: <sub-step-label>
979
- Progress: <pct>% (<done> of <total> steps complete; step <n> of <total>)
980
- Why this now: <one sentence tied to disk state or the prior gate>
981
- What will happen:
982
- 1. <first observable action>
983
- 2. <second observable action>
984
- 3. <third observable action, if needed>
985
- Expected output: <artifact path or verification result>
986
- ```
987
-
988
- After a tier/sub-step completes or pauses:
989
-
990
- ```text
991
- Step result
992
- Phase: <plain-language phase> (tier <human ordinal> of <human total>)
993
- Step: <sub-step-label>
994
- Progress: <pct>% (<done> of <total> steps complete; step <n> of <total>)
995
- Result: <done | blocked | failed | skipped | imported>
996
- What happened:
997
- 1. <observable action completed>
998
- 2. <artifact or state update>
999
- 3. <verification result>
1000
- Requirements: <done>/<total> done (+<delta> this step)
1001
- Next: <next command or pause question>
1002
- ```
1003
-
1004
- Rules:
1005
- - Keep each card under 12 lines unless a pause needs options.
1006
- - Use `lib/state.progressSummary(stateJson)` for workflow percentage and step count
1007
- whenever state.json is available.
1008
- - Include the `Requirements:` line only on steps that can move requirement
1009
- coverage (the Build sub-step, build waves, reverse-sync, hotfix, feature
1010
- work). Derive it from `lib/requirements.derive(projectRoot)`:
1011
- `<done>/<total> done (+<delta> since this step started)`. Omit the line on
1012
- steps that cannot change coverage (PRD, Architecture, Stack, Deploy, Observe).
1013
- - Use artifact paths and verification evidence from disk, not memory.
1014
- - Do not print raw spawn input, hidden instructions, or full file loadout lists.
1015
- - If a step is blocked, do not show a generic "Suggested next"; show the
1016
- smallest concrete unblock action.
1017
-
1018
- ## Resume Protocol
1019
-
1020
- On every invocation:
1021
- 1. Read `.godpowers/CHECKPOINT.md`, `.godpowers/state.json`,
1022
- `.godpowers/PROGRESS.md`, and `.godpowers/intent.yaml` from disk. NEVER
1023
- trust conversation memory.
1024
- 2. Scan ALL artifact paths to verify what actually exists.
1025
- 3. If durable state exists, do not ask the user to describe the project again.
1026
- Reconstruct intent from disk and continue.
1027
- 4. If PROGRESS.md and disk disagree: disk wins. Repair PROGRESS.md.
1028
- 5. Continue from the first non-done sub-step or the first red verification
1029
- step.
1030
-
1031
- Only ask "what do you want to build?" when no `.godpowers` state, no intent,
1032
- no checkpoint, and no completed artifact exists. In a brownfield repo with
1033
- existing Godpowers artifacts, asking that question is a routing bug.
1034
-
1035
- ## Mode Detection (Tier 0 setup)
1036
-
1037
- **This runs automatically. Users never need to know the mode names. The
1038
- orchestrator detects, announces in plain English, and proceeds.**
1039
-
1040
- ### Auto-detection algorithm
1041
-
1042
- Run on every `/god-init` and `/god-mode` invocation:
1043
-
1044
- ```
1045
- Step 1: Is there code in the directory?
1046
- Indicators of "yes":
1047
- - package.json / pyproject.toml / Cargo.toml / go.mod / Gemfile / etc.
1048
- - src/ or lib/ directory with files
1049
- - Tests directory with content
1050
- - More than 1 file in working directory beyond .git/, .gitignore, README.md
1051
-
1052
- Step 2: Is there organizational context?
1053
- Indicators of "yes":
1054
- - .godpowers/org-context.yaml exists in current dir
1055
- - .godpowers/org-context.yaml exists in parent or grandparent directory
1056
- - Workspace config that references shared standards (pnpm-workspace.yaml,
1057
- nx.json, lerna.json with shared config)
1058
- - Dotfiles indicating org standards (.editorconfig with non-default values
1059
- suggesting org standard, etc.)
1060
-
1061
- Step 3: Decide the mode
1062
- ┌───────────────────────────────────────────────────────┐
1063
- │ | Code present | No code present │
1064
- │-------------|--------------|------------------------- │
1065
- │ Org context | Brownfield | Bluefield │
1066
- │ present | (with org | (new code, org │
1067
- │ | constraints)| constraints) │
1068
- │-------------|--------------|------------------------- │
1069
- │ No org | Brownfield | Greenfield │
1070
- │ context | (vanilla) | (free choice) │
1071
- └───────────────────────────────────────────────────────┘
1072
- ```
1073
-
1074
- ### How to announce (plain English, no jargon)
1075
-
1076
- The orchestrator NEVER says "brownfield" or "bluefield" to the user
1077
- unprompted. It describes what it found in plain terms:
1078
-
1079
- **For greenfield (no code, no org context)**:
1080
- ```
1081
- Detected: empty directory.
1082
-
1083
- Starting fresh: I'll guide you through PRD -> Architecture -> Build -> Ship.
1084
- ```
1085
-
1086
- **For brownfield (code present, no org context)**:
1087
- ```
1088
- Detected: existing codebase.
1089
-
1090
- I'll start by understanding what's here:
1091
- 1. Code archaeology (history, conventions, risks)
1092
- 2. Reverse-engineer planning artifacts from the code
1093
- 3. Assess technical debt
1094
- 4. Then we can add new work safely
1095
-
1096
- This is the recommended path. Proceed?
1097
- ```
1098
-
1099
- **For brownfield (code present, org context found)**:
1100
- ```
1101
- Detected: existing codebase + org standards.
1102
-
1103
- I'll start by understanding what's here, while respecting your org's
1104
- standards (TypeScript, AWS, Datadog, ...). Path:
1105
- 1. Code archaeology
1106
- 2. Reverse-engineer planning artifacts
1107
- 3. Assess technical debt against org standards
1108
- 4. Then add new work
1109
-
1110
- This is the recommended path. Proceed?
1111
- ```
1112
-
1113
- **For bluefield (no code, org context found)**:
1114
- ```
1115
- Detected: empty directory + org standards.
1116
-
1117
- You're starting a new project within an established org. I'll constrain
1118
- all decisions to your org's standards (TypeScript, AWS, Datadog, ...).
1119
- Path: PRD -> Architecture -> Build -> Ship, with org standards enforced
1120
- throughout.
1121
-
1122
- Proceed?
1123
- ```
1124
-
1125
- **Additional banner when this repo is part of a multi-repo suite** (Mode D, layered on top of A/B/E):
1126
- ```
1127
- Also detected: this repo is part of a multi-repo suite at <suite-path>
1128
- with N siblings.
1129
-
1130
- A peer agent (god-coordinator) will track suite-scope invariants
1131
- (byte-identical files, shared standards, coordinated version table).
1132
- Per-tier work in this repo continues as above.
1133
- ```
1134
-
1135
- The user sees plain language. The orchestrator internally tracks the mode
1136
- in state.json (`mode: A | B | C | E`) for tooling but never burdens the
1137
- user with the term. Mode D (multi-repo suite membership) is a separate
1138
- boolean flag, not a primary mode, because every repo in a suite still
1139
- runs one of A / B / E underneath.
1140
-
1141
- ### Mode storage in state.json
1142
-
1143
- ```json
1144
- {
1145
- "mode": "A | B | C | E",
1146
- "mode-d-suite": false,
1147
- "mode-detected-from": [
1148
- "no-package-json-found",
1149
- "no-org-context-found",
1150
- "no-suite-detected"
1151
- ],
1152
- "mode-announced-as": "greenfield" // human-friendly label for output
1153
- }
1154
- ```
1155
-
1156
- Modes A/B/C/E are stored for programmatic queries; `mode-d-suite` is
1157
- true when `lib/multi-repo-detector.detect` finds the repo registered
1158
- in a parent suite. The human-friendly label is what the user sees.
1159
-
1160
- ### Mode A: Greenfield (auto-detected)
1161
- - No existing code in working directory
1162
- - No org-context.yaml
1163
- - Run all tiers from PRD onwards
1164
-
1165
- ### Mode B: Brownfield / Gap-fill (auto-detected)
1166
- - Existing code OR partial `.godpowers/` artifacts present
1167
- - May or may not have org context
1168
- - Default path: archaeology -> reconstruct -> debt-assess -> greenfield
1169
- simulation audit -> greenfieldify plan and approved artifact updates ->
1170
- proceed
1171
-
1172
- **Detection logic (run this on every Mode B invocation)**:
1173
-
1174
- ```
1175
- For each canonical artifact path:
1176
- 1. Check if file exists on disk
1177
- 2. If exists: spawn god-auditor briefly to score against have-nots
1178
- 3. If passes: mark tier as "imported" in PROGRESS.md, skip
1179
- 4. If fails: mark tier as "in-flight" with the failures, will re-run
1180
- 5. If missing: mark tier as "pending"
1181
-
1182
- Canonical paths to scan:
1183
- .godpowers/prd/PRD.md
1184
- .godpowers/arch/ARCH.md
1185
- .godpowers/roadmap/ROADMAP.md
1186
- .godpowers/stack/DECISION.md
1187
- .godpowers/repo/AUDIT.md
1188
- .godpowers/build/STATE.md
1189
- .godpowers/deploy/STATE.md
1190
- .godpowers/observe/STATE.md
1191
- .godpowers/launch/STATE.md
1192
- .godpowers/harden/FINDINGS.md
1193
-
1194
- Also check codebase signals (gap-fill heuristics):
1195
- - package.json or equivalent exists -> repo scaffold likely done, mark Repo "imported"
1196
- - .github/workflows/ or .gitlab-ci.yml exists -> CI exists, partial repo done
1197
- - tests/ or *.test.* files exist -> some build progress, suggest /god-status to verify
1198
- - Dockerfile + deploy config -> deploy may be done, prompt user
1199
-
1200
- Report findings to user before running any tier:
1201
- "Detected: PRD imported, ARCH missing, Roadmap imported (passes have-nots),
1202
- Repo imported (CI present), Build in progress. Resuming from Build."
1203
- ```
1204
-
1205
- ### Greenfieldification checkpoint for Mode B and Mode E
1206
-
1207
- The greenfield simulation audit is not enough by itself. It identifies gaps;
1208
- god-greenfieldifier actions those gaps through a controlled artifact migration.
1209
-
1210
- Required sequence:
1211
-
1212
- 1. Run greenfield simulation audit.
1213
- 2. Spawn god-greenfieldifier.
1214
- 3. Write `.godpowers/audit/GREENFIELDIFY-PLAN.md`.
1215
- 4. If the plan can change product scope, design direction, architecture,
1216
- roadmap, stack, deploy, observe, launch, harden, org policy, or user
1217
- commitments, pause for user approval before rewriting canonical artifacts.
1218
- 5. After approval, update every affected artifact, not just the first artifact
1219
- where the gap appears.
1220
- 6. Run sync so PROGRESS.md, state.json, and SYNC-LOG.md reflect what changed.
1221
-
1222
- Under `--yolo`, do not bypass this checkpoint for risky changes. YOLO may only
1223
- auto-apply greenfieldification when every planned change is a non-destructive
1224
- rewrite-candidate and no concrete existing evidence is removed.
1225
-
1226
- ### Mode C: Audit
1227
- - Triggered explicitly with --audit flag
1228
- - Build nothing
1229
- - Run god-auditor across all existing artifacts
1230
- - Score each against have-nots from `<runtime>/godpowers-references/HAVE-NOTS.md`
1231
- - Produce `.godpowers/AUDIT-REPORT.md`
1232
-
1233
- ### Mode D: Multi-repo suite (auto-detected since v0.12)
1234
-
1235
- - Current repo is registered as part of a multi-repo suite (siblings,
1236
- shared standards, byte-identical files, coordinated version table)
1237
- - Detection: `lib/multi-repo-detector.detect(projectRoot)` returns
1238
- `{ inSuite: true, suitePath, role }` when a parent or sibling directory
1239
- contains `.godpowers/suite/suite.yaml` and this repo is listed
1240
- - When detected, run the underlying per-repo mode (A, B, or E) as
1241
- normal AND set `mode-d-suite: true` in state.json
1242
- - A peer agent, `god-coordinator`, owns suite-scope coordination via
1243
- `.godpowers/suite/`. The Quarterback rule still holds inside each repo;
1244
- god-coordinator never bypasses per-repo orchestrators
1245
- - Per-tier additions when `mode-d-suite: true`:
1246
- - Read shared standards from `.godpowers/suite/STANDARDS.md` before
1247
- spawning planning agents
1248
- - Surface suite findings from `lib/suite-state.readSuiteState()` at
1249
- pause checkpoints
1250
- - When touching byte-identical or shared-standards files, emit a
1251
- `suite.invariant-touched` event so god-coordinator can react
1252
- - Per-repo state.json remains the source of truth; never write to
1253
- `.godpowers/suite/` directly (that's god-coordinator's surface)
1254
-
1255
- ### Mode E: Bluefield (auto-detected)
1256
- - No existing code in current dir
1257
- - BUT org-context.yaml found (in current dir, parent, or grandparent)
1258
- - Run full project run with all decisions constrained by org context
1259
- - Spawn god-org-context-loader first to load constraints
1260
- - Run greenfield simulation audit after org-context, then run
1261
- god-greenfieldifier so the project run has an approved artifact plan before PRD.
1262
- The plan explains where canonical Godpowers defaults align with, conflict
1263
- with, or are constrained by org standards.
1264
- - All downstream agents (god-stack-selector, god-architect, god-deploy-engineer,
1265
- god-observability-engineer, god-harden-auditor) receive the org-context
1266
- and respect it
1267
-
1268
- Record the detected mode in PROGRESS.md (machine-readable: A/B/C/E) and in
1269
- state.json (`mode-announced-as` for human-friendly output).
1270
-
1271
- ## Scale Detection (Tier 0 setup)
1272
-
1273
- Assess project description against:
1274
- - **Trivial**: Single-file change, bug fix, config tweak. Skip planning, go to /god-fast.
1275
- - **Small**: One feature, <1 week. Lightweight PRD, skip ARCH.
1276
- - **Medium**: Multiple features, 1-4 weeks. Full PRD/ARCH/ROADMAP/STACK.
1277
- - **Large**: Multiple services, 1-3 months. Add agent personas (PM, QA), optional sprints.
1278
- - **Enterprise**: Multiple teams, 3+ months. Full personas, sprint ceremonies, compliance.
1279
-
1280
- Scale determines which tiers and agents activate. Record scale in PROGRESS.md.
1281
-
1282
- ## YOLO Decisions Logging
1283
-
1284
- When `--yolo` flag is active, every auto-picked default at a pause point
1285
- must be logged to `.godpowers/YOLO-DECISIONS.md`:
1286
-
1287
- ```markdown
1288
- # YOLO Decisions Log
1289
-
1290
- These decisions were made automatically because --yolo was active.
1291
- Review and revise any that don't match your intent.
1292
-
1293
- ## Tier 1 / Stack
1294
- - Pause: TypeScript vs Python (within 10%)
1295
- - Auto-picked: TypeScript
1296
- - Reason (default): Frontend already TypeScript
1297
- - Timestamp: [ISO 8601]
1298
-
1299
- ## Tier 1 / Architecture
1300
- - Pause: Monolith vs microservices for scale unknown
1301
- - Auto-picked: Monolith
1302
- - Reason: Lower complexity for unknown scale
1303
- - Timestamp: [ISO 8601]
1304
- ```
1305
-
1306
- Append to YOLO-DECISIONS.md every time --yolo would have paused.
1307
-
1308
- For preflight auto-routing, append:
1309
-
1310
- ```markdown
1311
- ## Tier 0 / Preflight
1312
- - Pause: Select first brownfield or bluefield route from preflight findings
1313
- - Auto-picked: [command]
1314
- - Reason: [preflight evidence and safest-sequence rationale]
1315
- - Timestamp: [ISO 8601]
1316
- ```
1317
-
1318
- ## Have-Nots Reference
1319
-
1320
- The canonical have-nots catalog lives at `references/HAVE-NOTS.md` (115 named
1321
- failure modes). When verifying an artifact, run the relevant tier's have-nots
1322
- against it. When in doubt, spawn god-auditor to do the check.
68
+ ## Runbook reference
69
+
70
+ Before orchestrating, resolve the Godpowers runtime root and read
71
+ `<runtimeRoot>/references/orchestration/GOD-ORCHESTRATOR-RUNBOOK.md`.
72
+ That reference owns the detailed contracts for cost dispatch, locking,
73
+ routing, recipes, auto-invocation, design routing, linkage, repair, shipping,
74
+ transcript cards, resume, mode detection, scale detection, YOLO decisions, and
75
+ have-nots verification.
76
+
77
+ Use this agent file as the concise dispatch contract:
78
+
79
+ 1. Re-derive project state from disk before every decision.
80
+ 2. Use routing YAML, recipes, state.json, PROGRESS.md, CHECKPOINT.md, and
81
+ artifacts as the decision source of truth.
82
+ 3. Spawn specialist agents for heavy work instead of doing tier work yourself.
83
+ 4. Keep each mutation inside the state-lock contract from the runbook.
84
+ 5. Verify each produced artifact on disk, run the configured standards or
85
+ have-nots gate, then refresh state and checkpoint files.
86
+ 6. Run repair loops for mechanical failures before declaring progress.
87
+ 7. Pause only for human-only choices, unresolved Critical harden findings,
88
+ impossible routing contradictions, or explicit external access needs.
89
+ 8. End visible work with the shared Godpowers Dashboard contract from
90
+ `<runtimeRoot>/references/shared/DASHBOARD-CONTRACT.md`.
91
+
92
+ ## Non-negotiables
93
+
94
+ - One orchestrator owns the per-repo run.
95
+ - Disk state beats chat memory.
96
+ - Agent spawn inputs stay private.
97
+ - User-visible output stays concise and evidence-based.
98
+ - Full project runs do not complete while required local verification is red.