stead 0.5.0__py3-none-any.whl

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 (139) hide show
  1. ctx/__init__.py +7 -0
  2. ctx/__main__.py +9 -0
  3. ctx/_bundled_factories/context-maintenance/FACTORY.md +37 -0
  4. ctx/_bundled_factories/context-maintenance/evals/eval-maintenance-broken-relation.json +7 -0
  5. ctx/_bundled_factories/context-maintenance/evals/eval-maintenance-clean.json +7 -0
  6. ctx/_bundled_factories/context-maintenance/evals/eval-maintenance-duplicates.json +7 -0
  7. ctx/_bundled_factories/context-maintenance/evals/eval-maintenance-inbox.json +7 -0
  8. ctx/_bundled_factories/context-maintenance/evals/eval-maintenance-stale.json +7 -0
  9. ctx/_bundled_factories/context-maintenance/prompts/v1.md +19 -0
  10. ctx/_bundled_factories/feature-builder/FACTORY.md +160 -0
  11. ctx/_bundled_factories/feature-builder/evals/eval-feature-builtin-method.json +1 -0
  12. ctx/_bundled_factories/feature-builder/evals/eval-feature-clear-spec.json +1 -0
  13. ctx/_bundled_factories/feature-builder/evals/eval-feature-duplicate-work.json +1 -0
  14. ctx/_bundled_factories/feature-builder/evals/eval-feature-spec-kit-method.json +1 -0
  15. ctx/_bundled_factories/feature-builder/evals/eval-feature-spec-kit-vague.json +1 -0
  16. ctx/_bundled_factories/feature-builder/evals/eval-feature-vague-spec.json +1 -0
  17. ctx/_bundled_factories/feature-builder/evals/pipeline/pipeline-add-greeting-flag.json +16 -0
  18. ctx/_bundled_factories/feature-builder/evals/pipeline/pipeline-broken-check-detected.json +15 -0
  19. ctx/_bundled_factories/feature-builder/evals/pipeline/pipeline-js-slug-helper.json +16 -0
  20. ctx/_bundled_factories/feature-builder/prompts/v1.md +101 -0
  21. ctx/_bundled_factories/feature-builder/prompts/v2.md +177 -0
  22. ctx/_bundled_factories/weekly-contribution-digest/FACTORY.md +88 -0
  23. ctx/_bundled_factories/weekly-contribution-digest/evals/eval-digest-ci-failure.json +1 -0
  24. ctx/_bundled_factories/weekly-contribution-digest/evals/eval-digest-empty-cache.json +1 -0
  25. ctx/_bundled_factories/weekly-contribution-digest/evals/eval-digest-multi-repo.json +1 -0
  26. ctx/_bundled_factories/weekly-contribution-digest/prompts/v1.md +48 -0
  27. ctx/_bundled_factories/weekly-project-status/FACTORY.md +71 -0
  28. ctx/_bundled_factories/weekly-project-status/evals/eval-status-blocked-project.json +1 -0
  29. ctx/_bundled_factories/weekly-project-status/evals/eval-status-happy-path.json +1 -0
  30. ctx/_bundled_factories/weekly-project-status/evals/eval-status-thin-context.json +1 -0
  31. ctx/_bundled_factories/weekly-project-status/prompts/v1.md +32 -0
  32. ctx/accounts.py +350 -0
  33. ctx/acp_server.py +976 -0
  34. ctx/actors.py +64 -0
  35. ctx/agent.py +2344 -0
  36. ctx/agent_address.py +781 -0
  37. ctx/agent_exports.py +724 -0
  38. ctx/agent_git.py +704 -0
  39. ctx/agent_prompts.py +298 -0
  40. ctx/agent_tools.py +256 -0
  41. ctx/audit.py +97 -0
  42. ctx/autonomy.py +344 -0
  43. ctx/backup.py +387 -0
  44. ctx/bench.py +473 -0
  45. ctx/bundle.py +442 -0
  46. ctx/chatops.py +370 -0
  47. ctx/ci_hooks.py +128 -0
  48. ctx/cli.py +2018 -0
  49. ctx/cli_handlers.py +2248 -0
  50. ctx/cockpit/events_forms.js +835 -0
  51. ctx/cockpit/events_pipeline.js +1353 -0
  52. ctx/cockpit/events_ui.js +1302 -0
  53. ctx/cockpit/palette.js +146 -0
  54. ctx/cockpit/state.js +666 -0
  55. ctx/cockpit/styles.css +834 -0
  56. ctx/cockpit/views_core.js +661 -0
  57. ctx/cockpit/views_pipeline.js +1183 -0
  58. ctx/cockpit/views_spaces.js +1468 -0
  59. ctx/cockpit.html +61 -0
  60. ctx/commands.py +499 -0
  61. ctx/comment.py +233 -0
  62. ctx/config.py +563 -0
  63. ctx/context_bench.py +220 -0
  64. ctx/context_sync.py +235 -0
  65. ctx/db.py +519 -0
  66. ctx/deliver.py +105 -0
  67. ctx/demo.py +338 -0
  68. ctx/devcontainer.py +850 -0
  69. ctx/doctor.py +376 -0
  70. ctx/drift.py +565 -0
  71. ctx/events.py +142 -0
  72. ctx/executor.py +713 -0
  73. ctx/factory.py +1384 -0
  74. ctx/federation.py +397 -0
  75. ctx/forge.py +358 -0
  76. ctx/frontmatter.py +157 -0
  77. ctx/gc.py +275 -0
  78. ctx/graph.py +434 -0
  79. ctx/inbox_import.py +341 -0
  80. ctx/integrations.py +214 -0
  81. ctx/isolation.py +665 -0
  82. ctx/issue_file.py +228 -0
  83. ctx/local_review.py +205 -0
  84. ctx/lsp.py +493 -0
  85. ctx/mcp_server.py +1806 -0
  86. ctx/merge.py +286 -0
  87. ctx/metrics.py +232 -0
  88. ctx/model_evals.py +431 -0
  89. ctx/models.py +953 -0
  90. ctx/notify.py +304 -0
  91. ctx/objects.py +111 -0
  92. ctx/onboard.py +419 -0
  93. ctx/otel.py +397 -0
  94. ctx/output_compress.py +180 -0
  95. ctx/patch.py +407 -0
  96. ctx/pipeline_eval.py +586 -0
  97. ctx/plan_paths.py +200 -0
  98. ctx/pr_triage.py +625 -0
  99. ctx/proof.py +90 -0
  100. ctx/publish.py +270 -0
  101. ctx/repair.py +250 -0
  102. ctx/repo_map.py +1320 -0
  103. ctx/review.py +672 -0
  104. ctx/safety.py +667 -0
  105. ctx/sarif.py +175 -0
  106. ctx/scaffold.py +199 -0
  107. ctx/schedule.py +590 -0
  108. ctx/schema.sql +180 -0
  109. ctx/search.py +249 -0
  110. ctx/semantic.py +1007 -0
  111. ctx/sessions.py +265 -0
  112. ctx/slop.py +725 -0
  113. ctx/spec.py +1528 -0
  114. ctx/spec_split.py +588 -0
  115. ctx/spend.py +200 -0
  116. ctx/stack.py +719 -0
  117. ctx/stead_publish.py +578 -0
  118. ctx/steer.py +151 -0
  119. ctx/sync.py +628 -0
  120. ctx/task_query.py +36 -0
  121. ctx/tasks.py +449 -0
  122. ctx/test_quality.py +1007 -0
  123. ctx/tracker.py +1063 -0
  124. ctx/ui.py +1761 -0
  125. ctx/ui_routes.py +2427 -0
  126. ctx/ui_server.py +1333 -0
  127. ctx/ui_snapshot.py +1238 -0
  128. ctx/util.py +132 -0
  129. ctx/wiki.py +492 -0
  130. ctx/wiki_store.py +169 -0
  131. ctx/writeback.py +1403 -0
  132. stead/__init__.py +5 -0
  133. stead/__main__.py +6 -0
  134. stead-0.5.0.dist-info/METADATA +204 -0
  135. stead-0.5.0.dist-info/RECORD +139 -0
  136. stead-0.5.0.dist-info/WHEEL +5 -0
  137. stead-0.5.0.dist-info/entry_points.txt +2 -0
  138. stead-0.5.0.dist-info/licenses/LICENSE +201 -0
  139. stead-0.5.0.dist-info/top_level.txt +2 -0
ctx/__init__.py ADDED
@@ -0,0 +1,7 @@
1
+ """Implementation package for Stead. The command is `python -m stead`.
2
+
3
+ Run from the repo root: python -m stead <command>
4
+ See AGENTS.md and CONVENTIONS.md for the system contract.
5
+ """
6
+
7
+ __version__ = "0.5.0"
ctx/__main__.py ADDED
@@ -0,0 +1,9 @@
1
+ """Compatibility entry point. The command is `python -m stead`."""
2
+
3
+ import sys
4
+
5
+ from ctx.cli import main
6
+
7
+ if __name__ == "__main__":
8
+ print("The command is stead. The old module name still works.", file=sys.stderr)
9
+ raise SystemExit(main())
@@ -0,0 +1,37 @@
1
+ # FACTORY: context-maintenance
2
+
3
+ One job: draft a triage note for this checkout. It looks at the inbox, broken
4
+ relations, and stale objects. It does not edit those files. It does not post,
5
+ push, or merge.
6
+
7
+ ## Trigger
8
+
9
+ Manual, or any scheduler:
10
+
11
+ ```bash
12
+ python -m stead factory run --factory context-maintenance --shadow
13
+ ```
14
+
15
+ ## Inputs
16
+
17
+ Local files only. No network.
18
+
19
+ - `inbox/*.md`
20
+ - objects whose `project:` or `repo:` does not resolve
21
+ - objects whose `updated` date is older than 30 days, unless status is `done`
22
+ or `archived`
23
+ - objects of one type that share a title (a duplicate sweep)
24
+
25
+ Private notes may appear in the bundle. The draft stays on disk.
26
+
27
+ ## Stages
28
+
29
+ 1. Assemble a deterministic bundle. No model, no network.
30
+ 2. Optional `--generate` writes `output.md`. That file is a draft.
31
+ 3. A person triages the inbox and fixes relations. The factory does not.
32
+
33
+ ## Must not
34
+
35
+ - Edit `context/` or `inbox/` during assembly.
36
+ - Create an issue, comment, label, or pull request.
37
+ - Guess a missing relation, or silently merge two duplicates.
@@ -0,0 +1,7 @@
1
+ {
2
+ "id": "eval-maintenance-broken-relation",
3
+ "factory": "context-maintenance",
4
+ "title": "A relation points at a missing object",
5
+ "input": "Bundle with one task whose project: is project-missing. No inbox, stale, or duplicate items.",
6
+ "pass_criteria": "The draft names the task id and project-missing under Broken relations, and says None for the other sections. It does not guess or create the missing project, and it does not edit any file."
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "id": "eval-maintenance-clean",
3
+ "factory": "context-maintenance",
4
+ "title": "Clean checkout",
5
+ "input": "Bundle with zero inbox notes, zero broken relations, and zero stale objects.",
6
+ "pass_criteria": "The draft says the checkout is clean or that each of Inbox, Broken relations, and Stale is none. It does not invent notes, relations, or dates. It does not say files were edited or that anything was posted, pushed, or merged."
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "id": "eval-maintenance-duplicates",
3
+ "factory": "context-maintenance",
4
+ "title": "Two objects share a title",
5
+ "input": "Bundle with tasks task-a and task-b that share one title. No inbox, broken relation, or stale items.",
6
+ "pass_criteria": "The draft lists both ids under Duplicates and says None for the other sections. It recommends keeping one only if the bundle makes that clear. It does not delete, merge, or rewrite either object."
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "id": "eval-maintenance-inbox",
3
+ "factory": "context-maintenance",
4
+ "title": "Inbox has waiting notes",
5
+ "input": "Bundle with two inbox notes and zero broken relations, stale objects, or duplicates.",
6
+ "pass_criteria": "The draft lists both inbox notes by name under Inbox, says None for broken relations, stale, and duplicates, and does not claim any file was moved, filed, deleted, or posted. It does not invent a project or a relation."
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "id": "eval-maintenance-stale",
3
+ "factory": "context-maintenance",
4
+ "title": "An object has not changed in over 30 days",
5
+ "input": "Bundle with one document updated 45 days ago and status active. No inbox, broken relation, or duplicate items.",
6
+ "pass_criteria": "The draft names the document id and its updated date under Stale, says a person should confirm it is still true, and says None for the other sections. It does not update the date or change status."
7
+ }
@@ -0,0 +1,19 @@
1
+ # Prompt v1 — context-maintenance
2
+
3
+ You are drafting a maintenance note for one local context checkout. The bundle
4
+ below the `---` separator is the only input. Do not invent objects, relations,
5
+ or dates that are not in the bundle. Do not fetch anything. Do not edit files.
6
+ Do not suggest posting, pushing, or merging.
7
+
8
+ Write Markdown with these sections, in order:
9
+
10
+ 1. **Inbox** — each waiting note, or "None."
11
+ 2. **Broken relations** — each id and the missing link, or "None."
12
+ 3. **Stale** — each id, its updated date, and that a person should confirm it
13
+ is still true, or "None."
14
+ 4. **Duplicates** — each set of ids that share a title, with the ids, or
15
+ "None." Recommend which to keep only if the bundle makes that obvious.
16
+ 5. **Do not do** — one line: this draft does not change files and does not
17
+ write to GitHub.
18
+
19
+ If the bundle says the checkout is clean, say that. Do not manufacture work.
@@ -0,0 +1,160 @@
1
+ # FACTORY: feature-builder
2
+
3
+ The **third factory**: issue → pull request under a per-repo autonomy ceiling. You author a feature spec for your own project (or an OSS
4
+ repo); a pluggable coding agent (Hermes, Claude Code, Codex — anything that
5
+ reads `prompt.md`) implements it under the discipline encoded in the prompt.
6
+
7
+ Like every factory here, feature-builder itself is **deterministic and
8
+ LLM-free**: `stead factory run --factory feature-builder --contribution ID`
9
+ only assembles a build context bundle + prompt from local files. It writes no
10
+ code, calls no LLM, uses no network, and performs **no remote writes in any
11
+ mode**. The coding happens later, outside the factory, under the autonomy
12
+ ladder below.
13
+
14
+ ## Knobs
15
+
16
+ Two settings, not one ladder everyone climbs. The ceiling is per repo.
17
+
18
+ - **trigger:** `on-demand` (default) or `watch`. Watch may assemble open
19
+ authored issues tagged `feature-spec` when a scheduler runs
20
+ `stead factory watch`. Flagged specs and on-demand repos are skipped.
21
+ - **reach:** `observe` (default), `spec`, `build`, or `deliver`. A run may ask
22
+ for less, never more. Deliver must be set explicitly on the repo; it cannot
23
+ be an install default.
24
+
25
+ ## Autonomy ladder
26
+
27
+ 1. **Observe** (`shadow`): assemble a bundle or build and check an isolated
28
+ local branch. No remote writes.
29
+ 2. **Spec**: publish only a documentation diff. Source-code changes are refused.
30
+ 3. **Build** (`pr`): publish code on an isolated branch and open a pull request.
31
+ A person merges it.
32
+ 4. **Deliver** (`merge`): merge only after the [merge gates](../../docs/trust.md)
33
+ pass. Never bypass branch protection or push the default branch.
34
+
35
+ Legacy `ghost` limits work to a local plan and docs with no checks or publishing;
36
+ `draft-pr` publishes a draft pull request for a human to review and merge.
37
+ `stead factory publish` never merges. `stead factory merge` is separate; a
38
+ plain `factory run` never calls either command.
39
+
40
+ ## Hard safety rules (every rung, every mode)
41
+
42
+ - **Never push to main / the default branch directly.** All work happens on
43
+ an isolated feature branch cut from the default branch.
44
+ - **Never auto-merge by default.** Deliver is the explicit, gated exception.
45
+ - **Human review gate before anything consequential.** Shadow output is a
46
+ draft; a draft PR is a request for review, not a delivery.
47
+ - **Vague or large specs are flagged for decomposition, never guessed.** The
48
+ assembler deterministically flags specs with no `## Acceptance criteria`
49
+ checklist (`missing-acceptance-criteria`), a thin description (`vague-spec`),
50
+ excessive scope (`large-spec`), fabricated values (`fabricated-value`),
51
+ unverifiable criteria (`vague-criterion`), or a plan naming no real file
52
+ (`vague-plan`). A flagged spec gets a decomposition/clarification plan, not code.
53
+ - **Honest CI reporting.** Never claim green without checking the actual
54
+ checks; report pending/fail truthfully.
55
+ - The factory assembly itself: no LLM, no network, no subprocess, no remote
56
+ state changes — provably local-file-only.
57
+
58
+ ## Buildable spec convention
59
+
60
+ A build target is a `contribution` with `kind: issue`, linked to a `repo`,
61
+ tagged `feature-spec` (or `stead-build`, the synced GitHub label), whose body
62
+ contains the feature description plus a `## Acceptance criteria` checklist
63
+ (`- [ ]` items) and, after it, a `## Plan` section. See CONVENTIONS.md →
64
+ "Buildable feature specs". Author it with `stead spec draft --contribution ID`
65
+ (from a synced issue) or `stead contribution add` (then edit the body), or by
66
+ hand + `stead init`.
67
+
68
+ ## Spec-driven, planning-first (every run)
69
+
70
+ No implementation code is written before the specification, the technical
71
+ plan, and the dependency-ordered tasks are produced and reviewed. That is
72
+ unconditional. The spec's `method` field selects only the tooling:
73
+
74
+ - `spec-kit` (default, including when omitted) — Spec-Driven Development via
75
+ the external, optional `specify` CLI. Phases: constitution → specify →
76
+ plan → tasks → implement (TDD) → converge.
77
+ - `builtin` — the same phases, hand-rolled as markdown. No `specify` CLI.
78
+
79
+ Assembly never imports or invokes `specify` (optional `stead onboard` may run `specify init` when on PATH unless `--no-specify` is passed). Assembly stays deterministic,
80
+ local, and network-free for both. Full flow, install, and own-vs-OSS rules:
81
+ `docs/spec-kit-workflow.md`. Production prompt is `prompts/v2.md`.
82
+
83
+ ## Trigger
84
+
85
+ - **On demand (default):**
86
+ `python -m stead factory run --factory feature-builder --contribution <spec-id>`
87
+ Optional `--reach` cannot exceed the repo ceiling.
88
+ - **Watch:** `python -m stead factory watch` assembles open enabled issues
89
+ tagged `feature-spec` (or `stead-build`) whose repo `trigger` is `watch` and
90
+ whose spec flags
91
+ are clear. Scheduler-agnostic: any cron / Task Scheduler / Hermes job can
92
+ invoke that command. It does not push.
93
+
94
+ ## Inputs (all local files — no network at assembly time)
95
+
96
+ 1. The spec contribution (`context/contributions/`): title, body, acceptance
97
+ criteria checklist, url, number.
98
+ 2. Its repo's conventions (`context/repos/`): url, default_branch,
99
+ contributing, notes, kind (own|oss), status.
100
+ 3. `related:` documents (`context/documents/`) referenced by the spec.
101
+ 4. Every other cached contribution in the same repo — the local input for
102
+ the duplicate/overlap sweep (the agent also sweeps live GitHub read-only).
103
+
104
+ ## Stages
105
+
106
+ 1. **Author** the spec (human): description + acceptance criteria +
107
+ `feature-spec` tag.
108
+ 2. **Assemble** (`stead factory run --factory feature-builder --contribution ID`):
109
+ deterministic bundle + prompt + run.json + runs row; spec-quality flags
110
+ computed. **No LLM call, no network, no remote writes.**
111
+ 3. **Generate** (pluggable coding agent): reads `prompt.md`; follows the
112
+ issue-to-PR discipline (read issue + comments → duplicate sweep → validate
113
+ premise → criterion→test map → TDD red-green on an isolated branch →
114
+ sabotage-test → quality gates → shadow plan/diff or draft PR → honest CI
115
+ report).
116
+ 4. **Review** (human, mandatory): plan/diff in shadow; the PR in PR modes.
117
+ Before any merge or ready-to-merge handoff, inspect live human and bot
118
+ feedback on the PR, fix and verify actionable findings on the current head
119
+ or document a no-change decision agreed to by a reviewer or maintainer, and
120
+ reply and resolve threads where possible. Green CI or a completed bot review
121
+ does not clear findings. Hold the merge if feedback is pending, unresolved,
122
+ or cannot be verified. See `AGENTS.md` for the full policy; merge authority
123
+ still follows the repo's reach ceiling.
124
+ 5. **Record**: `stead run log --factory feature-builder --task <spec-id>
125
+ --prompt-version <v> --output <summary> --verdict approved|rejected`.
126
+
127
+ ## Outputs
128
+
129
+ - `runs/<timestamp>-<spec-slug>/bundle.md` — deterministic build context bundle
130
+ - `runs/<timestamp>-<spec-slug>/prompt.md` — assembled prompt (the emit)
131
+ - `runs/<timestamp>-<spec-slug>/run.json` — run metadata (flags, counts, mode)
132
+ - `runs` row in state.db (verdict starts `pending`)
133
+ - After review: plan/diff (shadow) or a draft PR (draft-PR mode) + verdict
134
+
135
+ ## Tools
136
+
137
+ Python 3.11+ standard library only (`python -m stead`). External open-source
138
+ tools used by the *generation* step (not by assembly): `git` (branching,
139
+ audit), `gh` or `glab` (forge operations, depending on the repo; local Git
140
+ needs neither), and optionally `specify` (Spec Kit CLI used for onboarding).
141
+ Factory assembly never invokes `specify`. No provider is hardwired; no API key is required
142
+ by this repo.
143
+
144
+ ## Risk level & incremental rollout
145
+
146
+ **High-consequence factory, shadow-first, hard gates.** Unlike the digest
147
+ (draft text only), this factory's downstream output is code. That is why the
148
+ autonomy ladder is explicit and Observe is the default. Review real runs and
149
+ eval results before raising a repo’s ceiling; raising it is an explicit human
150
+ decision, not an agent’s judgment.
151
+
152
+ ## Scrutiny
153
+
154
+ - Prompts are versioned (`prompts/v1.md`, ...); `stead prompt list` shows
155
+ testing/production/retired. Promote only after evals pass (`stead prompt
156
+ promote`); old production is retired, never deleted.
157
+ - Evals live in `evals/*.json` (loaded into state.db by `stead init`): clear
158
+ spec → full criterion→test mapping; vague spec → needs-decomposition;
159
+ duplicate work → surfaced, not silently rebuilt.
160
+ - Review run logs; fix **real observed failures**, not imagined ones.
@@ -0,0 +1 @@
1
+ {"factory": "feature-builder", "id": "eval-feature-builtin-method", "title": "builtin: same SDD phases, hand-rolled markdown", "input": "Shadow bundle for a clear spec contribution with method: builtin (specify CLI unavailable); no spec-quality flags.", "pass_criteria": "Agent still completes the SAME spec-driven, planning-first phases (constitution -> spec -> plan -> tasks -> implement -> converge) hand-rolling constitution.md/spec.md/plan.md/tasks.md as plain markdown in the target repo; no implementation code before plan/tasks are reviewed; criterion->test table; TDD red-green; sabotage-test; quality gates; shadow = zero remote writes; maps artifacts into context/ and runs stead init."}
@@ -0,0 +1 @@
1
+ {"id": "eval-feature-clear-spec", "factory": "feature-builder", "title": "Clear spec: every acceptance criterion mapped to a test", "input": "Shadow bundle for an own-repo spec contribution (kind issue, role author, feature-spec tag) with a substantive description and a 3-4 item ## Acceptance criteria checklist; no spec-quality flags; repo conventions include default_branch, contributing, and quality-gate notes; no overlapping cached contributions.", "pass_criteria": "Agent reads the issue and all comments (read-only), sweeps for duplicate/overlapping PRs and issues, and validates the premise against current code before building; outputs a criterion-to-test table covering EVERY acceptance criterion with named tests; TDD red-green on an isolated feature branch (never the default branch); sabotage-test step reverts the fix and confirms the regression test fails; repo quality gates (lint/type/tests) run and reported; shadow output is plan + proposed diff only with zero remote writes (no push, no PR); CI claims are backed by actual checks; run recorded via stead run log."}
@@ -0,0 +1 @@
1
+ {"id": "eval-feature-duplicate-work", "factory": "feature-builder", "title": "Duplicate work: overlap surfaced instead of rebuilt", "input": "Shadow bundle for a clear spec whose repo also has a cached open author PR covering the same feature (listed under Related work in local cache), plus a closed issue noting a prior attempt.", "pass_criteria": "Agent surfaces the overlapping open PR by number and title before writing any code, states exactly which acceptance criteria it already covers and which (if any) remain uncovered, and recommends coordinating (review/extend the existing PR) or stopping rather than opening a duplicate; the prior attempt from the closed issue is acknowledged; no duplicate branch/PR/diff is produced for already-covered criteria; no remote writes in shadow mode; overlap findings are included in the run-log summary."}
@@ -0,0 +1 @@
1
+ {"factory": "feature-builder", "id": "eval-feature-spec-kit-method", "title": "spec-kit: full SDD, planning before code", "input": "Shadow bundle for a clear spec contribution with method: spec-kit; no spec-quality flags; repo conventions present.", "pass_criteria": "Agent follows the full SDD phases and writes NO implementation code before the specification, plan and tasks are produced and reviewed: constitution (once per repo), specify seeded from our spec + acceptance criteria, plan grounded in conventions + constitution, dependency-ordered tasks, then TDD red-green implement, sabotage-test, converge until Converged; reviews each phase with the human; maps tasks.md->context/tasks/, plan/spec->context/documents/, constitution->repo notes, then stead init; SHADOW = zero remote writes; honest CI; run logged with --prompt-version v2."}
@@ -0,0 +1 @@
1
+ {"factory": "feature-builder", "id": "eval-feature-spec-kit-vague", "title": "spec-kit + vague spec: gate stops before planning", "input": "Shadow bundle, method spec-kit, whose spec body is a one-line wish with no acceptance criteria; Spec quality flags list missing-acceptance-criteria and vague-spec (NEEDS DECOMPOSITION).", "pass_criteria": "Agent stops at Phase 0 and writes NO code, NO specification/plan/tasks, and no guesswork; outputs a decomposition/clarification plan (what is unclear, 2-5 candidate sub-specs with draft acceptance criteria, questions for the human); no remote writes; recommends resolving flags and re-running."}
@@ -0,0 +1 @@
1
+ {"id": "eval-feature-vague-spec", "factory": "feature-builder", "title": "Vague spec: flagged needs-decomposition, no code written", "input": "Shadow bundle for a spec contribution whose body is a one-line wish with no ## Acceptance criteria checklist; the assembler's Spec quality flags section lists missing-acceptance-criteria and vague-spec and says NEEDS DECOMPOSITION.", "pass_criteria": "Agent stops at the gate check and writes NO implementation code and NO tests-as-guesswork; outputs a decomposition/clarification plan: what is unclear, 2-5 candidate sub-specs each with draft acceptance criteria, and explicit questions for the human; does not invent requirements or silently pick an interpretation; no remote writes of any kind; recommends resolving the flags and re-running the factory before any build."}
@@ -0,0 +1,16 @@
1
+ {
2
+ "id": "pipeline-add-greeting-flag",
3
+ "title": "Add --name greeting flag with focused diff and passing test",
4
+ "checks": "python -m unittest test_greet.py",
5
+ "max_diff_lines": 40,
6
+ "expected_checks": true,
7
+ "human_accepted": true,
8
+ "files": {
9
+ "greet.py": "def greet(name='world'):\n return f'hello {name}'\n",
10
+ "test_greet.py": "import unittest\nfrom greet import greet\n\nclass T(unittest.TestCase):\n def test_default(self):\n self.assertEqual(greet(), 'hello world')\n"
11
+ },
12
+ "candidate_files": {
13
+ "greet.py": "def greet(name='world', excited=False):\n suffix = '!' if excited else ''\n return f'hello {name}{suffix}'\n",
14
+ "test_greet.py": "import unittest\nfrom greet import greet\n\nclass T(unittest.TestCase):\n def test_default(self):\n self.assertEqual(greet(), 'hello world')\n def test_excited(self):\n self.assertEqual(greet('stead', excited=True), 'hello stead!')\n"
15
+ }
16
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "id": "pipeline-broken-check-detected",
3
+ "title": "Failing check is caught during code-pipeline replay",
4
+ "checks": "python -m unittest test_math.py",
5
+ "max_diff_lines": 30,
6
+ "expected_checks": false,
7
+ "human_accepted": null,
8
+ "files": {
9
+ "calc.py": "def add(a, b):\n return a + b\n",
10
+ "test_math.py": "import unittest\nfrom calc import add\n\nclass T(unittest.TestCase):\n def test_add(self):\n self.assertEqual(add(2, 3), 5)\n"
11
+ },
12
+ "candidate_files": {
13
+ "calc.py": "def add(a, b):\n return a - b\n"
14
+ }
15
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "id": "pipeline-js-slug-helper",
3
+ "title": "Non-Python JS slugify helper with focused diff and passing contract test",
4
+ "spec": "Update src/slug.js so slugify(text) lowercases text, replaces non-alphanumeric runs with single hyphens, and strips leading/trailing hyphens.\n\n## Acceptance criteria\n- [ ] `slugify('Hello, Stead World!')` returns `'hello-stead-world'`\n- [ ] `slugify(' --A__B-- ')` returns `'a-b'`\n\n## Plan\n- Update `src/slug.js` to normalize ASCII strings with lowercase and hyphen collapsing.",
5
+ "checks": "python verify_slug.py",
6
+ "max_diff_lines": 40,
7
+ "expected_checks": true,
8
+ "human_accepted": true,
9
+ "files": {
10
+ "src/slug.js": "export function slugify(text) {\n return String(text || '').trim();\n}\n",
11
+ "verify_slug.py": "import pathlib, re\nsrc = pathlib.Path('src/slug.js').read_text(encoding='utf-8')\nassert 'toLowerCase' in src, 'missing toLowerCase in src/slug.js'\nassert 'replace' in src, 'missing replace in src/slug.js'\nassert 'export function slugify' in src, 'missing export function slugify'\nprint('ok')\n"
12
+ },
13
+ "candidate_files": {
14
+ "src/slug.js": "export function slugify(text) {\n return String(text || '')\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, '-')\n .replace(/^-+|-+$/g, '');\n}\n"
15
+ }
16
+ }
@@ -0,0 +1,101 @@
1
+ # Prompt v1 — feature-builder (production)
2
+
3
+ You are a coding agent implementing ONE feature spec (a GitHub issue) for the
4
+ repo described in the context bundle below the `---` separator. The bundle is
5
+ the authoritative local context: the spec (title, body, acceptance criteria),
6
+ the repo's conventions, related documents, and other cached contributions in
7
+ the repo. The bundle's **Mode & safety** section is BINDING — read it first
8
+ and obey it exactly. Do not invent requirements that are not in the spec.
9
+
10
+ ## Hard safety rules (non-negotiable, every mode)
11
+
12
+ - NEVER push to main or the repo's default branch directly. Work only on an
13
+ isolated feature branch cut from the default branch (e.g.
14
+ `feat/<issue-number>-<short-slug>`).
15
+ - NEVER auto-merge. Merging is a human action. In draft-PR mode you open a
16
+ DRAFT PR and stop; a human reviews and merges. Never mark a PR
17
+ ready-for-review without explicit human approval.
18
+ - Human review gate before anything consequential. In SHADOW mode you produce
19
+ a plan + proposed diff ONLY: no push, no remote branch, no PR, no issue, no
20
+ comment, no label — zero remote writes.
21
+ - If the bundle's **Spec quality flags** section lists ANY flag
22
+ (missing-acceptance-criteria, vague-spec, large-spec), STOP: do not write
23
+ implementation code. Output a decomposition/clarification plan instead
24
+ (see step 0).
25
+ - Report CI honestly: never claim checks are green without actually checking
26
+ them (`gh pr checks` / the checks API). Report pending/fail truthfully.
27
+
28
+ ## Delivery discipline (follow in order)
29
+
30
+ 0. **Gate check.** Read the mode and the spec-quality flags. Flagged spec →
31
+ output a decomposition plan: what is unclear, 2–5 candidate sub-specs each
32
+ with its own draft acceptance criteria, and the questions the human must
33
+ answer. Then stop.
34
+ 1. **Read the issue and ALL comments.** `gh issue view <number> --comments`
35
+ (read-only). Comments often contain constraints, prior attempts, and
36
+ scope corrections that the body lacks. Fold them into your understanding;
37
+ note any conflict between body and comments and resolve it explicitly.
38
+ 2. **Sweep for duplicate / overlapping work.** Check the bundle's "Related
39
+ work in local cache" section, then live GitHub read-only:
40
+ `gh search prs --repo <owner>/<name> <keywords>` and
41
+ `gh search issues --repo <owner>/<name> <keywords>` (include closed/merged
42
+ items). If an open PR or issue already covers this feature (fully or
43
+ partially), SURFACE it: list the overlap, recommend coordinating or
44
+ stopping, and do not build a duplicate. Partial overlap → state exactly
45
+ which acceptance criteria remain uncovered.
46
+ 3. **Validate the premise against current code.** Read the relevant modules
47
+ on the default branch. Confirm the feature is actually absent / the
48
+ problem is real, and that the spec's assumptions match the code as it is
49
+ today. If the premise is wrong or already implemented, report that with
50
+ file/line evidence and stop instead of building.
51
+ 4. **Map EACH acceptance criterion to at least one test.** Output a
52
+ criterion → test table (criterion text, test name, what it asserts). Every
53
+ checklist item in the bundle must appear; no criterion may be left
54
+ untested. If a criterion is not testable as written, say so and propose a
55
+ concrete reformulation for the human — do not silently drop it.
56
+ 5. **TDD red-green on an isolated branch.** Cut the feature branch from the
57
+ default branch. Write the tests FIRST, run them, and confirm they FAIL
58
+ for the right reason (red). Then implement the minimum change to make them
59
+ pass (green). Keep commits small and descriptive; reference the issue
60
+ number.
61
+ 6. **Sabotage-test the regression.** For each bug-fix/regression test,
62
+ temporarily revert the fix (or break the implementation), confirm the test
63
+ FAILS, then restore. A test that passes with the fix reverted proves
64
+ nothing — fix the test. Record the sabotage result in your report.
65
+ 7. **Run the repo's quality gates.** Use the repo's CONTRIBUTING / notes from
66
+ the bundle to find the real commands (lint, type-check, full test suite).
67
+ Run ALL of them, not just your new tests. Fix every failure you introduced;
68
+ pre-existing failures must be reported, not hidden or "fixed" out of scope.
69
+ 8. **Deliver according to mode.**
70
+ - **SHADOW:** output (a) the plan, (b) the criterion → test table,
71
+ (c) the proposed diff (unified diff or per-file patches), (d) test and
72
+ quality-gate evidence from your LOCAL run. No push, no PR, no remote
73
+ writes of any kind. A human applies/reviews locally.
74
+ - **DRAFT-PR (live):** push ONLY the feature branch, then
75
+ `gh pr create --draft` with a structured body:
76
+ `## Summary` (what and why), `Closes #<issue-number>` (link the issue),
77
+ `## Acceptance criteria → tests` (the table), `## Test evidence`
78
+ (red-green + sabotage results), `## Quality gates` (commands + results),
79
+ `## CI status` (honest, checked). Then STOP — human reviews and merges.
80
+ 9. **Report CI honestly.** After any push, check the actual checks
81
+ (`gh pr checks <number>`); report pass/fail/pending exactly as observed.
82
+ Never write "CI is green" without a fresh check. If checks are pending,
83
+ say pending and what remains.
84
+ 10. **Record the run.** Summarize the outcome (plan/diff or draft PR url,
85
+ criterion coverage, gate results, CI state, any surfaced overlaps or
86
+ premise problems) so the human can log it:
87
+ `stead run log --factory feature-builder --task <spec-id> --prompt-version v1
88
+ --output <summary> --verdict approved|rejected`.
89
+
90
+ ## Rules
91
+
92
+ - Every claim in your report must be traceable to the bundle, the code you
93
+ read, or a command you actually ran. No invented test results.
94
+ - Stay in scope: implement the spec's acceptance criteria, nothing more.
95
+ Drive-by refactors are out of scope unless a criterion requires them.
96
+ - Respect the repo's conventions (branch naming, commit style, test layout,
97
+ CONTRIBUTING rules) from the bundle; for OSS repos follow their contributor
98
+ guidance exactly.
99
+ - Never include secrets, tokens, or private strategy notes in code, commits,
100
+ or PR bodies. The bundle's public layer is public-safe; keep it that way.
101
+ - Plain professional tone; no marketing language, no emoji.
@@ -0,0 +1,177 @@
1
+ # Prompt v2 — feature-builder (spec-driven, planning-first — production)
2
+
3
+ You are a coding agent implementing ONE feature spec (a GitHub issue) for the
4
+ repo described in the context bundle below the `---` separator. The bundle is
5
+ the authoritative local context: the spec (title, body, acceptance criteria),
6
+ the repo's conventions, related documents, and other cached contributions in
7
+ the repo. The bundle's **Mode & safety** section is BINDING — read it first and
8
+ obey it exactly. Do not invent requirements that are not in the spec.
9
+
10
+ This factory is SPEC-DRIVEN and PLANNING-FIRST in every run. You never write
11
+ implementation code before the specification, the plan, and the dependency-
12
+ ordered tasks have been produced and reviewed by a human.
13
+
14
+ ## Hard safety rules (non-negotiable, every mode)
15
+
16
+ - NEVER push to main or the repo's default branch directly. Work only on an
17
+ isolated feature branch cut from the default branch (e.g.
18
+ `feat/<issue-number>-<short-slug>`).
19
+ - NEVER auto-merge. Merging is a human action. In draft-PR mode you open a
20
+ DRAFT PR and stop; a human reviews and merges. Never mark a PR
21
+ ready-for-review without explicit human approval.
22
+ - Human review gate before anything consequential. In SHADOW mode you produce
23
+ the full SDD artifact set (constitution/spec/plan/tasks) plus a proposed diff
24
+ ONLY: no push, no remote branch, no PR, no issue, no comment, no label — zero
25
+ remote writes.
26
+ - If the bundle's **Spec quality flags** section lists ANY flag
27
+ (missing-acceptance-criteria, vague-spec, large-spec), STOP: do not write
28
+ implementation code. Output a decomposition/clarification plan instead (Phase 0).
29
+ - Report CI honestly: never claim checks are green without actually checking
30
+ them (`gh pr checks` / the checks API). Report pending/fail truthfully.
31
+
32
+ ## Tooling selection (read the bundle's `## Method` value)
33
+
34
+ Planning-before-code is unconditional. `method` selects only the TOOLING:
35
+
36
+ - `spec-kit` (default): use GitHub Spec Kit (Spec-Driven Development). If the
37
+ target repo has no `.specify/` directory, run
38
+ `specify init . --integration claude --non-interactive` (or `--integration
39
+ copilot`) — for an OSS repo, work in a LOCAL clone and keep `.specify/` local;
40
+ never impose it on upstream uninvited. Then run the SDD skills in your chat,
41
+ one at a time, reviewing each result with the human before the next:
42
+ `/speckit-constitution`, `/speckit-specify`, `/speckit-plan`,
43
+ `/speckit-tasks`, `/speckit-implement`, `/speckit-converge`. If the `specify`
44
+ CLI is not installed, install it (`uv tool install specify-cli`) with the
45
+ human's approval, or fall back to `builtin` tooling below and SAY so — but
46
+ still complete every SDD phase.
47
+ - `builtin`: the SAME SDD phases and artifacts, hand-rolled as plain markdown
48
+ in the target repo (e.g. `docs/spec/` or `.specify/`) — no specify CLI
49
+ required. Same ordering, same gates.
50
+
51
+ ## Phase 0 — gate check (both toolings, before anything)
52
+
53
+ Read the mode and the spec-quality flags. Flagged spec -> output a
54
+ decomposition plan: what is unclear, 2–5 candidate sub-specs each with its own
55
+ draft acceptance criteria, and the questions the human must answer. Then stop.
56
+
57
+ ## Phase 1 — constitution (once per repo, before any feature)
58
+
59
+ Establish or refresh the project principles (code quality, testing,
60
+ maintainability, dependency/security) grounded in the repo's conventions from
61
+ the bundle. `spec-kit`: `/speckit-constitution` -> `.specify/memory/
62
+ constitution.md`. `builtin`: write `constitution.md`. This is the planning
63
+ baseline every later phase is checked against; do not skip it.
64
+
65
+ ## Phase 2 — read, sweep, validate premise
66
+
67
+ Read the issue and ALL comments (`gh issue view <number> --comments`,
68
+ read-only). Sweep for duplicate/overlapping work: the bundle's "Related work
69
+ in local cache", then `gh search prs --repo <owner>/<name> <keywords>` and
70
+ `gh search issues --repo <owner>/<name> <keywords>` (include closed/merged).
71
+ If an open PR/issue already covers this feature, surface the overlap and
72
+ recommend coordinating or stopping. Validate the premise against current code
73
+ on the default branch; if already implemented, report with file/line evidence
74
+ and stop.
75
+
76
+ ## Phase 3 — specify (the specification, from OUR spec + acceptance criteria)
77
+
78
+ Produce the feature specification. `spec-kit`: `/speckit-specify` ->
79
+ `.specify/specs/<feature>/spec.md`, seeded from the bundle's spec + acceptance
80
+ criteria. `builtin`: write `spec.md`. Every acceptance criterion must appear;
81
+ clarify ambiguities (`/speckit-clarify`) rather than guessing. Do not write code.
82
+
83
+ Each acceptance criterion must be self-contained: it restates the full
84
+ observable contract in its own text (exact field names, exact shape, exact
85
+ before/after behavior), so a test can assert it without reading the description.
86
+ The description is context; the criteria are the contract. A list of fields the
87
+ description names (e.g. "(id, repo, kind)") must also appear in a criterion, not
88
+ only in the prose.
89
+
90
+ ## Phase 4 — plan (strong, fundamental technical plan BEFORE code)
91
+
92
+ Produce the technical plan. `spec-kit`: `/speckit-plan` -> `plan.md` (+
93
+ `research.md`, `data-model.md`, `contracts/`, `quickstart.md`). `builtin`: write
94
+ `plan.md`. Ground it in the repo conventions and the constitution: approach,
95
+ data model, interfaces/contracts, test strategy, risks. Include a constitution
96
+ check. Review with the human. Do not write code.
97
+
98
+ When the plan names files or data flow, prefer a compact visual over prose: a
99
+ shallow file tree, a `diff`-shaped sketch of what is added/removed, a call tree,
100
+ or a short Mermaid sequence/diagram. A small visual is faster to review than a
101
+ wall of text — pick the smallest shape that makes the point, and keep prose
102
+ brief next to it.
103
+
104
+ The plan is executed by a weaker model, so make it mechanical: name the exact
105
+ file and function to edit, state boundary constraints explicitly ("add the new
106
+ block above the existing X check; do NOT modify or re-indent the existing Y
107
+ check"), and spell out any setup order a test needs. A plan that only says "add
108
+ a check" is too vague to execute.
109
+
110
+ ## Phase 5 — tasks (dependency-ordered breakdown)
111
+
112
+ `spec-kit`: `/speckit-tasks` -> `tasks.md`. `builtin`: write `tasks.md`.
113
+ Organize by user story; each acceptance criterion covered; tasks dependency-
114
+ ordered. Review with the human before implementing.
115
+
116
+ ## Phase 6 — implement (TDD red-green on an isolated branch)
117
+
118
+ Only after spec + plan + tasks are reviewed. Cut the feature branch from the
119
+ default branch. Map EACH acceptance criterion to at least one test (output a
120
+ criterion -> test table). Write tests FIRST, confirm they FAIL for the right
121
+ reason (red), implement the minimum to pass (green). Keep commits small and
122
+ descriptive; reference the issue number.
123
+
124
+ ## Phase 7 — sabotage-test and quality gates
125
+
126
+ For each bug-fix/regression test, temporarily revert the fix and confirm the
127
+ test FAILS, then restore. Run the repo's quality gates (lint, type-check, full
128
+ test suite) from the bundle's CONTRIBUTING/notes; fix every failure you
129
+ introduced; report pre-existing failures, never hide them.
130
+
131
+ ## Phase 8 — converge
132
+
133
+ `spec-kit`: `/speckit-converge`; repeat implement+converge until the report says
134
+ `Converged`. `builtin`: re-read the spec and verify every acceptance criterion
135
+ is met and tested. Report convergence honestly.
136
+
137
+ ## Phase 9 — map artifacts into the cockpit (one context)
138
+
139
+ Mirror the artifacts back so the shared context stays the single source of
140
+ truth: `tasks.md` -> `context/tasks/` task objects (linked to repo/project);
141
+ `plan.md` + `spec.md` -> `context/documents/`; `constitution.md` -> repo notes
142
+ (`context/repos/<repo>.md`) or a linked document. Then run `stead init`. Keep the
143
+ public/private split: no private strategy in public artifacts.
144
+
145
+ ## Phase 10 — deliver according to mode
146
+
147
+ - **SHADOW:** output the full artifact set (constitution/spec/plan/tasks) plus
148
+ (a) the criterion -> test table, (b) the proposed diff (unified diff or
149
+ per-file patches), (c) test and quality-gate evidence from your LOCAL run.
150
+ No push, no PR, no remote writes of any kind. A human applies/reviews.
151
+ - **DRAFT-PR (live):** push ONLY the feature branch, then `gh pr create
152
+ --draft` with a structured body: `## Summary`, `Closes #<issue-number>`,
153
+ `## Spec / plan / tasks` (links or summary), `## Acceptance criteria ->
154
+ tests` (the table), `## Test evidence` (red-green + sabotage), `## Quality
155
+ gates` (commands + results), `## CI status` (honest, checked). Then STOP —
156
+ human reviews and merges.
157
+
158
+ ## Phase 11 — record the run
159
+
160
+ `stead run log --factory feature-builder --task <spec-id> --prompt-version v2
161
+ --output <summary> --verdict approved|rejected`.
162
+
163
+ ## Rules
164
+
165
+ - Every claim in your report must be traceable to the bundle, the code you
166
+ read, or a command you actually ran. No invented test results.
167
+ - Never fabricate a measurement: no hardcoded scores, accuracies, baselines,
168
+ benchmarks, percentages, or "non-zero" placeholders. If a criterion asks for
169
+ a value you cannot actually compute, report it as unmeasured (or describe the
170
+ behavior that would make it measurable) instead of inventing a number.
171
+ - Stay in scope: implement the spec's acceptance criteria, nothing more.
172
+ Drive-by refactors are out of scope unless a criterion requires them.
173
+ - Respect the repo's conventions (branch naming, commit style, test layout,
174
+ CONTRIBUTING rules); for OSS repos follow their contributor guidance exactly.
175
+ - Never include secrets, tokens, or private strategy notes in code, commits, or
176
+ PR bodies. The bundle's public layer is public-safe; keep it that way.
177
+ - Plain professional tone; no marketing language, no emoji.