@guilhermednobre/agent-kit 0.1.0 → 0.3.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 (57) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/README.md +102 -47
  3. package/bin/cli.js +79 -38
  4. package/package.json +12 -4
  5. package/src/cli/tools.js +51 -0
  6. package/src/cli/wf.js +400 -0
  7. package/src/core/briefing.js +188 -0
  8. package/src/core/config.js +321 -0
  9. package/src/core/dag.js +103 -0
  10. package/src/core/engine.js +505 -0
  11. package/src/core/policy.js +145 -0
  12. package/src/core/report.js +104 -0
  13. package/src/core/states.js +59 -0
  14. package/src/core/store.js +60 -0
  15. package/src/core/verify.js +54 -0
  16. package/src/detect.js +6 -0
  17. package/src/generate.js +55 -0
  18. package/src/install.js +22 -14
  19. package/src/render.js +5 -7
  20. package/src/runtimes/index.js +24 -0
  21. package/src/runtimes/orca.js +61 -0
  22. package/src/runtimes/t3.js +87 -0
  23. package/src/trackers/index.js +34 -0
  24. package/src/trackers/linear-t3.js +138 -0
  25. package/src/trackers/linear.js +209 -0
  26. package/templates/AGENTS.md +111 -110
  27. package/templates/CLAUDE.md +185 -306
  28. package/templates/agent-kit/hooks/pretooluse.mjs +53 -0
  29. package/templates/agent-kit/hooks/session-context.mjs +41 -0
  30. package/templates/agent-kit/runtime/orca.md +68 -0
  31. package/templates/agent-kit/runtime/t3.md +109 -0
  32. package/templates/claude/commands/analisar-consistencia.md +111 -0
  33. package/templates/claude/commands/avaliar-ideia.md +63 -0
  34. package/templates/claude/commands/configurar-worker.md +116 -0
  35. package/templates/claude/commands/criar-prd.md +16 -1
  36. package/templates/claude/commands/criar-tasks.md +40 -3
  37. package/templates/claude/commands/criar-techspec.md +12 -1
  38. package/templates/claude/commands/executar-bugfix.md +11 -11
  39. package/templates/claude/commands/executar-qa.md +14 -15
  40. package/templates/claude/commands/executar-release.md +20 -0
  41. package/templates/claude/commands/executar-review.md +51 -31
  42. package/templates/claude/commands/executar-task.md +14 -23
  43. package/templates/claude/commands/executar-workflow.md +101 -0
  44. package/templates/claude/commands/fechar-ciclo.md +88 -0
  45. package/templates/claude/commands/replanejar-workflow.md +32 -0
  46. package/templates/claude/commands/retomar-workflow.md +30 -0
  47. package/templates/claude/commands/status-workflow.md +19 -0
  48. package/templates/claude/rules/README.md +2 -2
  49. package/templates/claude/settings.json +25 -0
  50. package/templates/claude/templates/bugs-template.md +2 -2
  51. package/templates/claude/templates/plan-template.json +33 -0
  52. package/templates/claude/templates/prd-template.md +65 -61
  53. package/templates/claude/templates/task-template.md +8 -8
  54. package/templates/claude/templates/tasks-template.md +1 -1
  55. package/templates/claude/templates/techspec-template.md +129 -129
  56. package/templates/claude/templates/worker-brief-template.md +11 -7
  57. package/templates/docs/agents/worker.md +94 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,49 @@
1
+ # Changelog
2
+
3
+ ## 0.3.0 — unreleased
4
+
5
+ ### Added
6
+
7
+ - Runtime-independent core (`src/core`): configuration and plan validation, task/workflow state
8
+ machine with history, DAG scheduler (dependencies, waves, `maxWorkers`, file ownership),
9
+ retry/escalation, coordinator takeover, blocked/unblock, replan, resume, completion criteria.
10
+ - `agent-kit wf` — the coordinator's workflow CLI: `new`, `next`, `dispatch`, `started`, `touch`,
11
+ `report`, `verify` (task and `--final`), `gate`, `review`, `lost`, `takeover`, `unblock`,
12
+ `cancel`, `replan`, `status`, `resume`, `complete`, `sync`, `list`.
13
+ - Self-contained, hashed briefs for implementers and validators.
14
+ - Worker and validator report protocols (`agent-kit-report`, `agent-kit-review`).
15
+ - Role pipeline (`.agent-kit/workflow.json`): PM → architect → dev → QA / system / UI/UX / security
16
+ gates → product owner → release on demand. Reviewer independence enforced.
17
+ - Model profiles per role (`fast`, `standard`, `advanced`, `validator`, `coordinator`).
18
+ - Runtime adapters: **T3 Code** (default; `delegate_task` calls with retry keys) and Orca (legacy
19
+ recipe), plus `registerAdapter` for new runtimes.
20
+ - Linear tracker, two ways: **through T3** (`via: "t3"`, default on T3 — no API key; the CLI prints
21
+ `create_issue` / `set_issue_state` / `comment_on_issue` calls, `wf tracker-bind` and
22
+ `wf sync --ack` close the loop; tested live) and **through the API** (`via: "api"` — sub-issues,
23
+ `blocks` relations, automatic sync, import with `wf new --from-linear`). Failures queue instead
24
+ of blocking.
25
+ - Autonomy policy (`.agent-kit/autonomy.json`) with protected-action categories, write protection,
26
+ `agent-kit policy check`, and a Claude Code PreToolUse hook enforcing it; SessionStart hook that
27
+ surfaces unfinished runs.
28
+ - Commands `/executar-workflow`, `/status-workflow`, `/retomar-workflow`, `/replanejar-workflow`,
29
+ `/executar-release`; autonomous mode in the planning commands; `plan.json` output in
30
+ `/criar-tasks`.
31
+ - `init --runtime t3|orca`, `--tracker local|linear`, `--linear-team`; `.agent-kit/` generation with
32
+ checks derived from the detected commands; Node `typecheck` detection.
33
+ - `agent-kit validate`, `agent-kit runtimes`.
34
+ - Docs: audit, architecture, autonomy, T3 runtime (with the real integration run), Linear,
35
+ migration.
36
+
37
+ ### Changed
38
+
39
+ - `CLAUDE.md` is runtime-neutral and imports `.agent-kit/runtime/<runtime>.md`; the Orca recipe
40
+ moved there.
41
+ - `docs/agents/worker.md` covers implementers and validators and the new report protocol.
42
+ - `/executar-review` became the gate command; `/executar-task` and `/executar-bugfix` no longer
43
+ depend on Orca; `/configurar-worker` configures profiles from the runtime's live catalogue.
44
+ - The template guard test now forbids model ids everywhere and tool names outside runtime-specific
45
+ files.
46
+
47
+ ## 0.2.0
48
+
49
+ - First session chooses the worker agent; shared, orchestrator and worker contracts split.
package/README.md CHANGED
@@ -1,75 +1,128 @@
1
1
  # @guilhermednobre/agent-kit
2
2
 
3
- Scaffolds a multi-agent development workflow into any repository: **Claude orchestrates,
4
- Antigravity (`agy`) workers implement**, supervised through Orca orchestration.
3
+ An autonomous, multi-agent development workflow for any repository. **Claude Opus coordinates;
4
+ secondary agents (Gemini via Antigravity by default) implement and validate**, on T3 Code or Orca,
5
+ with tasks tracked locally or in Linear.
5
6
 
6
7
  ```bash
7
8
  npx @guilhermednobre/agent-kit init
8
9
  ```
9
10
 
10
- Installed globally, the command is just `agent-kit`.
11
+ Give the coordinator an objective — *"Implement authentication with sign-up, login, password
12
+ recovery, tests and docs"* — and `/executar-workflow` takes it from spec to an accepted,
13
+ independently verified result, asking you only for decisions it cannot safely infer and for
14
+ protected actions (deploys, publishing, pushes, data deletion, credentials).
11
15
 
12
- ## What it writes
16
+ ## The pipeline
17
+
18
+ | # | Role | Runs on (default) | Output |
19
+ |---|---|---|---|
20
+ | 1 | Product manager | Coordinator (Opus) | Spec — *what* |
21
+ | 2 | Architect | Coordinator (Opus) | TechSpec, contracts, tasks, `plan.json` |
22
+ | 3 | Dev | `standard` / `fast` / `advanced` profiles | One slice per task |
23
+ | 4 | QA · System · UI/UX · Security | `validator` profile, in parallel | Gate verdicts; UI/UX only for `ui` tasks, Security only for `security` tasks |
24
+ | 5 | Product owner | `validator` profile | Last gate: every acceptance criterion |
25
+ | 6 | Release | Coordinator | Only when you order it |
26
+
27
+ Any rejected gate sends the task back to the dev with the findings. Retries escalate the model
28
+ (`fast → standard → advanced`); an exhausted budget hands the task to the coordinator, then to you.
29
+
30
+ ## What makes it autonomous (and not just prompts)
31
+
32
+ The Markdown contracts tell agents *how* to behave. The `agent-kit` CLI is the coordinator's
33
+ deterministic tool for *what* to do next, and it persists everything:
34
+
35
+ | Concern | Implemented by |
36
+ |---|---|
37
+ | Dependencies, waves, max workers, file ownership | `agent-kit wf next` (DAG scheduler) |
38
+ | Self-contained, reproducible briefs | `agent-kit wf dispatch` / `wf gate` (stored with a hash) |
39
+ | The exact runtime call | Runtime adapters: T3 `delegate_task` args, or the Orca command recipe |
40
+ | Independent verification | `agent-kit wf verify` runs the checks itself and records exit codes |
41
+ | Gates and reviewer independence | `agent-kit wf review --gate …` refuses the implementer as reviewer |
42
+ | Retry, escalation, fix cycles, timeouts | `.agent-kit/autonomy.json` + the workflow engine |
43
+ | Resume after interruption, no duplicate workers | `agent-kit wf resume` + idempotent `clientRequestId` |
44
+ | Definition of done | `agent-kit wf complete` refuses while a criterion is unmet |
45
+ | Protected actions | `.agent-kit/autonomy.json` + a Claude Code PreToolUse hook |
46
+ | Tracker | Local run files, or Linear issues kept in sync |
47
+
48
+ ## What `init` writes
13
49
 
14
50
  | Path | Purpose |
15
51
  |---|---|
16
- | `CLAUDE.md` | Orchestrator contract — roles, worker launch recipe, parallel worktrees, review and shutdown, bugfix loop, engineering rules |
17
- | `AGENTS.md` | Worker contract — what the worker owns, the `worker_done` protocol, stack constraints, definition of done |
18
- | `.claude/commands/` | Seven pipeline commands: `criar-prd`, `criar-techspec`, `criar-tasks`, `executar-task`, `executar-bugfix`, `executar-qa`, `executar-review` |
19
- | `.claude/rules/` | Engineering rules split into always-applicable principles and technology-conditional ones |
20
- | `.claude/templates/` | Document templates for PRD, TechSpec, tasks, bugs and worker briefs |
52
+ | `AGENTS.md` | Shared contract for every agent: project, stack, commands, engineering rules |
53
+ | `CLAUDE.md` | Coordinator contract; imports `AGENTS.md` and the runtime guide |
54
+ | `docs/agents/worker.md` | Worker contract (implementers and validators) and the report protocol |
55
+ | `.agent-kit/config.json` | Runtime, tracker, checks, model profiles, role → profile map |
56
+ | `.agent-kit/autonomy.json` | Limits, retry/escalation, permissions, protected actions, completion criteria |
57
+ | `.agent-kit/workflow.json` | Role pipeline and validation gates |
58
+ | `.agent-kit/runtime/<runtime>.md` | How each step maps onto T3 Code or Orca |
59
+ | `.agent-kit/hooks/` | Approval hook and session-context hook (no install needed) |
60
+ | `.claude/settings.json` | Wires the hooks into Claude Code |
61
+ | `.claude/commands/` | Pipeline commands (below) |
62
+ | `.claude/rules/`, `.claude/templates/` | Engineering rules; PRD, TechSpec, tasks, plan, bugs, brief templates |
21
63
 
22
64
  Existing files are never overwritten without `--force` or an explicit confirmation.
23
65
 
24
- ## Two modes
66
+ ## Commands (in Claude Code)
25
67
 
26
- `init` inspects the target directory and picks a mode. Override it with `--mode`.
27
-
28
- - **greenfield** — no dependency manifest found. The generated contracts state that the stack is
29
- an open user decision, and forbid Claude and workers from choosing one unilaterally.
30
- - **existing** — a manifest was found (`package.json`, `pyproject.toml`, `go.mod`, `Cargo.toml`,
31
- `pom.xml`, `Gemfile`, `composer.json`, `mix.exs`, and others). The contracts instead point at a
32
- commands table. For Node projects the table is prefilled from the actual `scripts` and lockfile;
33
- anything unknown is written as `TBD` rather than guessed.
68
+ | Command | Purpose |
69
+ |---|---|
70
+ | `/configurar-worker` | First session: pick a model per profile from the runtime's real catalogue, smoke-test, save |
71
+ | `/executar-workflow <objective>` | Full autonomous run |
72
+ | `/status-workflow`, `/retomar-workflow`, `/replanejar-workflow` | Inspect, resume, re-plan |
73
+ | `/executar-release` | Deploy — only on your explicit order |
74
+ | `/avaliar-ideia`, `/criar-prd`, `/criar-techspec`, `/criar-tasks`, `/analisar-consistencia` | Planning steps (interactive when used alone) |
75
+ | `/executar-task`, `/executar-bugfix` | Worker steps |
76
+ | `/executar-review`, `/executar-qa` | Gates |
77
+ | `/fechar-ciclo` | Lessons and changelog |
34
78
 
35
- ## Usage
79
+ ## CLI
36
80
 
37
81
  ```bash
38
- npx @guilhermednobre/agent-kit init [directory]
82
+ npx @guilhermednobre/agent-kit init [dir] [--runtime t3|orca] [--tracker local|linear --linear-team KEY]
83
+ [--mode greenfield|existing] [--name] [--description]
84
+ [--force] [-y] [--dry-run]
85
+ agent-kit validate [--plan tasks/prd-x/plan.json]
86
+ agent-kit policy check -- <command> # exit 3 = needs human approval
87
+ agent-kit policy check --path <file>
88
+ agent-kit runtimes
89
+ agent-kit wf help # the workflow commands the coordinator uses
39
90
  ```
40
91
 
41
- | Option | Effect |
42
- |---|---|
43
- | `--name <name>` | Project name written into the contracts |
44
- | `--description <text>` | One-line project description |
45
- | `--mode <mode>` | `greenfield` or `existing`, overriding detection |
46
- | `--force` | Overwrite existing files without asking |
47
- | `-y, --yes` | Non-interactive; skip files that already exist |
48
- | `--dry-run` | Print the plan, write nothing |
49
- | `-h, --help` | Show help |
50
- | `-v, --version` | Show version |
51
-
52
- Run without flags in a terminal and it prompts for name and description, and asks what to do about
53
- each file that already exists (skip, overwrite, or write a `.new` sibling).
92
+ `init` detects the mode: **greenfield** (no manifest: the stack is the user's decision) or
93
+ **existing** (manifest found; for Node, commands and checks come from the real `scripts` and
94
+ lockfile; anything unknown stays `TBD`).
54
95
 
55
- ## Language
96
+ ## Setup
97
+
98
+ 1. **Node 20+**.
99
+ 2. **Claude Code** with Claude Opus as the coordinator model.
100
+ 3. **T3 Code** (recommended runtime) with the providers you want enabled — e.g. **Antigravity** for
101
+ Gemini workers. `/configurar-worker` reads `orchestrator_capabilities`, so only models your
102
+ account really has are offered. Quotas are real: Google AI Pro does not mean unlimited API use;
103
+ tune `maxWorkers` and use the `fast` profile for cheap work.
104
+ 4. Optional **Linear**: `init --tracker linear`. On T3, connect the project to Linear in T3 and that
105
+ is all — the coordinator reaches Linear through T3's issue tools, no API key. On Orca (or to get
106
+ real sub-issues and import), use the API mode: `--linear-team ENG` and a personal key in
107
+ `LINEAR_API_KEY`. See [docs/linear.md](docs/linear.md).
108
+ 5. Run `npx @guilhermednobre/agent-kit init`, open Claude Code, run `/configurar-worker`, then
109
+ `/executar-workflow <objective>`.
56
110
 
57
- The contracts (`CLAUDE.md`, `AGENTS.md`) are in English. The commands, rules and document
58
- templates are in Portuguese, matching the workflow they came from. Change either after generating —
59
- nothing in the kit depends on the wording.
111
+ Orca stays supported: `init --runtime orca` writes the Orca guide and the legacy terminal recipe.
60
112
 
61
- ## Requirements
113
+ ## Documentation
62
114
 
63
- Node 20+ to run the generator. The workflow it scaffolds assumes Claude Code, and the worker half
64
- assumes the Antigravity CLI (`agy`) plus Orca; the documents are still readable and useful without
65
- them, but the launch recipe in `CLAUDE.md` section 2 is specific to that setup.
115
+ - [docs/architecture.md](docs/architecture.md) — layers, state machine, adapters, how to add a runtime
116
+ - [docs/autonomy.md](docs/autonomy.md) — every setting in `autonomy.json`, approvals, escalation
117
+ - [docs/runtime-t3.md](docs/runtime-t3.md) — T3 Code, Antigravity, model selection, the real integration test
118
+ - [docs/linear.md](docs/linear.md) — Linear as the shared task base for T3 and Orca
119
+ - [docs/migration.md](docs/migration.md) — upgrading a project from 0.2 (Orca-only)
120
+ - [docs/audit.md](docs/audit.md) — the audit of 0.2.0 that motivated this design
66
121
 
67
- ## After generating
122
+ ## Language
68
123
 
69
- 1. Read `CLAUDE.md` and fill in anything marked `TBD`.
70
- 2. In `existing` mode, verify the commands table actually runs.
71
- 3. Delete the rule files under `.claude/rules/` that do not match your project, and update
72
- `.claude/rules/README.md`.
124
+ Contracts (`AGENTS.md`, `CLAUDE.md`, `docs/agents/`, runtime guides) are in English. Commands, rules,
125
+ templates and briefs are in Portuguese.
73
126
 
74
127
  ## Development
75
128
 
@@ -77,7 +130,9 @@ them, but the launch recipe in `CLAUDE.md` section 2 is specific to that setup.
77
130
  npm test
78
131
  ```
79
132
 
80
- Zero runtime dependencies. Tests use the built-in `node:test` runner.
133
+ Zero runtime dependencies. Tests use the built-in `node:test` runner; runtimes and Linear are
134
+ exercised through mocks, and [docs/runtime-t3.md](docs/runtime-t3.md) describes the manual
135
+ integration test against a real T3 session.
81
136
 
82
137
  ## License
83
138
 
package/bin/cli.js CHANGED
@@ -6,6 +6,9 @@ import { fileURLToPath } from "node:url";
6
6
  import { resolve } from "node:path";
7
7
  import { detectProject } from "../src/detect.js";
8
8
  import { planFiles, installFiles } from "../src/install.js";
9
+ import { generatedFiles, normalizeInitChoices } from "../src/generate.js";
10
+ import { runWorkflowCommand } from "../src/cli/wf.js";
11
+ import { runValidate, runPolicy, runRuntimes } from "../src/cli/tools.js";
9
12
 
10
13
  const TEMPLATES_DIR = fileURLToPath(new URL("../templates/", import.meta.url));
11
14
  const PACKAGE_JSON = fileURLToPath(new URL("../package.json", import.meta.url));
@@ -14,6 +17,9 @@ const OPTIONS = {
14
17
  name: { type: "string" },
15
18
  description: { type: "string" },
16
19
  mode: { type: "string" },
20
+ runtime: { type: "string" },
21
+ tracker: { type: "string" },
22
+ "linear-team": { type: "string" },
17
23
  force: { type: "boolean", default: false },
18
24
  yes: { type: "boolean", short: "y", default: false },
19
25
  "dry-run": { type: "boolean", default: false },
@@ -22,44 +28,58 @@ const OPTIONS = {
22
28
  };
23
29
 
24
30
  const HELP = `
25
- agent-kit — scaffolds a Claude-as-orchestrator / agy-worker agent workflow.
31
+ agent-kit — scaffolds and runs an autonomous coordinator / worker workflow.
26
32
 
27
33
  Usage:
28
- npx @guilhermednobre/agent-kit init [directory]
29
-
30
- Options:
31
- --name <name> Project name written into CLAUDE.md and AGENTS.md
34
+ npx @guilhermednobre/agent-kit init [directory] [options]
35
+ agent-kit wf <command> ... workflow state for the coordinator (agent-kit wf help)
36
+ agent-kit validate [--plan <file>] validate .agent-kit configuration (and a plan)
37
+ agent-kit policy check -- <command> is this command allowed autonomously? (exit 3 = needs approval)
38
+ agent-kit policy check --path <p> is writing this path allowed?
39
+ agent-kit runtimes list runtime adapters
40
+
41
+ Init options:
42
+ --name <name> Project name written into AGENTS.md
32
43
  --description <text> One-line project description
33
44
  --mode <mode> greenfield | existing (default: auto-detected)
45
+ --runtime <runtime> t3 (default, recommended) | orca (legacy)
46
+ --tracker <tracker> local (default) | linear
47
+ --linear-team <KEY> Linear team key (needed only for Linear through the API, e.g. with Orca)
34
48
  --force Overwrite existing files without asking
35
49
  -y, --yes Non-interactive; skip files that already exist
36
50
  --dry-run Show what would be written, write nothing
37
51
  -h, --help Show this help
38
52
  -v, --version Show version
39
53
 
40
- Writes CLAUDE.md, AGENTS.md and .claude/{commands,rules,templates} into the
41
- target directory. Existing files are never overwritten without --force or a
42
- confirmation.
54
+ Writes AGENTS.md, CLAUDE.md, docs/agents/worker.md, .claude/{commands,rules,templates,settings.json}
55
+ and .agent-kit/ (config, autonomy policy, runtime guide, approval hook). Worker models are chosen
56
+ in the first Claude session (/configurar-worker). Existing files are never overwritten without
57
+ --force or a confirmation.
43
58
  `;
44
59
 
60
+ const SUBCOMMANDS = {
61
+ wf: runWorkflowCommand,
62
+ validate: runValidate,
63
+ policy: runPolicy,
64
+ runtimes: runRuntimes,
65
+ };
66
+
45
67
  async function main() {
46
- const { values, positionals } = parseArgs({
47
- options: OPTIONS,
48
- allowPositionals: true,
49
- });
68
+ const argv = process.argv.slice(2);
69
+ const sub = SUBCOMMANDS[argv[0]];
70
+ if (sub) return sub(argv.slice(1));
50
71
 
51
- if (values.help) return console.log(HELP.trim());
52
- if (values.version) return console.log(await readVersion());
72
+ const { values, positionals } = parseArgs({ args: argv, options: OPTIONS, allowPositionals: true });
73
+ if (values.help) return void console.log(HELP.trim());
74
+ if (values.version) return void console.log(await readVersion());
53
75
 
54
- const command = positionals[0];
55
- if (command && command !== "init") {
56
- console.error(`Unknown command: ${command}\n${HELP.trim()}`);
57
- process.exitCode = 1;
58
- return;
76
+ if (positionals[0] && positionals[0] !== "init") {
77
+ console.error(`Unknown command: ${positionals[0]}\n${HELP.trim()}`);
78
+ return 1;
59
79
  }
60
-
61
80
  const targetDir = resolve(positionals[1] || process.cwd());
62
81
  await runInit(targetDir, values);
82
+ return 0;
63
83
  }
64
84
 
65
85
  async function readVersion() {
@@ -70,27 +90,34 @@ async function readVersion() {
70
90
  async function runInit(targetDir, flags) {
71
91
  const detected = await detectProject(targetDir);
72
92
  const mode = resolveMode(flags.mode, detected.mode);
93
+ const choices = normalizeInitChoices(flags);
73
94
  const interactive = !flags.yes && process.stdin.isTTY;
74
95
 
75
96
  console.log(`Target: ${targetDir}`);
76
97
  console.log(`Mode: ${mode}${flags.mode ? " (forced)" : " (detected)"}`);
77
98
  if (detected.manifest) console.log(`Stack: ${detected.stack} (${detected.manifest})`);
99
+ console.log(`Runtime: ${choices.runtime}${choices.runtime === "orca" ? " (legacy)" : ""}`);
100
+ console.log(`Tracker: ${choices.tracker}${choices.linearTeam ? ` (team ${choices.linearTeam})` : ""}`);
78
101
  console.log("");
79
102
 
80
103
  const answers = await collectAnswers({ detected, flags, interactive });
81
- const vars = buildVars(detected, answers);
82
- const files = await planFiles(TEMPLATES_DIR);
104
+ const vars = buildVars(detected, answers, choices);
105
+ const files = [
106
+ ...(await planFiles(TEMPLATES_DIR, { runtime: choices.runtime })),
107
+ ...(await generatedFiles({ detected, answers, choices })),
108
+ ];
83
109
  const resolveConflict = makeConflictResolver(flags, interactive);
84
110
  const results = await installFiles({
85
111
  files,
86
112
  targetDir,
87
113
  mode,
88
114
  vars,
115
+ flags: [`runtime-${choices.runtime}`, `tracker-${choices.tracker}`],
89
116
  resolveConflict,
90
117
  dryRun: flags["dry-run"],
91
118
  });
92
119
 
93
- report(results, flags["dry-run"], mode);
120
+ report(results, flags["dry-run"], mode, choices);
94
121
  }
95
122
 
96
123
  function resolveMode(requested, detected) {
@@ -123,7 +150,7 @@ async function ask(rl, label, fallback) {
123
150
  return answer.trim() || fallback;
124
151
  }
125
152
 
126
- function buildVars(detected, answers) {
153
+ function buildVars(detected, answers, choices) {
127
154
  const commands = detected.commands;
128
155
  return {
129
156
  PROJECT_NAME: answers.name,
@@ -133,7 +160,9 @@ function buildVars(detected, answers) {
133
160
  CMD_BUILD: commands.build,
134
161
  CMD_TEST: commands.test,
135
162
  CMD_LINT: commands.lint,
163
+ CMD_TYPECHECK: commands.typecheck,
136
164
  CMD_TEST_ONE: commands.testOne,
165
+ RUNTIME: choices.runtime,
137
166
  };
138
167
  }
139
168
 
@@ -159,7 +188,7 @@ function decodeChoice(answer) {
159
188
  return "skip";
160
189
  }
161
190
 
162
- function report(results, dryRun, mode) {
191
+ function report(results, dryRun, mode, choices) {
163
192
  const counts = results.reduce((acc, result) => {
164
193
  acc[result.action] = (acc[result.action] || 0) + 1;
165
194
  return acc;
@@ -169,7 +198,7 @@ function report(results, dryRun, mode) {
169
198
  }
170
199
  console.log("");
171
200
  console.log(dryRun ? "Dry run — nothing was written." : summarize(counts));
172
- if (!dryRun) printNextSteps(mode);
201
+ if (!dryRun) printNextSteps(mode, choices);
173
202
  }
174
203
 
175
204
  function summarize(counts) {
@@ -177,19 +206,31 @@ function summarize(counts) {
177
206
  return parts.join(", ");
178
207
  }
179
208
 
180
- function printNextSteps(mode) {
209
+ function printNextSteps(mode, choices) {
210
+ const steps = [
211
+ "Open Claude Code here and run /configurar-worker to choose the worker models per profile.",
212
+ "Read AGENTS.md and fill in anything marked TBD.",
213
+ mode === "existing"
214
+ ? "Verify the commands table in AGENTS.md and the checks in .agent-kit/config.json actually run."
215
+ : "Decide the stack, then update AGENTS.md, the checks in .agent-kit/config.json and .claude/rules/README.md.",
216
+ "Review .agent-kit/autonomy.json (limits, permissions, protected actions).",
217
+ ];
218
+ if (choices.tracker === "linear" && choices.runtime === "t3") {
219
+ steps.push("Connect this project to Linear in T3 Code (Linear is reached through T3's issue tools; no API key needed).");
220
+ } else if (choices.tracker === "linear") {
221
+ steps.push("Export LINEAR_API_KEY (a Linear personal API key) before running workflows.");
222
+ }
223
+ steps.push("Start a full run with /executar-workflow <objective>.");
181
224
  console.log("");
182
225
  console.log("Next steps:");
183
- console.log(" 1. Read CLAUDE.md and fill in anything marked TBD.");
184
- if (mode === "existing") {
185
- console.log(" 2. Verify the commands table in CLAUDE.md actually runs.");
186
- } else {
187
- console.log(" 2. Decide the stack with your team, then update CLAUDE.md and rules/README.md.");
188
- }
189
- console.log(" 3. Drop the rule files under .claude/rules that do not match your project.");
226
+ steps.forEach((step, index) => console.log(` ${index + 1}. ${step}`));
190
227
  }
191
228
 
192
- main().catch((error) => {
193
- console.error(error.message);
194
- process.exitCode = 1;
195
- });
229
+ main()
230
+ .then((code) => {
231
+ if (typeof code === "number") process.exitCode = code;
232
+ })
233
+ .catch((error) => {
234
+ console.error(error.message);
235
+ process.exitCode = 1;
236
+ });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@guilhermednobre/agent-kit",
3
- "version": "0.1.0",
4
- "description": "Scaffolds a Claude-as-orchestrator / Antigravity-worker agent workflow into any repository",
3
+ "version": "0.3.0",
4
+ "description": "Autonomous multi-agent development workflow: Claude coordinates, secondary agents implement and validate, on T3 Code or Orca",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "agent-kit": "bin/cli.js"
@@ -10,7 +10,8 @@
10
10
  "bin",
11
11
  "src",
12
12
  "templates",
13
- "README.md"
13
+ "README.md",
14
+ "CHANGELOG.md"
14
15
  ],
15
16
  "engines": {
16
17
  "node": ">=20"
@@ -28,7 +29,14 @@
28
29
  "agents",
29
30
  "orchestration",
30
31
  "scaffold",
31
- "antigravity"
32
+ "agents-md",
33
+ "opencode",
34
+ "t3-code",
35
+ "antigravity",
36
+ "gemini",
37
+ "linear",
38
+ "workflow",
39
+ "autonomous-agents"
32
40
  ],
33
41
  "license": "MIT",
34
42
  "author": "Guilherme Damasceno"
@@ -0,0 +1,51 @@
1
+ import { parseArgs } from "node:util";
2
+ import { readFile } from "node:fs/promises";
3
+ import { resolve } from "node:path";
4
+ import { loadSettings, validateAutonomy, validateConfig, validateWorkflow } from "../core/config.js";
5
+ import { assertPlan } from "../core/engine.js";
6
+ import { classifyCommand, classifyWrite } from "../core/policy.js";
7
+ import { executionWaves } from "../core/dag.js";
8
+ import { listAdapters } from "../runtimes/index.js";
9
+
10
+ export async function runValidate(argv, { root = process.cwd(), out = console.log } = {}) {
11
+ const { values } = parseArgs({ args: argv, options: { plan: { type: "string" } }, allowPositionals: false });
12
+ const { config, autonomy, workflow, found } = await loadSettings(root);
13
+ const configResult = validateConfig(config);
14
+ const autonomyResult = validateAutonomy(autonomy, config);
15
+ const workflowResult = validateWorkflow(workflow, config);
16
+ const errors = [...configResult.errors, ...autonomyResult.errors, ...workflowResult.errors];
17
+ const warnings = [...configResult.warnings];
18
+ if (!found.workflow) warnings.push(".agent-kit/workflow.json not found; using the default role pipeline");
19
+ if (!found.config) warnings.push(".agent-kit/config.json not found; using defaults");
20
+ if (!found.autonomy) warnings.push(".agent-kit/autonomy.json not found; using defaults");
21
+ let waves;
22
+ if (values.plan) {
23
+ try {
24
+ const plan = JSON.parse(await readFile(resolve(root, values.plan), "utf8"));
25
+ assertPlan(plan);
26
+ waves = executionWaves(plan.tasks);
27
+ } catch (error) {
28
+ errors.push(error.message);
29
+ }
30
+ }
31
+ out(JSON.stringify({ valid: errors.length === 0, errors, warnings, waves }, null, 2));
32
+ return errors.length === 0 ? 0 : 1;
33
+ }
34
+
35
+ export async function runPolicy(argv, { root = process.cwd(), out = console.log } = {}) {
36
+ const { values, positionals } = parseArgs({
37
+ args: argv,
38
+ options: { path: { type: "string" } },
39
+ allowPositionals: true,
40
+ });
41
+ if (positionals[0] !== "check") throw new Error("Usage: agent-kit policy check -- <command> | --path <path>");
42
+ const { autonomy } = await loadSettings(root);
43
+ const verdict = values.path ? classifyWrite(values.path, autonomy) : classifyCommand(positionals.slice(1).join(" "), autonomy);
44
+ out(JSON.stringify(verdict, null, 2));
45
+ return verdict.decision === "allow" ? 0 : 3;
46
+ }
47
+
48
+ export async function runRuntimes(_argv, { out = console.log } = {}) {
49
+ out(JSON.stringify(listAdapters(), null, 2));
50
+ return 0;
51
+ }