agengo 0.0.0-stage → 0.4.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.
package/.gitignore ADDED
@@ -0,0 +1,2 @@
1
+ /node_modules
2
+
package/CHANGELOG.md ADDED
@@ -0,0 +1,77 @@
1
+ # Changelog
2
+
3
+ ## 0.4.0
4
+
5
+ ### Added
6
+ - **Project principles for the spec and plan agents.** `agengo init` creates `.agengo/principles.md`, a short template for the project's stack, commands, conventions and what agents must never do, and never overwrites it afterwards. `agengo spec` and `agengo plan` send it, without its guidance comments, as `principles`, so the agents use the project's own test commands and conventions instead of inferring them from the repository, and ask nothing it already settles. An empty template is ignored, and a file longer than 32 KiB is rejected. The skill offers to fill it from the repository and writes it only after the user agrees.
7
+ - **Plans record the planner's assumptions.** The planner now lists each choice the goal, spec and principles left open (a storage format, a library, a default) with its impact and what would change if it is wrong, and `plan --brief` shows the high and medium ones next to the tasks, so the approver sees what was guessed before a run spends money. Plans store them as `assumptions`; they do not change the run.
8
+ - **Planner questions about a spec go back into the spec.** With `--spec`, the planner now decides technical and verification matters itself: when part of the result cannot be checked where the agents run (such as a Windows program built on Linux), it plans automated checks for the rest and says in the task goal what the user must check by hand, and it asks only when the answer would change scope or acceptance, in plain words. A `--spec` draft that still has questions now exits with code `2` and lists them on stderr with the next step, instead of failing later at `run`. The new `agengo spec spec.yaml --decision "<text>"` records such an answer as a clarification with a fresh `Q-n` ID, revises the spec in one more round and clears its approval, so the approved spec stays the single record of decisions; `--context` remains for answers that change nothing the user gets. The `specify` role now recommends options whose result can be checked automatically in the user's environment and notes in `feasibility` what can only be checked by hand. The skill relays remaining planner questions to the user in plain words through `AskUserQuestion` and records the answers with `--decision`.
9
+ - **`agengo plan --spec` traces plans to the approved spec.** The planner sees only the chosen stories (`--stories`, default P1) and their requirements; each acceptance criterion carries `refs` to the requirements (`FR-n`) and success criteria (`SC-n`) it checks, and the plan records `spec: {path, digest, stories}`. Whenever a plan with a spec is drafted, validated, run, amended or replaced, agengo checks it: the spec must be the approved version the plan was drafted from (C0), refs must exist (C1), and every requirement of the chosen stories must be checked by some criterion (C2); refs to other stories (C3) and criteria without refs (C4) are warnings. A run keeps a copy of the spec, Builders and Reviewers receive the relevant requirements, success criteria and out-of-scope items as `context.spec`, and `status` shows the spec. The skill now plans from the spec instead of passing it as `--context`. Plans without a spec are unchanged; drafts without one still get plain-text criteria.
10
+ - **`agengo spec` turns a rough idea into an approved spec before any plan is drafted.** A one-line goal left the planner guessing, and the guesses were invisible. The new read-only `specify` role writes `spec.yaml`: problem, actors, prioritized user stories with scenarios, requirements `FR-n`, measurable success criteria `SC-n`, what is out of scope, and assumptions with what changes if they are wrong. It asks only questions whose answers change the result, each with a reason, 2–4 options with their consequences and a recommendation, and never asks about technology. agengo enforces the limits itself: invalid questions are dropped, at most 5 stay open, IDs `Q-n` are never reused, and round 3 (or `--proceed`) turns what is left into assumptions. `--depth quick|deep` lowers these ceilings to 3 questions over 2 rounds or raises them to 8 over 4; the skill picks the depth from the conversation. Answer with `--answer Q-n=KEY|yes|"own words"`; answers are kept under `clarifications`. `--approve` checks readiness (no open high-impact question, a P1 story, scenarios, requirements, success criteria, out-of-scope items) and locks the spec with a SHA-256 digest that any later edit invalidates. Exit code `2` means questions are waiting, as for `run`. The agengo skill installed by `agengo init` now settles rough ideas this way: it asks each question through the agent's multiple-choice prompt (`AskUserQuestion` in Claude Code, with the recommendation first and the agent's own free-text option for other answers), and leaves the answers and the approval to the user. A roles file without a `specify` role uses the built-in one. Inspired by the `specify` and `clarify` steps of GitHub's MIT-licensed [Spec Kit](https://github.com/github/spec-kit). Design: [docs/design/spec-stage.md](docs/design/spec-stage.md).
11
+ - **Reliability figures in `agengo metrics`, and `agengo metrics --all`.** `metrics ID` now adds a `reliability` object (a `[RELIABILITY]` block in text output): tasks reviewed, first-review pass count and rate, review rounds (mean and max), build attempts per integrated task, gate and review failures, findings by state and severity, and per-model attempts, cost and first-review pass rate, crediting each task to the model of its first build attempt. `metrics --all` lists every run in the state database with a combined row and per-model rows, so agents and models can be compared across runs. A rate whose denominator is 0 is omitted from the JSON and shown as `n/a`. Figures are read from existing tables; the state database schema is unchanged. Definitions are in the [user guide](docs/guide.md#metrics).
12
+ - **Finding verification** (`quality.verify_findings: true`). When a Reviewer requests changes, a verifier agent tries to refute each new `critical` or `high` finding at the same commit. Only a refutation with confidence of at least 0.8 clears a finding, which is then kept as `advisory` with the verifier's reasoning; an unsure verdict or a verifier failure keeps it blocking. When every blocking finding is refuted, the review counts as a pass and the task does not go back to the Builder. Applies to task reviews and the whole-branch review. Custom adapters receive a new `verify` role only when the option is on; a roles file without a `verify` role uses the built-in verifier. Adapted from the adversarial verification step in the MIT-licensed [ECC](https://github.com/affaan-m/ECC) review workflow.
13
+ - **`agengo init` teaches the agents in a repository when to call agengo.** It installs the agengo skill in `.claude/skills/agengo/` (Claude Code) and `.agents/skills/agengo/` (Codex and other agents that read that folder), and adds a short marked section to `AGENTS.md` (skip it with `--no-agents-md`). Before this, an agent working in the repository had no way to know agengo existed, so it built multi-task work in the chat itself. The skill also tells agents to report an agengo failure instead of quietly doing the tasks themselves. Re-running `init` refreshes the files and leaves the rest of `AGENTS.md` alone.
14
+ - **`--auth subscription|api` on `run` and `plan`, default `subscription`.** Claude Code and Codex bill an API key in the environment ahead of the logged-in subscription, so a stray `ANTHROPIC_API_KEY` or `OPENAI_API_KEY` (common inside other agents and CI shells) silently switched runs to API billing or made them fail authentication. In `subscription` mode agengo removes `ANTHROPIC_API_KEY`, `ANTHROPIC_AUTH_TOKEN`, `OPENAI_API_KEY`, `CODEX_API_KEY`, `GEMINI_API_KEY` and `GOOGLE_API_KEY` from every agent's environment, custom adapters included; `CLAUDE_CODE_OAUTH_TOKEN` is kept. Use `--auth api` to pass keys through as before. The mode is stored with the run, so `resume` uses it too; runs started by earlier versions keep passing keys through.
15
+ - **agengo builds and runs natively on Windows** (x64, MSVC toolchain), without WSL. Releases include a Windows x64 binary, installed by npm or the new PowerShell installer, and CI runs on Windows too. Commands now run with one reader thread per pipe instead of `poll`, on every platform. On Windows each command starts suspended in a Job Object, so a timeout, Ctrl+C or a lingering background process stops everything it started, as the process group does on Unix. `claude`, `--agent` and the first word of `verify`/`setup` commands are looked up with `PATHEXT`, so `claude.cmd` (npm) and `npm.cmd` work; a custom adapter on Windows must be an `.exe`, `.cmd` or `.bat`. Worktrees default to `%LOCALAPPDATA%\agengo\worktrees`, and agengo's Git commands enable `core.longpaths`. Design: [docs/design/windows-support.md](docs/design/windows-support.md).
16
+ - **Authentication failures become an `action` request that says how to log in.** Besides "not logged in", agengo now recognizes invalid or missing API keys, expired OAuth tokens, `401 Unauthorized` and low credit balances, from Claude Code and from custom adapters (for example one wrapping `codex exec`), instead of reporting a generic agent crash.
17
+
18
+ ### Changed
19
+ - **Review findings have a severity, and only `critical` and `high` findings block.** The Reviewer now rates each finding `critical`, `high`, `medium` or `low`. `medium` and `low` findings are stored as `advisory`, shown in `status --json`, and no longer send the task back to the Builder, so a review can pass with them. Adapters that omit `severity` keep the old behavior: their findings count as `high`. This also applies to the whole-branch review, where reuse findings that only suggest sharing code are now `medium`.
20
+ - **Sharper review instructions.** The Reviewer reads the code around each change, reports only findings it is confident about with evidence, merges repeats of one root cause into one finding, skips style and unchanged code, and checks for silent failures (swallowed errors, fallbacks that hide failures) and security problems. The guidance is adapted from the MIT-licensed [ECC](https://github.com/affaan-m/ECC) reviewer agents.
21
+ - **Build candidates are pinned under `refs/agengo/builds/<run>/<attempt>`** instead of `refs/agent-flow/builds/…`, matching the project name. Refs left by 0.3.x are moved automatically by the next command that works on runs (`run`, `resume`, `respond`, `status`, `clean`, …), so paused runs resume with the same candidates. The state directory `.git/agent-flow/` keeps its name.
22
+ - **Agent replies are checked when they arrive.** Requests and replies are typed (`src/agent.rs`): a reply with an unknown `status` or `blocker.kind`, a non-string `summary`, or a field of the wrong type becomes an incident whose message names the field (for example `invalid agent reply: unknown variant "finished"`), instead of failing later with a generic error or being read as `null`. Missing lists still count as empty and unknown fields are still ignored. Stored requests from earlier versions are read unchanged.
23
+ - **Internal:** plans and tasks are now typed Rust structs (`src/plan.rs`) instead of `serde_json::Value` read by string keys, so a misspelled field is a compile error rather than a silently empty list (which, for `verify`, would have skipped the checks). The stored and transmitted JSON is unchanged; a task id missing from the plan is now an error instead of an empty task.
24
+ - Repository hooks no longer run during agengo's own merges and worktree operations. Hooks still run for Git commands the agents themselves execute.
25
+ - A setup command that installs hooks or changes Git configuration (for example husky or pre-commit) stops the run once with an `action` request; resuming accepts the change.
26
+
27
+ ### Security
28
+ - **An agent could plant Git hooks or configuration that ran outside its worktree.** Worktrees share `hooks/` and `config` with your repository, so a Builder could install, say, a `post-checkout` hook that agengo's next `git worktree add` (and your own Git commands later) would run. agengo's Git commands now run with `core.hooksPath=/dev/null` and `core.fsmonitor=false`. During a run, agengo also records the repository's `config`, `config.worktree`, `hooks/` and `info/attributes`; if an agent attempt or a check changes them, the result is rejected and the task waits for an `action` request.
29
+ - agengo warns when one of your branches or tags moves while agents are running.
30
+ - **The bundled SQLite is updated to 3.54** (`rusqlite` 0.43, `libsqlite3-sys` 0.40) for [RUSTSEC-2026-0459](https://rustsec.org/advisories/RUSTSEC-2026-0459) (CVE-2026-119375): earlier SQLite could return uninitialized memory when it opened a database together with a crafted `-wal` file. agengo opens only its own state database in `.git/agent-flow/`, so exposure needed someone who could already write there. CI now checks dependencies against the RustSec advisory database with `cargo-deny`.
31
+
32
+ ### Fixed
33
+ - **Piping agengo into a command that stops reading early (`agengo status demo | head`) no longer prints a panic.** agengo now exits quietly with status 141, the code shells report for a closed pipe.
34
+ - After `agengo spec --decision`, the spec header said "round 3 of 2"; rounds added after the interview now read "round 3, after the interview".
35
+ - **Build artifacts left by tests no longer block tasks in repositories without a `.gitignore`.** A Builder or Reviewer that ran `python3 -m unittest` left `__pycache__/*.pyc` behind, so the build was rejected with "files outside owns" and the review with "worktree has uncommitted changes". When agengo captures a build and checks that a worktree is clean, it now also ignores untracked `__pycache__/`, `*.py[cod]`, `.pytest_cache/`, `.mypy_cache/`, `.ruff_cache/`, `node_modules/`, `.DS_Store` and `Thumbs.db`, on top of the repository's own ignore rules. Your `core.excludesFile` and `.git/info/exclude` are left alone, and files Git already tracks are still captured. A task whose `owns` names such a path, or a path inside one, still commits it; owning `pkg` alone does not claim `pkg/__pycache__`. The planner is also told to have the task that sets up a project own and create `.gitignore` when the repository has none for its build outputs.
36
+ - **A check that left a background process running was reported as a timeout.** A command such as `sh -c "server & run-tests"` succeeded, but agengo waited for the background process to close its output and failed the check after `--timeout` (15 minutes by default). agengo now waits 2 seconds after the command exits, then stops what is left in its process group.
37
+ - The JSON schema passed to Claude Code with `--json-schema` is now a single line. Windows refuses line breaks in arguments to a batch file such as `claude.cmd`.
38
+
39
+ ### Upgrading from 0.3.x
40
+ - Custom planners: `specs/planner-output.schema.json` now returns acceptance criteria as `{id, text, refs}` and adds `assumptions`. Plans with plain-text criteria and no assumptions still validate.
41
+ - Custom roles files: `specify` is optional, like `verify`; a file without it uses the built-in role.
42
+ - State databases from 0.3.x open unchanged; the new `run_specs` table is created on first use.
43
+ - `agengo init` now also creates `.agengo/principles.md`. Re-run it after upgrading and commit the files.
44
+
45
+ ## 0.3.0
46
+
47
+ ### Fixed
48
+ - **Claude Code could not write files.** Worktrees used to live under `.git/agent-flow/worktrees`, and Claude Code refuses to write to any path containing `.git/`. Worktrees now live in `~/.cache/agengo/worktrees/…`; override with `AGENGO_WORKTREES` or `XDG_CACHE_HOME`.
49
+ - **The Claude Builder was denied permissions in `-p` mode.** The Builder now runs with `--permission-mode acceptEdits --allowedTools Bash`, and the Reviewer with `--allowedTools Bash`.
50
+ - **Worktrees and temporary branches were never removed.** Each step's worktree is removed when the step finishes. On delivery, agengo removes all of the run's worktrees and temporary refs (`af-work/*`, `refs/agent-flow/builds/*`).
51
+ - **`commit` handoff sent unverified builds to the Reviewer.** The task's `setup` and `verify` now run on the Builder's commit before review, as in `worktree` handoff.
52
+
53
+ ### Changed
54
+ - **English is now the project's single source language.** All CLI output (labels, notices, recommendations, errors) is in English, with labels such as `[PROGRESS]`, `[DECISION]`, `[DELIVERED]`, `[INBOX]` and `[METRICS]`. The terms are defined in [docs/glossary.md](docs/glossary.md). The main README and user guide are in English, and the Vietnamese versions moved to [README.vi.md](README.vi.md) and [docs/vi/](docs/vi/huong-dan.md). Notices recorded by older versions keep their original text.
55
+ - `quality.python_duplicates` accepts `off` | `warn` | `block`, and **defaults to `warn`**: duplicates produce a warning in the delivery notice instead of blocking. The old `true`/`false` mean `block`/`off`. In `block` mode the gate runs at every integration, so the Builder of the task that adds a duplicate has to fix it.
56
+ - Function fingerprints normalize parameter and local variable names, so copies with renamed variables are found. Functions that only store attributes (`self.x = x`) are ignored.
57
+ - Agent incidents (crash, timeout, reply that breaks the contract), dependency errors and failed final checks now raise a `decision` request with a `Y-xx` code, instead of an `incident` notice nobody could answer.
58
+ - `status`, `inbox` and notices print the exact `agengo respond …` command. `inbox --json` and `status --json` include `command` / `respond_command`.
59
+ - When `af/<run>` is changed outside agengo, the error message includes the `git update-ref` command that restores it.
60
+
61
+ ### Added
62
+ - **Distribution.** Prebuilt binaries for Linux and macOS (x64 and arm64) on GitHub Releases, an npm package (`npm install -g agengo`, `npx agengo`), a shell installer, and the `agengo` crate on crates.io. Releases are built by [cargo-dist](https://github.com/axodotdev/cargo-dist) when a `v*` tag is pushed.
63
+ - MIT license.
64
+ - **Per-attempt token usage and cost.** For Claude Code, agengo reads `usage`, `total_cost_usd` and `modelUsage`. Custom adapters can report a provider-neutral `usage` object, following [specs/usage.schema.json](specs/usage.schema.json). `status --json` shows each attempt's usage; `metrics` totals it per role, per task and per run. The new `attempt_usage` table is added to existing databases without a migration. Recording costs about 1 ms per attempt.
65
+ - `agengo clean <run>`.
66
+ - Brand assets in [assets/](assets/): logo (light and dark), favicon, workflow diagrams, social preview image and a demo screenshot from a real run.
67
+ - System tests for commit handoff, review findings across rounds, choice B (plan amendment), incident requests, `clean`, `metrics`, token usage, both duplicate gate modes, and one real Claude Code run when `AGENGO_CLAUDE_E2E=1` is set.
68
+ - Typed `Settings` for run configuration, and typed errors `DependencyMissing`, `VerifyFailed` and `DuplicatesFound` instead of matching error text.
69
+ - Full documentation: user guide, glossary, adapter protocol, storage and security limits. GitHub Actions CI on Linux and macOS.
70
+
71
+ ### Upgrading from 0.2.x
72
+ - Existing runs can still be resumed. Worktrees of old runs under `.git/agent-flow/worktrees` are removed when the run is delivered, or by `agengo clean <run>`.
73
+ - Plans that relied on the duplicate gate blocking by default must now set `quality.python_duplicates: block`.
74
+ - Scripts that parsed the Vietnamese CLI output must switch to the English labels, or better, to `status --json` and `inbox --json`.
75
+
76
+ ## 0.2.0
77
+ - First reviewed version.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 nguyentan510
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,223 @@
1
- # Temporary Holding Version
1
+ <div align="center">
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ <picture>
4
+ <source media="(prefers-color-scheme: dark)" srcset="assets/logo-dark.svg">
5
+ <img src="assets/logo.svg" alt="agengo" height="96">
6
+ </picture>
7
+
8
+ **Run AI coding agents like Claude Code on your own machine, under control. Each task is built, verified, independently reviewed and integrated in its own Git worktree, and the result is handed over only when every check passes.**
9
+
10
+ [![Rust 1.90+](https://img.shields.io/badge/rust-1.90%2B-orange?logo=rust)](https://www.rust-lang.org)
11
+ [![CI](https://github.com/nguyentan510/agengo/actions/workflows/ci.yml/badge.svg)](https://github.com/nguyentan510/agengo/actions/workflows/ci.yml)
12
+ [![Platform: Linux · macOS · Windows](https://img.shields.io/badge/platform-Linux%20%C2%B7%20macOS%20%C2%B7%20Windows-blue)](#requirements)
13
+ [![Claude Code](https://img.shields.io/badge/agent-Claude%20Code-d97757)](https://claude.com/claude-code)
14
+ [![Version 0.4.0](https://img.shields.io/badge/version-0.4.0-green)](CHANGELOG.md)
15
+
16
+ [Features](#features) · [How it works](#how-it-works) · [Quick start](#quick-start) · [Docs](docs/README.md) · [FAQ](#faq) · [Tiếng Việt](README.vi.md)
17
+
18
+ </div>
19
+
20
+ ---
21
+
22
+ **agengo** is an open-source command-line tool, written in Rust, for running **AI coding agents** under control. You write a plan made of small tasks. For each task, agengo:
23
+
24
+ 1. dispatches a **Builder** agent,
25
+ 2. runs *your* verification commands,
26
+ 3. has an independent **Reviewer** check the exact commit against the acceptance criteria,
27
+ 4. merges the result into a dedicated Git branch.
28
+
29
+ You end up with a verified `af/<run-id>` branch that is ready to inspect and merge. Your `main` branch is never touched.
30
+
31
+ > Use it when you want Claude Code, or any other coding agent, to work on **several tasks at once** while keeping **clear file scopes, mandatory tests, independent review, and a human in the loop** for the decisions that matter.
32
+
33
+ ## Why agengo?
34
+
35
+ Running an agent directly on your repository is fast but hard to control. It may edit unrelated files, report "done" while tests are still red, or leave your working branch in a mess. agengo adds a verified orchestration layer around the agent:
36
+
37
+ | Running an agent directly | Running it through agengo |
38
+ |---|---|
39
+ | The agent may edit any file | Each task may only change the paths listed in its `owns` scope; anything else is rejected |
40
+ | "Done" means the agent says so | "Done" means your `verify` commands pass in a clean worktree |
41
+ | The agent reviews its own work | A separate Reviewer must attest the exact commit SHA it was given |
42
+ | Work happens on your current branch | Every attempt gets its own worktree; results merge into `af/<run-id>` |
43
+ | An interruption loses track of progress | State lives in SQLite; `resume` continues where it stopped, even after Ctrl‑C |
44
+ | Questions get lost in chat | A decision inbox lists each `Y-xx` request together with the command that answers it |
45
+
46
+ ## Features
47
+
48
+ - 🤖 **Multi-agent workflow:** Builder → verification → Reviewer → integration → final checks. Claude Code works out of the box; any other agent can plug in through a [JSON adapter](#adapter-protocol).
49
+ - 🌳 **Git worktree isolation:** every build, review and integration attempt runs in its own worktree, and worktrees are cleaned up automatically.
50
+ - ⚡ **Safe parallelism:** `--jobs N` runs independent tasks concurrently; tasks with overlapping file scopes are serialized, and `depends` ordering is enforced.
51
+ - ✅ **Mandatory verification:** each task's `verify` commands, `integration_verify` after every merge, and `final_verify` before hand-off.
52
+ - 🔍 **Tracked review findings:** findings (`F-01`, …) are tied to acceptance criteria, carry a severity, and are followed across fix rounds. Only `critical` and `high` findings block; `medium` and `low` ones are kept as advisory notes for you. An optional whole-branch review is available, and `quality.verify_findings` has a second agent try to refute blocking findings before the task goes back to the Builder.
53
+ - 💬 **From rough idea to spec:** `agengo spec` turns a one-line idea into a spec of what to build (user stories, measurable success criteria, what is out of scope, visible assumptions) by asking at most a few multiple-choice questions in plain words, never about technology. agengo enforces the question limits and locks the approved spec with a digest. In Claude Code the questions appear as clickable choices.
54
+ - 🧑‍⚖️ **Human in the loop:** approve plans before they run, choose between options A and B, amend the plan as a new revision, and pause or resume individual tasks.
55
+ - 🧬 **Quality gates:** tree-sitter–based detection of duplicated Python functions (`off`/`warn`/`block`), plus any lint or test commands you add.
56
+ - 💾 **Crash-safe:** transactional SQLite state, a per-run lock, and timeouts and output limits for agent processes.
57
+ - 📊 **Cost transparency:** `status --json` records every attempt's request, result, duration, tokens and cost; `agengo metrics` totals tokens and cost per role and per task, for Claude Code or any adapter that reports [`usage`](#token-and-cost-usage).
58
+ - 🎯 **Reliability evidence:** `agengo metrics` also reports the first-review pass rate, review rounds, gate and review failures, findings by state and severity, and results per model; `agengo metrics --all` adds them up across every run in the repository, so you can compare agents and models. See [Metrics](docs/guide.md#metrics).
59
+
60
+ ## How it works
61
+
62
+ <picture>
63
+ <source media="(prefers-color-scheme: dark)" srcset="assets/workflow.en-dark.svg">
64
+ <img src="assets/workflow.en.svg" alt="agengo workflow: plan, build, verify, review, integrate, deliver, with a decision inbox for people">
65
+ </picture>
66
+
67
+ Tasks move through `pending → building → ready_review → reviewing → passed → integrated`. When a task gets stuck — the review limit is reached, the agent crashes, or a prerequisite is missing — it becomes `blocked` and agengo asks you through a `Y-xx` request. Independent tasks keep running.
68
+
69
+ ## Requirements
70
+
71
+ - Linux, macOS or Windows 10/11. On Windows, Claude Code needs [Git for Windows](https://git-scm.com/downloads/win).
72
+ - Node.js 14.18+ for the npm package, or Rust/Cargo 1.90+ and a C compiler to build from source. Prebuilt binaries need neither.
73
+ - Git 2.31+ with `user.name` and `user.email` configured.
74
+ - Either [Claude Code](https://claude.com/claude-code) on `PATH` and logged in, or your own adapter passed with `--agent <executable>`.
75
+
76
+ ## Installation
77
+
78
+ Prebuilt binaries are available for Linux and macOS (x64 and arm64) and Windows (x64).
79
+
80
+ ```bash
81
+ npm install -g agengo # or try it without installing: npx agengo --help
82
+ ```
83
+
84
+ ```bash
85
+ curl --proto '=https' --tlsv1.2 -LsSf https://github.com/nguyentan510/agengo/releases/latest/download/agengo-installer.sh | sh
86
+ ```
87
+
88
+ ```powershell
89
+ powershell -ExecutionPolicy ByPass -c "irm https://github.com/nguyentan510/agengo/releases/latest/download/agengo-installer.ps1 | iex" # Windows
90
+ ```
91
+
92
+ ```bash
93
+ cargo install agengo --locked # builds from source
94
+ ```
95
+
96
+ Binaries and checksums for each version are on the [Releases](https://github.com/nguyentan510/agengo/releases) page.
97
+
98
+ ## Quick start
99
+
100
+ ```yaml
101
+ # plan.yaml
102
+ schema_version: 1
103
+ goal: Add a greeting helper
104
+ tasks:
105
+ - id: greet
106
+ goal: Add greet(name) to src/greet.py returning "Hello, <name>!".
107
+ owns: [src/greet.py, tests/test_greet.py]
108
+ acceptance: ["greet('An') returns 'Hello, An!'"]
109
+ verify: [["python3", "-m", "pytest", "-q", "tests/test_greet.py"]]
110
+ final_verify: [["python3", "-m", "pytest", "-q"]]
111
+ ```
112
+
113
+ ```bash
114
+ agengo init # once per repository: teach your coding agents when to call agengo
115
+ agengo plan --file plan.yaml --brief # validate the plan without calling an agent
116
+ agengo run plan.yaml --id demo # build → review → integrate → deliver
117
+ agengo status demo # progress
118
+ agengo inbox demo # pending requests, each with the command that answers it
119
+ git log --oneline main..af/demo # inspect the result before merging
120
+ ```
121
+
122
+ <img src="assets/demo-terminal.png" alt="Real agengo output after a Claude Code run: delivered branch, per-role tokens and cost, and the merge graph" width="100%">
123
+
124
+ No plan yet? Let the agent draft one: `agengo plan --goal "Add a login API" --format yaml > plan.yaml`. Only a rough idea? Settle it first with `agengo spec --idea "a booking app for my barbershop"`, then draft a plan that must cover it with `agengo plan --spec spec.yaml` (see [Clarifying an idea](docs/guide.md#clarifying-an-idea)).
125
+
126
+ Exit codes: `0` delivered · `2` waiting for your answer (then run `resume`) · `1` error · `130` interrupted (run `resume`).
127
+
128
+ ## Plan format
129
+
130
+ A plan is YAML or JSON, validated against [specs/plan.schema.json](specs/plan.schema.json). agengo rejects unknown fields, dependency cycles and paths outside the repository.
131
+
132
+ | Field | Required | Meaning |
133
+ |---|---|---|
134
+ | `goal` | ✔ | Overall goal of the run |
135
+ | `tasks[].id` | ✔ | 1–64 characters from `A-Z a-z 0-9 _ -`, unique |
136
+ | `tasks[].goal` / `title` | goal ✔ | Instructions for the agent / short title for humans |
137
+ | `tasks[].owns` | ✔ | Files or directories the Builder may change. Tasks with overlapping scopes never run in parallel |
138
+ | `tasks[].acceptance` | ✔ | Acceptance criteria, as strings or `{id, text}` |
139
+ | `tasks[].verify` | ✔ | argv commands run on the candidate before review and again at integration |
140
+ | `tasks[].depends` | | Tasks that must be integrated first |
141
+ | `tasks[].setup`, `setup` | | Commands that prepare each worktree, e.g. `[["npm","ci"]]` |
142
+ | `integration_verify` | | Commands run after every merge |
143
+ | `final_verify` | ✔ | Commands run on the final branch before delivery |
144
+ | `quality` | | `python_duplicates: off \| warn \| block`, `ignore_paths`, extra `checks`, `review: true` for a whole-branch review, `verify_findings: true` to have a verifier try to refute blocking review findings first |
145
+
146
+ Commands are argv arrays and never go through a shell. Use `["sh", "-c", "..."]` if you need shell syntax.
147
+
148
+ ## Commands
149
+
150
+ | Command | Purpose |
151
+ |---|---|
152
+ | `plan --file F` / `--goal G` / `--from F` | Validate a plan, or have the agent draft one |
153
+ | `run PLAN [--id ID] [--jobs N] [--base REV]` | Start a run (`--review-limit`, `--gate-limit`, `--timeout`, `--builder-handoff worktree\|commit`, `--agent`, `--auth subscription\|api`, `--await-approval`) |
154
+ | `resume ID` / `resume ID --task T` / `pause ID --task T` | Continue a run, unpause a task, pause a task |
155
+ | `status ID [--json]` · `inbox ID [--json]` · `metrics ID [--json]` | Progress, pending requests, timing, tokens, cost and reliability figures |
156
+ | `metrics --all [--json]` | Reliability and cost for every run in the repository, combined and per model |
157
+ | `respond ID Y-xx --choice A\|B\|approve\|reject --note N [--plan F]` | Answer a request |
158
+ | `resolve ID TASK --note N` · `amend ID PLAN --note N` | Reopen a blocked task · approve a new plan revision |
159
+ | `clean ID` | Remove the run's worktrees (and its temporary refs once delivered) |
160
+ | `init [--no-agents-md]` | Install the agengo skill for Claude Code and Codex, and a section in `AGENTS.md`, so agents in this repository hand multi-task work to agengo |
161
+
162
+ ## Adapter protocol
163
+
164
+ With `--agent <exe>`, agengo runs the executable once per assignment, inside the assigned worktree:
165
+
166
+ - **Input:** a request JSON on **stdin**, following [specs/request.schema.json](specs/request.schema.json). It includes `role`, `task`, `head`, `base`, `context` with acceptance criteria and open findings, `decisions` and `relationships`.
167
+ - **Output:** one result JSON on **stdout**, following [specs/outcome.schema.json](specs/outcome.schema.json):
168
+
169
+ ```json
170
+ {"status": "done", "head": "<sha>", "summary": "…", "blocker": null,
171
+ "findings": [], "finding_resolutions": [], "resolved_conflicts": []}
172
+ ```
173
+
174
+ ### Token and cost usage
175
+
176
+ An adapter may add an optional top-level `usage` object, following [specs/usage.schema.json](specs/usage.schema.json): `input_tokens` (uncached input), `output_tokens`, `cache_read_tokens`, `cache_write_tokens`, `cost_usd` and `model`. Malformed fields are dropped and never fail an attempt. agengo does not price tokens itself. For Claude Code, usage and `total_cost_usd` are read automatically. Mappings for the Anthropic, OpenAI, Gemini and Ollama APIs are in the [user guide](docs/guide.md#token-and-cost-usage-optional).
177
+
178
+ The Builder returns `done` (commit handoff) or `ready` (worktree handoff). The Reviewer returns `pass` or `changes_requested`; each finding has a `severity` (`critical`, `high`, `medium` or `low`, `high` when omitted). Any role may return `blocked` with a `blocker` (`action`, `decision` or `information`). A non-zero exit, output that is not JSON, or a timeout becomes a `Y-xx` decision. A complete reference adapter lives in [tests/support/mod.rs](tests/support/mod.rs).
179
+
180
+ ## FAQ
181
+
182
+ **Does agengo merge into `main` or push to a remote?**
183
+ No. It only creates and updates the local branch `af/<run-id>` and never pushes. Merging is your decision.
184
+
185
+ **Can I use an agent other than Claude Code?**
186
+ Yes. Any executable that speaks the [JSON adapter protocol](#adapter-protocol) works.
187
+
188
+ **Does it use my Claude or ChatGPT subscription, or an API key?**
189
+ Your subscription. By default (`--auth subscription`) agengo removes `ANTHROPIC_API_KEY`, `OPENAI_API_KEY` and similar variables from the agents' environment, because Claude Code and Codex would otherwise bill the key first. Log in once with the agent's own CLI (`claude` then `/login`, or `codex login`). Pass `--auth api` to use API keys instead.
190
+
191
+ **How does Claude Code or Codex know to call agengo?**
192
+ Run `agengo init` in the repository. It installs an agengo skill that both agents load, describing when to hand work to agengo and how to drive a run.
193
+
194
+ **What happens if the agent hangs or crashes?**
195
+ Each attempt has a timeout (`--timeout`, 900 s by default). Failures turn into `Y-xx` requests. Answer with `agengo respond`, then run `agengo resume`.
196
+
197
+ **Where is data stored?**
198
+ State is kept in `.git/agent-flow/state.sqlite3`. Temporary worktrees live under `~/.cache/agengo/worktrees` (`%LOCALAPPDATA%\agengo\worktrees` on Windows; override with `AGENGO_WORKTREES`) and are removed after delivery or by `agengo clean <run>`.
199
+
200
+ **Is it a sandbox?**
201
+ No. agengo checks file scope, commit SHAs, the index and branches after every attempt, ignores Git hooks in its own commands, and stops the run if an agent changes the repository's hooks or Git configuration. Agents can still run Bash, though. For untrusted code or agents, run agengo inside a container or VM. See [security limits](docs/guide.md#security-limits).
202
+
203
+ **What does it cost?**
204
+ agengo itself is free. You pay for the agent you use, such as Claude Code. Every task needs at least one build attempt and one review attempt, and on small tasks the review can cost nearly as much as the build. `agengo metrics` reports real tokens and cost per role and per task. Recording them adds about 1 ms per attempt and makes no extra API calls. To see what the reviews cost you in rework, `agengo metrics ID` also shows how many tasks passed their first review and how many build attempts each integrated task took; `agengo metrics --all` totals cost and first-review pass rate across runs and per model. These reports only read the state database.
205
+
206
+ ## Documentation
207
+
208
+ - [User guide](docs/guide.md): full reference.
209
+ - [Glossary](docs/glossary.md): canonical terms and CLI output labels.
210
+ - [Documentation index](docs/README.md).
211
+ - [CHANGELOG](CHANGELOG.md).
212
+ - [specs/](specs/): JSON Schemas and role prompts.
213
+
214
+ ## Development
215
+
216
+ ```bash
217
+ cargo test --locked # unit + system tests with a simulated agent
218
+ AGENGO_CLAUDE_E2E=1 cargo test --locked --test system # plus one real Claude Code run (uses API credits)
219
+ ```
220
+
221
+ ---
222
+
223
+ <sub>Keywords: AI coding agent orchestrator · Claude Code automation · multi-agent software development · git worktree · automated code review · human-in-the-loop · Rust CLI</sub>
@@ -0,0 +1,348 @@
1
+ const {
2
+ createWriteStream,
3
+ existsSync,
4
+ mkdirSync,
5
+ mkdtemp,
6
+ rmSync,
7
+ } = require("fs");
8
+ const { join, sep } = require("path");
9
+ const { spawnSync } = require("child_process");
10
+ const { tmpdir } = require("os");
11
+
12
+ const https = require("node:https");
13
+ const http = require("node:http");
14
+
15
+ const tmpDir = tmpdir();
16
+
17
+ const error = (msg) => {
18
+ console.error(msg);
19
+ process.exit(1);
20
+ };
21
+
22
+ function getProxyForUrl(urlString) {
23
+ const url = new URL(urlString);
24
+ const isHttps = url.protocol === "https:";
25
+
26
+ const noProxy = process.env.NO_PROXY || process.env.no_proxy || "";
27
+ if (noProxy === "*") return null;
28
+ if (noProxy) {
29
+ const hostname = url.hostname.toLowerCase();
30
+ const noProxyList = noProxy.split(",").map((s) => s.trim().toLowerCase());
31
+ for (const entry of noProxyList) {
32
+ if (hostname === entry || hostname.endsWith("." + entry)) {
33
+ return null;
34
+ }
35
+ }
36
+ }
37
+
38
+ const proxyEnv = isHttps
39
+ ? process.env.HTTPS_PROXY || process.env.https_proxy
40
+ : process.env.HTTP_PROXY || process.env.http_proxy;
41
+
42
+ if (!proxyEnv) return null;
43
+
44
+ const proxyUrl = new URL(proxyEnv);
45
+
46
+ let auth = null;
47
+ if (proxyUrl.username || proxyUrl.password) {
48
+ auth = `${proxyUrl.username}:${proxyUrl.password}`;
49
+ }
50
+
51
+ return {
52
+ hostname: proxyUrl.hostname,
53
+ port: proxyUrl.port || (proxyUrl.protocol === "https:" ? 443 : 80),
54
+ auth: auth,
55
+ };
56
+ }
57
+
58
+ function connectThroughProxy(proxy, target) {
59
+ return new Promise((resolve, reject) => {
60
+ const headers = {};
61
+ if (proxy.auth) {
62
+ headers["Proxy-Authorization"] =
63
+ "Basic " + Buffer.from(proxy.auth).toString("base64");
64
+ }
65
+
66
+ const connectReq = http.request({
67
+ hostname: proxy.hostname,
68
+ port: proxy.port,
69
+ method: "CONNECT",
70
+ path: `${target.hostname}:${target.port || 443}`,
71
+ headers,
72
+ });
73
+ connectReq.on("connect", (res, socket) => {
74
+ if (res.statusCode === 200) {
75
+ resolve(socket);
76
+ } else {
77
+ reject(new Error(`Proxy CONNECT failed with status ${res.statusCode}`));
78
+ }
79
+ });
80
+ connectReq.on("error", reject);
81
+ connectReq.end();
82
+ });
83
+ }
84
+
85
+ function download(urlString, maxRedirects) {
86
+ if (maxRedirects === undefined) maxRedirects = 5;
87
+ return new Promise((resolve, reject) => {
88
+ if (maxRedirects < 0) {
89
+ return reject(new Error("Too many redirects"));
90
+ }
91
+
92
+ const parsed = new URL(urlString);
93
+ const isHttps = parsed.protocol === "https:";
94
+ const mod = isHttps ? https : http;
95
+ const proxy = getProxyForUrl(urlString);
96
+
97
+ const doRequest = (extraOptions) => {
98
+ const options = Object.assign(
99
+ {
100
+ hostname: parsed.hostname,
101
+ port: parsed.port || (isHttps ? 443 : 80),
102
+ path: parsed.pathname + parsed.search,
103
+ method: "GET",
104
+ headers: { "User-Agent": "cargo-dist-npm-installer" },
105
+ },
106
+ extraOptions || {},
107
+ );
108
+
109
+ if (proxy && !isHttps) {
110
+ // HTTP through HTTP proxy: request the full URL via the proxy
111
+ options.hostname = proxy.hostname;
112
+ options.port = proxy.port;
113
+ options.path = urlString;
114
+ if (proxy.auth) {
115
+ options.headers["Proxy-Authorization"] =
116
+ "Basic " + Buffer.from(proxy.auth).toString("base64");
117
+ }
118
+ }
119
+
120
+ const req = mod.request(options, (res) => {
121
+ if (
122
+ res.statusCode >= 300 &&
123
+ res.statusCode < 400 &&
124
+ res.headers.location
125
+ ) {
126
+ res.resume();
127
+ const nextUrl = new URL(res.headers.location, urlString).toString();
128
+ return download(nextUrl, maxRedirects - 1).then(resolve, reject);
129
+ }
130
+ if (res.statusCode < 200 || res.statusCode >= 300) {
131
+ res.resume();
132
+ return reject(new Error(`HTTP ${res.statusCode} from ${urlString}`));
133
+ }
134
+ resolve(res);
135
+ });
136
+ req.on("error", reject);
137
+ req.end();
138
+ };
139
+
140
+ if (proxy && isHttps) {
141
+ connectThroughProxy(proxy, parsed).then(
142
+ (socket) => doRequest({ socket, agent: false }),
143
+ reject,
144
+ );
145
+ } else {
146
+ doRequest();
147
+ }
148
+ });
149
+ }
150
+
151
+ class Package {
152
+ constructor(platform, name, url, filename, zipExt, binaries) {
153
+ let errors = [];
154
+ if (typeof url !== "string") {
155
+ errors.push("url must be a string");
156
+ } else {
157
+ try {
158
+ new URL(url);
159
+ } catch (e) {
160
+ errors.push(e);
161
+ }
162
+ }
163
+ if (name && typeof name !== "string") {
164
+ errors.push("package name must be a string");
165
+ }
166
+ if (!name) {
167
+ errors.push("You must specify the name of your package");
168
+ }
169
+ if (binaries && typeof binaries !== "object") {
170
+ errors.push("binaries must be a string => string map");
171
+ }
172
+ if (!binaries) {
173
+ errors.push("You must specify the binaries in the package");
174
+ }
175
+
176
+ if (errors.length > 0) {
177
+ let errorMsg =
178
+ "One or more of the parameters you passed to the Binary constructor are invalid:\n";
179
+ errors.forEach((error) => {
180
+ errorMsg += error;
181
+ });
182
+ errorMsg +=
183
+ '\n\nCorrect usage: new Package("my-binary", "https://example.com/binary/download.tar.gz", {"my-binary": "my-binary"})';
184
+ error(errorMsg);
185
+ }
186
+
187
+ this.platform = platform;
188
+ this.url = url;
189
+ this.name = name;
190
+ this.filename = filename;
191
+ this.zipExt = zipExt;
192
+ this.installDirectory = join(__dirname, "node_modules", ".bin_real");
193
+ this.binaries = binaries;
194
+
195
+ if (!existsSync(this.installDirectory)) {
196
+ mkdirSync(this.installDirectory, { recursive: true });
197
+ }
198
+ }
199
+
200
+ exists() {
201
+ for (const binaryName in this.binaries) {
202
+ const binRelPath = this.binaries[binaryName];
203
+ const binPath = join(this.installDirectory, binRelPath);
204
+ if (!existsSync(binPath)) {
205
+ return false;
206
+ }
207
+ }
208
+ return true;
209
+ }
210
+
211
+ install(suppressLogs = false) {
212
+ if (this.exists()) {
213
+ if (!suppressLogs) {
214
+ console.error(
215
+ `${this.name} is already installed, skipping installation.`,
216
+ );
217
+ }
218
+ return Promise.resolve();
219
+ }
220
+
221
+ try {
222
+ rmSync(this.installDirectory, { recursive: true, force: true });
223
+ } catch {
224
+ // ignore - directory may not exist
225
+ }
226
+
227
+ mkdirSync(this.installDirectory, { recursive: true });
228
+
229
+ if (!suppressLogs) {
230
+ console.error(`Downloading release from ${this.url}`);
231
+ }
232
+
233
+ return download(this.url)
234
+ .then((res) => {
235
+ return new Promise((resolve, reject) => {
236
+ mkdtemp(`${tmpDir}${sep}`, (err, directory) => {
237
+ if (err) return reject(err);
238
+ let tempFile = join(directory, this.filename);
239
+ const sink = res.pipe(createWriteStream(tempFile));
240
+ sink.on("error", (err) => reject(err));
241
+ sink.on("close", () => {
242
+ if (/\.tar\.*/.test(this.zipExt)) {
243
+ const result = spawnSync("tar", [
244
+ "xf",
245
+ tempFile,
246
+ // The tarballs are stored with a leading directory
247
+ // component; we strip one component in the
248
+ // shell installers too.
249
+ "--strip-components",
250
+ "1",
251
+ "-C",
252
+ this.installDirectory,
253
+ ]);
254
+ if (result.status == 0) {
255
+ resolve();
256
+ } else if (result.error) {
257
+ reject(result.error);
258
+ } else {
259
+ reject(
260
+ new Error(
261
+ `An error occurred untarring the artifact: stdout: ${result.stdout}; stderr: ${result.stderr}`,
262
+ ),
263
+ );
264
+ }
265
+ } else if (this.zipExt == ".zip") {
266
+ let result;
267
+ if (this.platform.artifactName.includes("windows")) {
268
+ // Windows does not have "unzip" by default on many installations, instead
269
+ // we use Expand-Archive from powershell
270
+ result = spawnSync("powershell.exe", [
271
+ "-NoProfile",
272
+ "-NonInteractive",
273
+ "-Command",
274
+ `& {
275
+ param([string]$LiteralPath, [string]$DestinationPath)
276
+ Expand-Archive -LiteralPath $LiteralPath -DestinationPath $DestinationPath -Force
277
+ }`,
278
+ tempFile,
279
+ this.installDirectory,
280
+ ]);
281
+ } else {
282
+ result = spawnSync("unzip", [
283
+ "-q",
284
+ tempFile,
285
+ "-d",
286
+ this.installDirectory,
287
+ ]);
288
+ }
289
+
290
+ if (result.status == 0) {
291
+ resolve();
292
+ } else if (result.error) {
293
+ reject(result.error);
294
+ } else {
295
+ reject(
296
+ new Error(
297
+ `An error occurred unzipping the artifact: stdout: ${result.stdout}; stderr: ${result.stderr}`,
298
+ ),
299
+ );
300
+ }
301
+ } else {
302
+ reject(
303
+ new Error(`Unrecognized file extension: ${this.zipExt}`),
304
+ );
305
+ }
306
+ });
307
+ });
308
+ });
309
+ })
310
+ .then(() => {
311
+ if (!suppressLogs) {
312
+ console.error(`${this.name} has been installed!`);
313
+ }
314
+ })
315
+ .catch((e) => {
316
+ error(`Error fetching release: ${e.message}`);
317
+ });
318
+ }
319
+
320
+ run(binaryName) {
321
+ const promise = !this.exists() ? this.install(true) : Promise.resolve();
322
+
323
+ promise
324
+ .then(() => {
325
+ const [, , ...args] = process.argv;
326
+
327
+ const options = { cwd: process.cwd(), stdio: "inherit" };
328
+
329
+ const binRelPath = this.binaries[binaryName];
330
+ if (!binRelPath) {
331
+ error(`${binaryName} is not a known binary in ${this.name}`);
332
+ }
333
+ const binPath = join(this.installDirectory, binRelPath);
334
+ const result = spawnSync(binPath, args, options);
335
+
336
+ if (result.error) {
337
+ error(result.error);
338
+ }
339
+
340
+ process.exit(result.status);
341
+ })
342
+ .catch((e) => {
343
+ error(e.message);
344
+ });
345
+ }
346
+ }
347
+
348
+ module.exports.Package = Package;
package/binary.js ADDED
@@ -0,0 +1,124 @@
1
+ const { Package } = require("./binary-install");
2
+ const os = require("os");
3
+ const libc = require("detect-libc");
4
+
5
+ const error = (msg) => {
6
+ console.error(msg);
7
+ process.exit(1);
8
+ };
9
+
10
+ const {
11
+ name,
12
+ artifactDownloadUrls,
13
+ supportedPlatforms,
14
+ glibcMinimum,
15
+ } = require("./package.json");
16
+
17
+ // FIXME: implement NPM installer handling of fallback download URLs
18
+ const artifactDownloadUrl = artifactDownloadUrls[0];
19
+ const builderGlibcMajorVersion = glibcMinimum.major;
20
+ const builderGlibcMinorVersion = glibcMinimum.series;
21
+
22
+ const getPlatform = () => {
23
+ const rawOsType = os.type();
24
+ const rawArchitecture = os.arch();
25
+
26
+ // We want to use rust-style target triples as the canonical key
27
+ // for a platform, so translate the "os" library's concepts into rust ones
28
+ let osType = "";
29
+ switch (rawOsType) {
30
+ case "Windows_NT":
31
+ osType = "pc-windows-msvc";
32
+ break;
33
+ case "Darwin":
34
+ osType = "apple-darwin";
35
+ break;
36
+ case "Linux":
37
+ osType = "unknown-linux-gnu";
38
+ break;
39
+ }
40
+
41
+ let arch = "";
42
+ switch (rawArchitecture) {
43
+ case "x64":
44
+ arch = "x86_64";
45
+ break;
46
+ case "arm64":
47
+ arch = "aarch64";
48
+ break;
49
+ }
50
+
51
+ if (rawOsType === "Linux") {
52
+ if (libc.familySync() == "musl") {
53
+ osType = "unknown-linux-musl-dynamic";
54
+ } else if (libc.isNonGlibcLinuxSync()) {
55
+ console.warn(
56
+ "Your libc is neither glibc nor musl; trying static musl binary instead",
57
+ );
58
+ osType = "unknown-linux-musl-static";
59
+ } else {
60
+ let libcVersion = libc.versionSync();
61
+ let splitLibcVersion = libcVersion.split(".");
62
+ let libcMajorVersion = splitLibcVersion[0];
63
+ let libcMinorVersion = splitLibcVersion[1];
64
+ if (
65
+ libcMajorVersion != builderGlibcMajorVersion ||
66
+ libcMinorVersion < builderGlibcMinorVersion
67
+ ) {
68
+ // We can't run the glibc binaries, but we can run the static musl ones
69
+ // if they exist
70
+ console.warn(
71
+ "Your glibc isn't compatible; trying static musl binary instead",
72
+ );
73
+ osType = "unknown-linux-musl-static";
74
+ }
75
+ }
76
+ }
77
+
78
+ // Assume the above succeeded and build a target triple to look things up with.
79
+ // If any of it failed, this lookup will fail and we'll handle it like normal.
80
+ let targetTriple = `${arch}-${osType}`;
81
+ let platform = supportedPlatforms[targetTriple];
82
+
83
+ if (!platform) {
84
+ error(
85
+ `Platform with type "${rawOsType}" and architecture "${rawArchitecture}" is not supported by ${name}.\nYour system must be one of the following:\n\n${Object.keys(
86
+ supportedPlatforms,
87
+ ).join(",")}`,
88
+ );
89
+ }
90
+
91
+ return platform;
92
+ };
93
+
94
+ const getPackage = () => {
95
+ const platform = getPlatform();
96
+ const url = `${artifactDownloadUrl}/${platform.artifactName}`;
97
+ let filename = platform.artifactName;
98
+ let ext = platform.zipExt;
99
+ let binary = new Package(platform, name, url, filename, ext, platform.bins);
100
+
101
+ return binary;
102
+ };
103
+
104
+ const install = (suppressLogs) => {
105
+ if (!artifactDownloadUrl || artifactDownloadUrl.length === 0) {
106
+ console.warn("in demo mode, not installing binaries");
107
+ return;
108
+ }
109
+ const pkg = getPackage();
110
+
111
+ return pkg.install(suppressLogs);
112
+ };
113
+
114
+ const run = (binaryName) => {
115
+ const pkg = getPackage();
116
+
117
+ pkg.run(binaryName);
118
+ };
119
+
120
+ module.exports = {
121
+ install,
122
+ run,
123
+ getPackage,
124
+ };
package/install.js ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { install } = require("./binary");
4
+ install(false);
@@ -0,0 +1,52 @@
1
+ {
2
+ "lockfileVersion": 3,
3
+ "name": "agengo",
4
+ "packages": {
5
+ "": {
6
+ "bin": {
7
+ "agengo": "run-agengo.js"
8
+ },
9
+ "dependencies": {
10
+ "detect-libc": "^2.1.2"
11
+ },
12
+ "devDependencies": {
13
+ "prettier": "^3.9.10"
14
+ },
15
+ "engines": {
16
+ "node": ">=14.18",
17
+ "npm": ">=6"
18
+ },
19
+ "hasInstallScript": true,
20
+ "license": "MIT",
21
+ "name": "agengo",
22
+ "version": "0.4.0"
23
+ },
24
+ "node_modules/detect-libc": {
25
+ "engines": {
26
+ "node": ">=8"
27
+ },
28
+ "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==",
29
+ "license": "Apache-2.0",
30
+ "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz",
31
+ "version": "2.1.2"
32
+ },
33
+ "node_modules/prettier": {
34
+ "bin": {
35
+ "prettier": "bin/prettier.cjs"
36
+ },
37
+ "dev": true,
38
+ "engines": {
39
+ "node": ">=14"
40
+ },
41
+ "funding": {
42
+ "url": "https://github.com/prettier/prettier?sponsor=1"
43
+ },
44
+ "integrity": "sha512-skGHTH1Yb9QvaTC4hWnRTzEYtCpApF0UMBPz+t/0ZPzP8ihefo/btKd+QA7pUE0fEwA1SbS/NmhyEcstdXOIdA==",
45
+ "license": "MIT",
46
+ "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.9.10.tgz",
47
+ "version": "3.9.10"
48
+ }
49
+ },
50
+ "requires": true,
51
+ "version": "0.4.0"
52
+ }
package/package.json CHANGED
@@ -1,6 +1,98 @@
1
1
  {
2
+ "artifactDownloadUrls": [
3
+ "https://github.com/nguyentan510/agengo/releases/download/v0.4.0"
4
+ ],
5
+ "bin": {
6
+ "agengo": "run-agengo.js"
7
+ },
8
+ "dependencies": {
9
+ "detect-libc": "^2.1.2"
10
+ },
11
+ "description": "Orchestrate AI coding agents (Claude Code) to build, verify, review and integrate tasks in isolated Git worktrees",
12
+ "devDependencies": {
13
+ "prettier": "^3.9.10"
14
+ },
15
+ "engines": {
16
+ "node": ">=14.18",
17
+ "npm": ">=6"
18
+ },
19
+ "glibcMinimum": {
20
+ "major": 2,
21
+ "series": 35
22
+ },
23
+ "homepage": "https://github.com/nguyentan510/agengo",
24
+ "keywords": [
25
+ "command-line-utilities",
26
+ "development-tools",
27
+ "ai-agent",
28
+ "claude-code",
29
+ "git-worktree",
30
+ "code-review",
31
+ "orchestration"
32
+ ],
33
+ "license": "MIT",
2
34
  "name": "agengo",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
35
+ "preferUnplugged": true,
36
+ "repository": "https://github.com/nguyentan510/agengo",
37
+ "scripts": {
38
+ "fmt": "prettier --write **/*.js",
39
+ "fmt:check": "prettier --check **/*.js",
40
+ "postinstall": "node ./install.js"
41
+ },
42
+ "supportedPlatforms": {
43
+ "aarch64-apple-darwin": {
44
+ "artifactName": "agengo-aarch64-apple-darwin.tar.xz",
45
+ "bins": {
46
+ "agengo": "agengo"
47
+ },
48
+ "zipExt": ".tar.xz"
49
+ },
50
+ "aarch64-pc-windows-msvc": {
51
+ "artifactName": "agengo-x86_64-pc-windows-msvc.zip",
52
+ "bins": {
53
+ "agengo": "agengo.exe"
54
+ },
55
+ "zipExt": ".zip"
56
+ },
57
+ "aarch64-unknown-linux-gnu": {
58
+ "artifactName": "agengo-aarch64-unknown-linux-gnu.tar.xz",
59
+ "bins": {
60
+ "agengo": "agengo"
61
+ },
62
+ "zipExt": ".tar.xz"
63
+ },
64
+ "x86_64-apple-darwin": {
65
+ "artifactName": "agengo-x86_64-apple-darwin.tar.xz",
66
+ "bins": {
67
+ "agengo": "agengo"
68
+ },
69
+ "zipExt": ".tar.xz"
70
+ },
71
+ "x86_64-pc-windows-gnu": {
72
+ "artifactName": "agengo-x86_64-pc-windows-msvc.zip",
73
+ "bins": {
74
+ "agengo": "agengo.exe"
75
+ },
76
+ "zipExt": ".zip"
77
+ },
78
+ "x86_64-pc-windows-msvc": {
79
+ "artifactName": "agengo-x86_64-pc-windows-msvc.zip",
80
+ "bins": {
81
+ "agengo": "agengo.exe"
82
+ },
83
+ "zipExt": ".zip"
84
+ },
85
+ "x86_64-unknown-linux-gnu": {
86
+ "artifactName": "agengo-x86_64-unknown-linux-gnu.tar.xz",
87
+ "bins": {
88
+ "agengo": "agengo"
89
+ },
90
+ "zipExt": ".tar.xz"
91
+ }
92
+ },
93
+ "version": "0.4.0",
94
+ "volta": {
95
+ "node": "18.14.1",
96
+ "npm": "9.5.0"
97
+ }
6
98
  }
package/run-agengo.js ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { run } = require("./binary");
4
+ run("agengo");