@pavel.sommer/agiter 0.14.1-alpha.0 → 0.40.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/CHANGELOG.md +165 -0
  2. package/README.md +167 -82
  3. package/bin/agiter.mjs +467 -416
  4. package/defs/.agents.json +59 -48
  5. package/defs/{.models.drafter.json → .models.create-profile.json} +9 -11
  6. package/defs/{.models.author.json → .models.create-work.json} +1 -1
  7. package/defs/.models.review.json +9 -0
  8. package/defs/artifacts/checks.json +19 -12
  9. package/defs/artifacts/{create-epics.json → create-epic.json} +34 -25
  10. package/defs/artifacts/create-profile.json +24 -0
  11. package/defs/artifacts/create-tests.json +23 -0
  12. package/defs/artifacts/create-validation.json +27 -0
  13. package/defs/artifacts/create-work.json +25 -0
  14. package/defs/artifacts/decisions.json +13 -0
  15. package/defs/artifacts/draft.json +19 -18
  16. package/defs/artifacts/epic.json +18 -17
  17. package/defs/artifacts/idea.json +11 -10
  18. package/defs/artifacts/initiative.json +19 -18
  19. package/defs/artifacts/report.json +14 -12
  20. package/defs/artifacts/spec.json +20 -18
  21. package/defs/tasks/create-draft.json +1 -0
  22. package/defs/tasks/{create-epics.json → create-epic.json} +5 -1
  23. package/defs/tasks/create-initiative.json +1 -0
  24. package/defs/tasks/create-profile.json +22 -0
  25. package/defs/tasks/create-spec.json +1 -0
  26. package/defs/tasks/create-tests.json +15 -14
  27. package/defs/tasks/create-validation.json +20 -0
  28. package/defs/tasks/create-work.json +15 -13
  29. package/defs/templates/epic.md +32 -0
  30. package/defs/templates/initiative.md +44 -0
  31. package/index.mjs +35 -34
  32. package/package.json +45 -44
  33. package/src/agents.mjs +259 -160
  34. package/src/artifacts.mjs +274 -234
  35. package/src/defs.mjs +22 -0
  36. package/src/engine.mjs +1857 -831
  37. package/src/fake.mjs +44 -43
  38. package/src/frontmatter.mjs +113 -62
  39. package/src/git.mjs +260 -239
  40. package/src/links.mjs +55 -0
  41. package/src/models.mjs +197 -132
  42. package/src/pipeline.mjs +97 -94
  43. package/src/prompt.mjs +182 -133
  44. package/src/templates.mjs +50 -0
  45. package/src/tools.mjs +40 -34
  46. package/src/usage.mjs +177 -0
  47. package/defs/artifacts/work.json +0 -17
  48. package/src/roles.mjs +0 -22
  49. /package/defs/{.models.architect.json → .models.create-epic.json} +0 -0
  50. /package/defs/{.models.reviewer.json → .models.create-initiative.json} +0 -0
  51. /package/defs/{.models.worker.json → .models.create-tests.json} +0 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,165 @@
1
+ # Changelog
2
+
3
+ What changed for users of agiter, newest first. The versions published to npm are the
4
+ headings; the internal steps between them are listed under the release that brought them.
5
+ The reasoning behind each change is in `docs/design-recap.md`, section 19 ("Added in …").
6
+ The format follows [Keep a Changelog](https://keepachangelog.com/); the package is alpha,
7
+ so any minor version may change behaviour.
8
+
9
+ ## [Unreleased]
10
+
11
+ ### Breaking
12
+
13
+ - 0.32.0: the models are per task, not per role. The author of a task uses
14
+ `agiter/config/.models.<task>.json`, its reviewer `.models.<task>.review.json`, else
15
+ `.models.review.json`, else `.models.json`. The old role files (`.models.architect.json`, …)
16
+ still count until a run copies each to the files of its tasks; then delete them
17
+ (`agiter models --list` says which). `agiter roles --list` is gone: use
18
+ `agiter models --list`; the API's `roles` and `listRoles` became `models` and `listModels`.
19
+
20
+ ### Added
21
+
22
+ - 0.39.0: a spec's section "Scope" (`- write:`, `- tests:`, `- protected:`): a work may change
23
+ only its write paths (and the tests while no earlier step wrote them), never protected ones;
24
+ tests written by an earlier create-tests are frozen for the work. A spec without it works as before.
25
+ - 0.38.0: `agiter accept` lists what it could not check (a run not done, a work without review
26
+ or checks) and records it as waived.
27
+ - 0.37.0: `cost` is what was paid and `apiCost` the API price: on a subscription (an agent's
28
+ `"subscription": true`, or claude's own login by subscription) the cost is 0 and the API
29
+ price is kept; documents, your input file and `status` show both (`$0 (API $1.70)`).
30
+ - 0.37.0: claude streams (`--output-format stream-json --verbose`): its text and tools show as
31
+ they come, and each call records the subscription's five-hour and weekly limits and what it
32
+ added; the run shows the state at its end (an estimate: your own use at the time counts too).
33
+ - 0.36.0: `agiter accept <file>`: your input (an initiative, an epic) and every document made
34
+ from it, down the chain, get status `Accepted`; nothing runs from them any more.
35
+ - 0.36.0: `--profile` on `run` and `continue`, and `agiter profile [<run>]`: a model analyses
36
+ the run (time, cost, reviews, decisions, work, the harness) into `docs/<run>.profile.md`.
37
+ Its models: `agiter/config/.models.create-profile.json`.
38
+ - 0.36.0: a work without a review stops on a contradiction or an impossible criterion (its
39
+ "Open questions") instead of changing the criterion: the run is `blocked`, its changes are
40
+ kept aside, the question is in the decisions report; answered there, `continue` runs it again.
41
+ - 0.32.0: `agiter models --list`: the file, agent and models of each task's author and reviewer.
42
+ - 0.31.0: the task `create-validation` (named `validate` until 0.33.0): it reads any input
43
+ and says what a working prototype still needs (Missing, Unclear, Contradictions, a
44
+ verdict), without writing any of it. Alone (`--pipeline create-validation`) or first
45
+ (`create-validation,create-epics`: the next step takes the same input); the result is
46
+ published as `docs/<run>.validation.md`. Give it a cheap model in
47
+ `agiter/config/.models.create-validation.json`.
48
+ - 0.31.0: task definitions can carry `instructions`, `decides: false` and `passes`; an
49
+ artifact `publish: true` publishes a record.
50
+ - 0.30.0: `agiter new <type> [--name <name>]` writes a new document of yours (initiative,
51
+ epic) into the docs folder from a template; a project's `agiter/config/templates/<type>.md`
52
+ overrides the package's. Only "Goal" is required; the hints are HTML comments.
53
+ - 0.30.0: a section "Already decided" in your input: every step follows those decisions and
54
+ does not ask again, also in the runs on the epics made from it.
55
+ - 0.28.0: the decisions made earlier (the input's, and the earlier steps') reach every
56
+ author and reviewer; a silent contradiction is a blocking finding.
57
+ - 0.28.0: the owner's file shows the model and cost of the whole tree that grows from it
58
+ (the runs on its epics included).
59
+
60
+ ### Changed
61
+
62
+ - 0.36.0: a run whose last review is Block ends `blocked`, not `done`.
63
+ - 0.36.0: `select: "cheapest"` is refused as not supported; `effort` is passed only to an agent
64
+ whose definition says how, and is recorded as not applied otherwise.
65
+ - 0.34.0: the task `create-epics` is `create-epic`, like every other task and type; the
66
+ overview's files are `<run>.create-epic.<round>.md`, the models `.models.create-epic.json`.
67
+ The old name still works as an alias in pipelines, older runs and documents.
68
+ - 0.33.0: the task `validate` is `create-validation`, like every task that writes something;
69
+ its result is `docs/<run>.validation.md` (named by what the task gives), its models
70
+ `.models.create-validation.json`.
71
+ - 0.29.0: decisions inherited from the input (an epic's) are listed under "Inherited",
72
+ without an Answer, with a link to the parent run's report, where they are answered.
73
+ - 0.29.0: a default for autonomous decisions. The effort goes into the functional core of
74
+ the request; the look the input does not define (colours, sizes, spacing, fonts, focus and
75
+ hover styles, animation) is the author's. A project tightens or loosens this in
76
+ `agiter/config/project.md`.
77
+ - 0.29.0: a change of an earlier decision has the level of the decision it changes.
78
+
79
+ ### Fixed
80
+
81
+ - 0.40.0: a published document a reviewer or the profiler changed is put back (it was only
82
+ reported); the next model of a profile starts from the files as they were, agiter/config too.
83
+ - 0.40.0: a spec's Scope that is there but not understood stops the work instead of leaving it
84
+ the task's whole scope; a new spec with one is an invalid output.
85
+ - 0.40.0: each try of a check keeps its own log.
86
+ - 0.40.0: `agiter accept` counts only checks that passed after the work was written.
87
+ - 0.38.0: a reviewer or the profiler that changes files fails, and the files are put back,
88
+ also when its call fails and also in agiter/config and agiter/docs; the profiler had no guard.
89
+ - 0.38.0: a work stopped on several open questions runs again only when all are answered.
90
+ - 0.38.0: checks keep their output in a log and are killed with every process they started
91
+ when they run past their timeout.
92
+ - 0.36.0: a profile's next model starts from the files as they were before the failed one.
93
+ - 0.36.0: a reviewer that changes files fails its call; the files are put back.
94
+ - 0.36.0: a call past its timeout is killed with every process it started (a dev server, a
95
+ browser), on Windows too.
96
+ - 0.35.0: in a worktree run the agent CLI works in the worktree (it worked in the main
97
+ checkout, and the prompt's paths pointed there).
98
+ - 0.35.0: a model the profile tries after a failed one starts without the failed try's output.
99
+ - 0.35.0: a finding with an unknown severity ("critical", none) is blocking, never passed.
100
+ - 0.35.0: the criteria of draft, initiative and spec no longer ask the reviewer to treat every
101
+ decision the author made as a finding.
102
+
103
+ ## [0.27.0-alpha.0] - 2026-11-13
104
+
105
+ ### Added
106
+
107
+ - 0.15.0: methodical results are published to `docs/` (`<run>.<name>.md`, epics as
108
+ `<run>.epic.E1.md`), never over an existing file; agents never change published files.
109
+ - 0.16.0: autonomous decisions. The author decides where the input is silent and records
110
+ each decision as `[owner]` or `[author]`; the harness collects them into a decisions
111
+ report for the owner to answer.
112
+ - 0.17.0: the cost of a run, from the agents' structured output (opencode `--format json`,
113
+ claude `--output-format json`), per call and per run; `status` and `run --list` show it.
114
+ - 0.20.0: Tolaria relationships (`belongs_to`, `related_to`) in the run's notes.
115
+ - 0.21.0: `model` and `cost` in the frontmatter of every document a model call writes.
116
+ - 0.23.0: the owner's input file gets `has` (what runs made from it); 0.25.0 adds `model`
117
+ and `cost`. The edits are surgical and do not count as changes of his.
118
+ - 0.23.0: a new dependency is always the owner's decision.
119
+ - 0.26.0: the decisions report and the last report of each step are published to `docs/`.
120
+ - 0.27.0: the owner's answers in a decisions report reach the next run made from that
121
+ run's output by themselves (`agiter/runs/<run>/answers.md`, "The owner's answers").
122
+
123
+ ### Changed
124
+
125
+ - 0.15.0: frontmatter types are TitleCase and singular; since 0.18.0 every task record is
126
+ `type: Pipeline`, told apart by `task`. Old names stay readable as aliases.
127
+ - 0.15.0: versions of methodical artifacts and the input's copy are dot files; since 0.26.0
128
+ every chain report too.
129
+ - 0.22.0: an owner's input with a frontmatter `type` runs only with `status: Active`.
130
+ - 0.24.0: links in the body are wikilinks (`[[name]]`) instead of Markdown links (Tolaria
131
+ drops local Markdown links).
132
+ - 0.25.1: a decision is written as `<decision> Why: <reason>`; the report shows it as a
133
+ table with Decided, Because and Answer.
134
+ - 0.25.2: the author checks its result for unrecorded decisions before it finishes.
135
+
136
+ ## [0.14.1-alpha.0] - 2026-11-12
137
+
138
+ ### Added
139
+
140
+ - 0.11.0: isolation modes, `run --isolation <branch|worktree>`; the default works in the
141
+ current checkout with snapshot commits and makes no commits of its own.
142
+ - 0.12.0: the output language, `run --lang <tag>`.
143
+ - 0.13.0: `create-epics` breaks an initiative down into functional areas and epics, one
144
+ file per epic.
145
+ - 0.14.0: the owner's documents keep their own structure, types and statuses; run ids and
146
+ file names follow `<stamp>-<name>` and `<run>.<type>.<round>.md`.
147
+
148
+ ## [0.8.0-alpha.0] - 2026-11-11
149
+
150
+ The first usable release.
151
+
152
+ ### Added
153
+
154
+ - 0.3.0: inputs, artifacts, tasks and pipelines; rounds with versions and cumulative
155
+ reports; `continue`; a scripted fake executor for tests.
156
+ - 0.4.0: model profiles per role, agents in `agiter/config/.agents.json`, prompts and logs
157
+ per call, resuming the same scenario, `--new`.
158
+ - 0.5.0: the run's audit (`--audit`, `agiter audit`).
159
+ - 0.6.0: live output of a run (events, streaming call logs; `--quiet`, `--json`).
160
+ - 0.7.0: git isolation on a run branch with a commit per call; `agiter finish [--merge]`.
161
+
162
+ [Unreleased]: https://www.npmjs.com/package/@pavel.sommer/agiter
163
+ [0.27.0-alpha.0]: https://www.npmjs.com/package/@pavel.sommer/agiter/v/0.27.0-alpha.0
164
+ [0.14.1-alpha.0]: https://www.npmjs.com/package/@pavel.sommer/agiter/v/0.14.1-alpha.0
165
+ [0.8.0-alpha.0]: https://www.npmjs.com/package/@pavel.sommer/agiter/v/0.8.0-alpha.0
package/README.md CHANGED
@@ -1,82 +1,167 @@
1
- # agiter
2
-
3
- A client-agnostic harness for spec-driven agentic development. The design is in
4
- [docs/design-recap.md](docs/design-recap.md).
5
-
6
- A run's pipeline is always given explicitly: a comma list of tokens, or a pipeline file
7
- (`*.json`, `{ "steps": [...] }`). A token is `task` (one round, no review) or `task:N` (at most
8
- N rounds; each round is a version and its review report).
9
-
10
- The project's tech stack lives in `agiter/config/.stack.json` (blocks and presets, `agiter
11
- stack --help`); the harness puts into each model's prompt only what its role needs from it, then the owner's
12
- `agiter/config/project.md` (structure, naming, scaffolding, rules) for every role. `--includeFile
13
- <file>` (repeatable) gives any file to every model call of a run. `create-epics` breaks an initiative down into its functional areas and writes one epic file per
14
- epic (`<run>.create-epics.<round>.E1.md`, …) next to an overview. `--lang <tag>` (an ISO tag: `cs`, `en`,
15
- `cs-CZ`, `en-US`, …) sets the language of the output; without it the models write in the language
16
- of the input. The headings the harness reads stay in English, and so do established technical
17
- terms and common anglicisms.
18
-
19
- Status: step 1 (inputs, artifacts, tasks, pipelines, the run engine, simulation) and a first
20
- real executor: `agiter run` calls the agent CLI of each role's model profile
21
- (`agiter/config/.models.<role>.json`, `agiter/config/.models.json`, and the agents in `agiter/config/.agents.json`, all copied from the package's defaults by `agiter init` or the first run). In a git repository
22
- a run works in the current checkout by default (no harness commits; the owner reviews and
23
- commits the changes), with `--isolation branch` on its own branch `agiter/<run>` with a commit
24
- per call, or with `--isolation worktree` in `agiter/.worktrees/<run>` on that branch with the
25
- project's `node_modules` linked in. The scope of a step is checked against what git sees, and
26
- `agiter finish [--merge]` ends a branch or worktree run.
27
-
28
- ## Layout
29
-
30
- | Path | Content |
31
- | --- | --- |
32
- | `index.mjs` | the public API |
33
- | `bin/agiter.mjs` | the CLI on commander (`agiter --help`, `agiter <command> --help`) |
34
- | `sidecar.mjs` | JSON-RPC over stdio for long-lived clients (Far Manager) |
35
- | `src/` | the modules: definitions, pipelines, artifacts, engine, tools, log |
36
- | `defs/` | the package's artifact types, tasks, stack blocks and presets, default config |
37
- | `test/` | `npm test` (node:test, no dependencies) |
38
-
39
- The owner's documents stay his: any file a run did not write is an input in the owner's own form;
40
- the pipeline decides what it is (`create-epics`: an initiative), and its frontmatter, status and
41
- structure are not checked. A run is named after the input file without its leading timestamp and
42
- stamped in local time (`yyMMddHHmmss`); the titles of the outputs are the models' own.
43
-
44
- A project keeps everything in `agiter/`: `docs/<run>/` (the chain of each run), `runs/`,
45
- `logs/`, its own definitions (`artifacts/`, `tasks/`, merged over the package's) and
46
- `checks.json` (the required checks).
47
-
48
- ## A run's files
49
-
50
- ```text
51
- agiter/docs/<run>/<run>.md the input, copied as it is (never changed)
52
- agiter/docs/<run>/<run>.draft.1.md round 1 of create-draft:3
53
- agiter/docs/<run>/<run>.draft.1.report.md its review: Block or Done, cumulative
54
- agiter/docs/<run>/<run>.draft.2.md round 2: input + draft.1 + its report
55
- ...
56
- ```
57
-
58
- A version is Active when another step follows and it has no review or its report is Done;
59
- otherwise Draft. A step takes only prose or an Active artifact whose latest report is not
60
- Block. The state of a run is its files: `agiter continue` walks the steps again and repeats
61
- nothing done.
62
-
63
- ## Try it
64
-
65
- ```text
66
- agiter list tasks
67
- agiter plan --pipeline "create-draft:3,create-spec:2,create-work,checks" --text "Add a login form"
68
- agiter simulate --pipeline "create-draft:3,create-spec:2,create-work" --text "Add a login form" --script script.json
69
- agiter continue --root <project printed by simulate>
70
- ```
71
-
72
- A simulation script says what the fake model returns, per task, role and attempt:
73
-
74
- ```json
75
- {
76
- "steps": {
77
- "create-draft#1/review": { "findings": [{ "text": "Problem unclear" }] },
78
- "create-draft#2": { "responses": { "F-1": "fixed: Problem rewritten" } },
79
- "create-work": { "changes": ["src/login.js"] }
80
- }
81
- }
82
- ```
1
+ # agiter
2
+
3
+ A client-agnostic harness for spec-driven agentic development. The design is in
4
+ [docs/design-recap.md](docs/design-recap.md).
5
+
6
+ ## The key idea: diverse points of view
7
+
8
+ Every step of a run is done by separate agents, each starting with a fresh context: the author
9
+ writes, the reviewer judges what was written against the input and the criteria, without the
10
+ author's reasoning in view, so it has nothing to anchor on and no decision of its own to
11
+ defend. A next round's author gets its version and the review, not its earlier train of
12
+ thought. One long prompting session cannot give this: there a model judges its own work with
13
+ the whole path to it still in context, like a person proofreading what he wrote a minute ago.
14
+
15
+ Context diversity works with the same model too. Model diversity adds a second layer: a
16
+ model's blind spots come from its training, and a fresh context does not remove them, a
17
+ different model does. That is why every task has its own model files, one for its author
18
+ and one for its reviewer (`agiter/config/.models.<task>.json`, `.models.<task>.review.json`,
19
+ else `.models.review.json` for every reviewer, else `.models.json`): a cheap author and a
20
+ stronger reviewer of another family make a good pair. `agiter models --list` shows which file
21
+ each task's author and reviewer get.
22
+
23
+ ## How it works
24
+
25
+ A run's pipeline is always given explicitly: a comma list of tokens, or a pipeline file
26
+ (`*.json`, `{ "steps": [...] }`). A token is `task` (one round, no review) or `task:N` (at most
27
+ N rounds; each round is a version and its review report).
28
+
29
+ The project's tech stack lives in `agiter/config/.stack.json` (blocks and presets, `agiter
30
+ stack --help`); the harness puts into each model's prompt only what its task needs from it, then the owner's
31
+ `agiter/config/project.md` (structure, naming, scaffolding, rules) for every task. What the models may decide on their own follows a default (the effort goes into the functional
32
+ core of the request; the owner decides what the user gets and how it behaves, and every new
33
+ dependency; the look the input does not define is the author's); a section "Autonomous decisions" in `project.md`
34
+ tightens or loosens it for the project. `agiter new initiative --name <name>` (or `epic`) starts
35
+ a document of yours from a template (`agiter/config/templates/<type>.md` overrides the
36
+ package's); its section "Already decided" lists what you decided already, and no step asks
37
+ about it again. `agiter run --input <file> --pipeline create-validation` asks a model (give it a cheap one
38
+ in `.models.create-validation.json`) what a working prototype still needs from the input
39
+ (`docs/<run>.validation.md`),
40
+ before the expensive steps; `create-validation,create-epic` does both, the second on the same input. `--includeFile
41
+ <file>` (repeatable) gives any file to every model call of a run. `create-epic` breaks an initiative down into its functional areas and writes one epic file per
42
+ epic (`<run>.create-epic.<round>.E1.md`, …) next to an overview. `--lang <tag>` (an ISO tag: `cs`, `en`,
43
+ `cs-CZ`, `en-US`, …) sets the language of the output; without it the models write in the language
44
+ of the input. The headings the harness reads stay in English, and so do established technical
45
+ terms and common anglicisms.
46
+
47
+ Status: step 1 (inputs, artifacts, tasks, pipelines, the run engine, simulation) and a first
48
+ real executor: `agiter run` calls the agent CLI of each task's model profile
49
+ (`agiter/config/.models.<task>.json`, `.models.review.json`, `agiter/config/.models.json`, and the agents in `agiter/config/.agents.json`, all copied from the package's defaults by `agiter init` or the first run). In a git repository
50
+ a run works in the current checkout by default (no harness commits; the owner reviews and
51
+ commits the changes), with `--isolation branch` on its own branch `agiter/<run>` with a commit
52
+ per call, or with `--isolation worktree` in `agiter/.worktrees/<run>` on that branch with the
53
+ project's `node_modules` linked in. The scope of a step is checked against what git sees, and
54
+ `agiter finish [--merge]` ends a branch or worktree run.
55
+
56
+ A run that went through is `done`; one whose last review blocked, or whose work stopped on an
57
+ open question, is `blocked`. A worker without a review decides what the input leaves open, but
58
+ where the input contradicts itself or a criterion cannot be met as written it does not change
59
+ the criterion: it names the contradiction under "Open questions", the run stops, its changes go
60
+ aside as a patch, and the question waits in the decisions report; answered there, `agiter
61
+ continue` runs the work again with the answer. Give a work its review where you can
62
+ (`create-work:1`): a work without one is done, not checked. A spec's section "Scope" (`- write:`,
63
+ `- tests:`, `- protected:` paths) narrows what the work may change; tests an earlier `create-tests`
64
+ wrote are protected from the work (`create-tests,create-work:1,checks` for test-first). A reviewer that changes a file
65
+ fails its call (the file is put back); a profile's next model starts from the state before the
66
+ failed one; a call past its timeout is killed with every process it started.
67
+
68
+ Done is not accepted: `agiter accept <file>` is your word that a document (your initiative, an
69
+ epic) and everything made from it are what you want. It and every document of the runs on it,
70
+ down the chain, get status `Accepted`, and nothing runs from them any more. `--profile` (on
71
+ `run` and `continue`) has a model analyse the run when it ends, as an owner reviewing it would:
72
+ where the time and the money went, what the reviews found, which decisions are really yours,
73
+ what the work did beyond its spec, what the run shows about the harness; it is written to
74
+ `docs/<run>.profile.md` (`agiter profile [<run>]` does it for a run after the fact; its models
75
+ are `.models.create-profile.json`).
76
+
77
+ `cost` is what a call was paid, `apiCost` its price by the API list: on a subscription (an
78
+ agent's `"subscription": true` in `.agents.json`, or claude's own login by subscription) the
79
+ cost is 0 and the API price is kept for comparing. claude streams its output, and each call
80
+ records how much of the subscription's five-hour and weekly limits is used and what it added;
81
+ `status` shows the state at the end of the run.
82
+
83
+ ## Layout
84
+
85
+ | Path | Content |
86
+ | --- | --- |
87
+ | `index.mjs` | the public API |
88
+ | `bin/agiter.mjs` | the CLI on commander (`agiter --help`, `agiter <command> --help`) |
89
+ | `sidecar.mjs` | JSON-RPC over stdio for long-lived clients (Far Manager) |
90
+ | `src/` | the modules: definitions, pipelines, artifacts, engine, tools, log |
91
+ | `defs/` | the package's artifact types, tasks, stack blocks and presets, default config |
92
+ | `test/` | `npm test` (node:test, no dependencies) |
93
+
94
+ The owner's documents stay his: any file a run did not write is an input in the owner's own form
95
+ (with a frontmatter `type` it runs only with status `Active`; without one it runs as it is);
96
+ the pipeline decides what it is (`create-epic`: an initiative), and its frontmatter, status and
97
+ structure are not checked. A run is named after the input file without its leading timestamp and
98
+ stamped in local time (`yyMMddHHmmss`); the titles of the outputs are the models' own.
99
+
100
+ A project keeps everything in `agiter/`: `docs/<run>/` (the chain of each run), `runs/`,
101
+ `logs/`, its own definitions (`artifacts/`, `tasks/`, merged over the package's) and
102
+ `checks.json` (the required checks).
103
+
104
+ ## A run's files
105
+
106
+ ```text
107
+ agiter/docs/<run>/.<run>.md the input, copied as it is (never changed; a dot file)
108
+ agiter/docs/<run>/.<run>.draft.1.md round 1 of create-draft:3 (a dot file)
109
+ agiter/docs/<run>/.<run>.draft.1.report.md its review: Block or Done, cumulative (a dot file)
110
+ agiter/docs/<run>/.<run>.draft.2.md round 2: input + draft.1 + its report
111
+ agiter/docs/<run>/<run>.create-work.1.md the record of create-work
112
+ docs/<run>.draft.md the result of a step, published
113
+ docs/<run>.draft.report.md the step's last report, published
114
+ docs/<run>.decisions.md the decisions report, for the owner to answer
115
+ docs/<run>.epic.E1.md an epic of create-epic, published
116
+ ...
117
+ ```
118
+
119
+ Two kinds of output. Methodical artifacts (initiative, epic, draft, spec) are the documents a
120
+ next run builds on: the result of each step (no review, or its report Done) is published to
121
+ `docs/` (`agiter/config/.settings.json` `{ "docs": "<folder>" }` changes it), never over a
122
+ file there, and agents never change them. Task records (`create-epic`, `create-work`,
123
+ `create-tests`, `checks`) and the reports stay in `agiter/docs/<run>/` with every round; the versions of methodical
124
+ artifacts there are dot files, so a client like Tolaria shows each document once (in `docs/`).
125
+ Where the input does not say something, the models decide on their own and record it under
126
+ "Decisions" (`[owner]` or `[author]`); at the end of a run the harness collects them into
127
+ `docs/<run>.decisions.md` (beside the owner's documents), the owner's first, each with an `Answer:` line, so the
128
+ answered file can be the input of a next run.
129
+ A run on a document an earlier run wrote (an epic, a spec) gets that run's answered decisions in
130
+ its prompt by itself: they override the document where they differ.
131
+ Each document's frontmatter has the `model` that wrote it and the `cost` of that call.
132
+ Every model call's cost and tokens come from the agent's JSON output (opencode `--format json`,
133
+ claude `--output-format json`): `status` shows them per call and for the run, `run --list` per run.
134
+ At the end of a run the file names in its documents become wikilinks (`[[name]]`, as Tolaria
135
+ resolves them), to the notes in view: a version of the chain links to its published document.
136
+ Their frontmatter gets Tolaria's relationships too: `belongs_to` and `related_to` as wikilinks.
137
+ The owner's input file gets `has` (wikilinks to what runs made from it and keep), `model` (the
138
+ models they used) and `cost` (their total, over the whole tree that grows from it: the epics' runs too).
139
+ Every step gets the decisions made before it (the input's, the run's earlier steps') and keeps them.
140
+ Frontmatter types are TitleCase and singular (`Spec`, `Epic`, `Report`, `Decision`); every task's
141
+ record is `Pipeline`, its `task` (`create-epic`, `create-work`, …) tells which.
142
+
143
+ A version is Active when another step follows and it has no review or its report is Done;
144
+ otherwise Draft. A step takes only prose or an Active artifact whose latest report is not
145
+ Block. The state of a run is its files: `agiter continue` walks the steps again and repeats
146
+ nothing done.
147
+
148
+ ## Try it
149
+
150
+ ```text
151
+ agiter list tasks
152
+ agiter plan --pipeline "create-draft:3,create-spec:2,create-work:1,checks" --text "Add a login form"
153
+ agiter simulate --pipeline "create-draft:3,create-spec:2,create-work" --text "Add a login form" --script script.json
154
+ agiter continue --root <project printed by simulate>
155
+ ```
156
+
157
+ A simulation script says what the fake model returns, per task, role and attempt:
158
+
159
+ ```json
160
+ {
161
+ "steps": {
162
+ "create-draft#1/review": { "findings": [{ "text": "Problem unclear" }] },
163
+ "create-draft#2": { "responses": { "F-1": "fixed: Problem rewritten" } },
164
+ "create-work": { "changes": ["src/login.js"] }
165
+ }
166
+ }
167
+ ```