@gredescerber/agent-crew 0.0.0-stage → 0.6.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 (101) hide show
  1. package/AGENTS.md +25 -0
  2. package/LICENSE +201 -0
  3. package/README.md +418 -2
  4. package/README.ru.md +421 -0
  5. package/adapters/claude/adapter.js +107 -0
  6. package/adapters/codex/adapter.js +101 -0
  7. package/bin/crew.js +60 -0
  8. package/docs/AGENT-SETUP.md +138 -0
  9. package/ecc/profile.json +16 -0
  10. package/evals/README.md +123 -0
  11. package/evals/fixtures/mini-app/README.md +10 -0
  12. package/evals/fixtures/mini-app/contracts/health.json +11 -0
  13. package/evals/fixtures/mini-app/package.json +10 -0
  14. package/evals/fixtures/mini-app/src/cart.js +14 -0
  15. package/evals/fixtures/mini-app/src/handlers.js +16 -0
  16. package/evals/fixtures/mini-app/src/pager.js +7 -0
  17. package/evals/fixtures/mini-app/test/cart.test.js +10 -0
  18. package/evals/fixtures/mini-app/test/handlers.test.js +13 -0
  19. package/evals/fixtures/mini-app/test/pager.test.js +8 -0
  20. package/evals/tasks/add-input-validation.json +15 -0
  21. package/evals/tasks/fix-off-by-one.json +14 -0
  22. package/evals/tasks/handler-per-contract.json +15 -0
  23. package/evals/tasks/judges/add-input-validation.judge.mjs +28 -0
  24. package/evals/tasks/judges/fix-off-by-one.judge.mjs +22 -0
  25. package/evals/tasks/judges/handler-per-contract.judge.mjs +18 -0
  26. package/package.json +46 -4
  27. package/roles/analyst.md +11 -0
  28. package/roles/builder.md +16 -0
  29. package/roles/implementer.md +17 -0
  30. package/roles/integrator.md +12 -0
  31. package/roles/planner.md +19 -0
  32. package/roles/reviewer.md +16 -0
  33. package/roles/scout.md +15 -0
  34. package/skills/crew-brief-analysis/SKILL.md +32 -0
  35. package/skills/crew-kickoff/SKILL.md +77 -0
  36. package/skills/crew-kickoff/task-format.md +215 -0
  37. package/skills/crew-review/SKILL.md +22 -0
  38. package/skills/crew-workflow/SKILL.md +46 -0
  39. package/src/commands/adapters.js +85 -0
  40. package/src/commands/ask.js +123 -0
  41. package/src/commands/board.js +88 -0
  42. package/src/commands/check.js +148 -0
  43. package/src/commands/commit.js +105 -0
  44. package/src/commands/compliance.js +109 -0
  45. package/src/commands/digest.js +64 -0
  46. package/src/commands/doctor.js +48 -0
  47. package/src/commands/eval.js +507 -0
  48. package/src/commands/github.js +169 -0
  49. package/src/commands/guard.js +101 -0
  50. package/src/commands/init.js +76 -0
  51. package/src/commands/kickoff.js +275 -0
  52. package/src/commands/labels.js +28 -0
  53. package/src/commands/merge-ready.js +33 -0
  54. package/src/commands/metrics.js +48 -0
  55. package/src/commands/pr.js +273 -0
  56. package/src/commands/shots.js +51 -0
  57. package/src/commands/status.js +48 -0
  58. package/src/commands/task.js +590 -0
  59. package/src/commands/up.js +355 -0
  60. package/src/commands/upgrade.js +178 -0
  61. package/src/commands/worker.js +322 -0
  62. package/src/core/board.js +127 -0
  63. package/src/core/config.js +83 -0
  64. package/src/core/digest.js +67 -0
  65. package/src/core/exec.js +50 -0
  66. package/src/core/guard.js +273 -0
  67. package/src/core/issues.js +154 -0
  68. package/src/core/lease.js +48 -0
  69. package/src/core/metrics.js +232 -0
  70. package/src/core/output.js +56 -0
  71. package/src/core/prd.js +612 -0
  72. package/src/core/proc.js +52 -0
  73. package/src/core/questions.js +51 -0
  74. package/src/core/queue.js +94 -0
  75. package/src/core/registry.js +143 -0
  76. package/src/core/session.js +61 -0
  77. package/src/core/shots.js +68 -0
  78. package/src/core/supervisor.js +56 -0
  79. package/src/core/version.js +44 -0
  80. package/src/mcp/server.js +81 -0
  81. package/templates/labels.json +23 -0
  82. package/templates/mcp.optional.json +23 -0
  83. package/templates/product/.github/ISSUE_TEMPLATE/epic.yml +22 -0
  84. package/templates/product/.github/ISSUE_TEMPLATE/feedback.yml +36 -0
  85. package/templates/product/.github/ISSUE_TEMPLATE/task.yml +62 -0
  86. package/templates/product/.github/pull_request_template.md +16 -0
  87. package/templates/product/.github/workflows/crew-guard.yml +45 -0
  88. package/templates/product/.github/workflows/crew.yml +118 -0
  89. package/templates/product/AGENTS.md +109 -0
  90. package/templates/product/contracts/README.md +8 -0
  91. package/templates/product/docs/architecture.md +41 -0
  92. package/templates/product/docs/brief-analysis.md +62 -0
  93. package/templates/product/docs/brief.md +25 -0
  94. package/templates/product/docs/playbooks/issues.md +91 -0
  95. package/templates/product/docs/playbooks/preflight.md +28 -0
  96. package/templates/product/docs/playbooks/timeline.md +52 -0
  97. package/templates/product/docs/prd.md +58 -0
  98. package/templates/product/events/event.example.json +10 -0
  99. package/templates/product/tests/acceptance/README.md +9 -0
  100. package/templates/stacks/web-fastapi.json +74 -0
  101. package/templates/stacks/web-node.json +70 -0
package/AGENTS.md ADDED
@@ -0,0 +1,25 @@
1
+ # AGENTS.md: developing agent-crew itself
2
+
3
+ These are the rules for agents and humans who **develop agent-crew**.
4
+ The rules for a product built with it live in another file: `templates/product/AGENTS.md`.
5
+
6
+ ## Principles
7
+ - **Vendor neutrality.** The core (`src/`) knows nothing about Claude or Codex. Everything vendor-specific lives in `adapters/<host>/`.
8
+ - **No dependencies.** Node.js 22+ and the standard library only. A new dependency needs an issue with a justification.
9
+ - **One response shape.** Every command returns `ok()/warn()/fail()` from `src/core/output.js`. Every error carries `cause_hint`, `retry`, `stop_when`.
10
+ - **Rules live in CI, not in prose.** If a rule matters, code must enforce it.
11
+ - **Cross-platform.** Windows, macOS, Linux. External commands go through `run()` without a shell.
12
+ - **Language.** Everything written to GitHub (issues, PRs, commits, comments) and everything agents write to each other is English. Agents talk to each human in that human's language.
13
+
14
+ ## How to work
15
+ 1. Tasks are issues in this repo. We follow the same loop as any crew project (`skills/crew-workflow`).
16
+ 2. A new command: a file in `src/commands/`, registered in `src/core/registry.js`, a test in `test/`.
17
+ 3. A new host: `adapters/<host>/adapter.js` + a generation test.
18
+ 4. `npm test` must be green. Tests never touch the network or GitHub.
19
+ 5. Conventional Commits. One PR, one task.
20
+ 6. Every user-visible change adds a line to `CHANGELOG.md` under **Unreleased** (Added / Changed / Fixed). A release renames that section to the version and date and uses it as the GitHub release notes.
21
+
22
+ ## Needs human review
23
+ - `templates/product/AGENTS.md`, roles and skills: they change agent behavior for everyone.
24
+ - `templates/product/.github/workflows/`: these are the protective checks.
25
+ - The `crew/v1` response format: change it only together with a schema version bump.
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,419 @@
1
- # Temporary Holding Version
1
+ **English** | [Русский](README.ru.md)
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
+ # agent-crew
4
+
5
+ **A vendor-neutral development environment where several coding agents (Claude Code, Codex, more through adapters) and humans work as one team on any project, coordinated through GitHub Issues and Pull Requests.**
6
+
7
+ People write clear tasks, agents on the team members' own machines take them from a shared queue, write the code, check it and hand it in for review, and the tool makes sure they do not step on each other, do not break `main` and follow one set of rules, whether the agent is Claude or GPT. It was battle-tested at a 4-person hackathon (10-13 Nov 2026, about 160 merged PRs); the hackathon features are an optional [event mode](#event-mode).
8
+
9
+ ---
10
+
11
+ ## Why
12
+
13
+ When several agents (and people) share one repository, the same problems show up every time:
14
+
15
+ - two agents take the same task, or a crashed agent leaves a task stuck forever;
16
+ - nobody reviews the code agents write, or an agent approves its own work;
17
+ - an agent "turns CI green" by weakening a test or editing the CI config;
18
+ - every vendor has its own instruction files, so the rules drift apart;
19
+ - `main` is broken at the moment you need it working.
20
+
21
+ agent-crew answers with a small protocol on top of GitHub, enforced by code and CI rather than by prose.
22
+
23
+ ## What it consists of
24
+
25
+ | Part | What it is | Why |
26
+ |---|---|---|
27
+ | **Rules** | `AGENTS.md`, roles, skills | Like a handbook for a new employee: what to do, when to stop, what is forbidden |
28
+ | **The `crew` control CLI** | a small dependency-free Node.js program (also an MCP server) | Take a task, check code, hand in work: the same for every agent |
29
+ | **Checks** | GitHub Actions, templates, branch protection | An agent may ignore text, but cannot bypass CI |
30
+
31
+ Everything lives in **GitHub**: Issues are the task queue, Pull Requests are the hand-in, Actions are the checks. There is no separate server. Agents run **on the team members' machines, on their own subscriptions**.
32
+
33
+ **Language rule:** everything written to GitHub (issues, PRs, commits, comments) and everything agents write to each other is English. Agents talk to each human in that human's language.
34
+
35
+ ## How it works
36
+
37
+ ```mermaid
38
+ flowchart LR
39
+ B[Brief<br/>docs/brief.md] --> P[Planner<br/>crew-kickoff]
40
+ P --> Q[(GitHub Issues<br/>task queue)]
41
+ Q -->|crew task next / claim| W1[Claude<br/>alice's laptop]
42
+ Q -->|crew task next / claim| W2[Codex<br/>bob's laptop]
43
+ Q -->|crew task next / claim| W3[...<br/>carol's laptop]
44
+ W1 & W2 & W3 -->|crew check -> crew pr open| PR[Pull Requests]
45
+ PR -->|review by an agent<br/>of another vendor| R[Review]
46
+ R -->|merge| M[main, always<br/>releasable]
47
+ ```
48
+
49
+ The life of one task:
50
+
51
+ ```
52
+ needs-spec ──(human adds criteria)──► ready ──(crew task claim)──► claimed ──(crew pr open)──► review ──► done
53
+ ▲ │
54
+ └──── lease expired / ────────┘
55
+ crew task release
56
+ ```
57
+
58
+ ## Quick start
59
+
60
+ **Fastest: one message to an agent.** The agent reads [docs/AGENT-SETUP.md](docs/AGENT-SETUP.md) and sets everything up itself. Ready-to-paste messages for the captain, a member and the plan are at the end of that file. The commands behind them:
61
+
62
+ ```bash
63
+ # captain: create the project, the GitHub repo, invitations and protection of main
64
+ crew up --repo owner/name --invite alice,bob
65
+
66
+ # member: accept the invitation, clone, build local agent configs
67
+ crew up --join owner/name
68
+ ```
69
+
70
+ What stays manual, because an agent must not or cannot do it: logging in (`gh auth login`, Claude, Codex) and confirming project trust in Codex.
71
+
72
+ ### 1. Install (once per machine)
73
+
74
+ Needs Node.js 22+, git, the [GitHub CLI](https://cli.github.com/) (`gh auth login`) and at least one agent: [Claude Code](https://code.claude.com) or [Codex CLI](https://github.com/openai/codex).
75
+
76
+ The tool installs straight from the public GitHub repo (no registry, no tokens):
77
+
78
+ ```bash
79
+ npm install -g @gredescerber/agent-crew
80
+ ```
81
+
82
+ The command is `crew`. Straight from GitHub instead: `npm install -g --allow-git=all github:GredesCerber/agent-crew#v0.6.0` (npm 12+ blocks git installs without the flag).
83
+
84
+ Or clone it and link it (no dependencies; `npm link` only puts `crew` on PATH):
85
+
86
+ ```bash
87
+ gh repo clone GredesCerber/agent-crew && cd agent-crew && npm link
88
+ ```
89
+
90
+ ```bash
91
+ crew doctor
92
+ ```
93
+
94
+ `crew doctor` shows what is missing.
95
+
96
+ **Windows:** enable long paths in git, otherwise it fails on task worktrees and `node_modules`:
97
+
98
+ ```bash
99
+ git config --global core.longpaths true
100
+ ```
101
+
102
+ ### 2. Create the project (captain)
103
+
104
+ ```bash
105
+ crew up my-product --repo owner/my-product --stack web-node --invite alice,bob --public
106
+ ```
107
+
108
+ `crew up` runs `crew init`, makes the first commit, creates the GitHub repo and pushes, invites the members, and sets up `main` protection, labels and `CREW_HARNESS`. It is safe to re-run: finished steps are skipped. Add `--hosts claude,codex` to choose agent hosts.
109
+
110
+ Or step by step:
111
+
112
+ ```bash
113
+ crew init my-product --stack web-fastapi
114
+ cd my-product && git add -A && git commit -m "chore: crew init"
115
+ gh repo create owner/my-product --public --source . --push
116
+ crew github setup --apply
117
+ ```
118
+
119
+ What appears in `my-product/`:
120
+
121
+ ```
122
+ AGENTS.md ← the main rules for all agents
123
+ CLAUDE.md ← one line: @AGENTS.md (Claude reads the rules from there)
124
+ crew.config.json ← areas, checks, model tiers, MCP
125
+ agents/roles/ ← analyst, planner, builder, reviewer, integrator + helpers scout, implementer
126
+ agents/skills/ ← crew-workflow, crew-kickoff, crew-review, crew-brief-analysis
127
+ .claude/ .mcp.json ← generated for Claude Code (+ the ECC plugin)
128
+ .codex/ .agents/skills/ ← generated for Codex
129
+ .github/ ← issue and PR templates, CI checks (crew.yml) and PR rules (crew-guard.yml)
130
+ contracts/ tests/ docs/ ← API contracts, acceptance tests, brief and playbooks
131
+ events/ ← optional event rules (time window, team members)
132
+ ```
133
+
134
+ Stack presets: `web-fastapi` (React + FastAPI) and `web-node` (React + Node.js). A preset is **not ready-made code** but a list of generators (`npm create vite`, `uv init`) and checks; the agent creates the skeleton itself.
135
+
136
+ ### 3. Set up the GitHub repo (`crew github setup`)
137
+
138
+ One command instead of clicking through Settings (needs admin rights on the repo):
139
+
140
+ ```bash
141
+ crew github setup # show the plan of gh api calls, change nothing
142
+ crew github setup --apply # do it
143
+ ```
144
+
145
+ With `--apply` it:
146
+
147
+ - protects `main`: PRs only, green `check` (tests) and `crew-guard` (PR rules + agent review) required, no force-push. **Zero manual approvals**: a human is not an "approve button";
148
+ - enables auto-merge and plain merge commits only (squash and rebase are off because they lose the `Agent`/`Issue` trailers);
149
+ - sets the `CREW_HARNESS` repo variable: the install spec CI uses, by default `@gredescerber/agent-crew@<version>` (another one via `--harness`);
150
+ - creates or updates all labels (like `crew labels sync`).
151
+
152
+ Re-running is safe. The repo is taken from the current folder (`gh repo view`) or from `--repo owner/name`; another branch via `--branch`.
153
+
154
+ > **Branch protection needs a public repo or GitHub Pro/Team.** On the free plan a private repo cannot protect `main`, and `crew github setup --apply` fails with HTTP 403.
155
+
156
+ ### 4. Join an existing project (members)
157
+
158
+ ```bash
159
+ crew up --join owner/name
160
+ ```
161
+
162
+ This accepts the invitation, clones the repo, configures git and runs `crew adapters build`, which creates the local agent configs (`.mcp.json`, `.codex/config.toml`, skills, roles). They depend on the machine and are not committed; `crew task claim` copies them into each task worktree.
163
+
164
+ An agent's name in tasks and commits is `CREW_AGENT` plus the machine name (`claude@alice-laptop`), added by `crew`. For two sessions on one machine give each its own `CREW_AGENT_ID`.
165
+
166
+ ### 5. Plan: brief -> PRD -> tasks (captain)
167
+
168
+ The captain puts the brief into `docs/brief.md`, and the planner agent turns it into `docs/prd.md` (skills `crew-brief-analysis` and `crew-kickoff`). The PRD contains a `crew-team` block (who owns which area, who reviews) and `crew-task` / `crew-epic` blocks. Then:
169
+
170
+ ```bash
171
+ crew task lint # validate the PRD offline
172
+ crew kickoff # dry run: what would be created
173
+ crew kickoff --apply # create the issues, once the PRD is approved
174
+ ```
175
+
176
+ Details in [crew kickoff](#crew-kickoff).
177
+
178
+ ### 6. Run the agents
179
+
180
+ **Claude Code**: open the project folder; it reads `CLAUDE.md` -> `AGENTS.md` and connects the `crew` MCP server on its own. Then:
181
+
182
+ > /loop 10m Work the crew-workflow loop
183
+
184
+ **Codex**: run `codex` in the project root and confirm you trust the project (otherwise it will not read `.codex/config.toml`). Codex has no `/loop`, so the loop runs in the chat on top of `crew task next --wait`:
185
+
186
+ > Work the crew-workflow loop without stopping: run `crew task next --wait 20`, do what its next_actions say, then run it again. Stop after three "no free tasks" answers in a row.
187
+
188
+ Members never plan; only the captain runs `crew kickoff`.
189
+
190
+ ## Concepts
191
+
192
+ ### Tasks and leases
193
+ A task is a GitHub issue with `status:*`, `area:*`, `tier:*` and `risk:*` labels. `crew task claim <id>` takes it: the label changes, a lease marker is written to a comment, the branch `crew/<id>-...` and a separate worktree are created. The lease lasts 45 minutes and is extended by activity (`crew task heartbeat`, crew markers in the issue, or a push to the `crew/<id>-*` branch). If an agent dies, the task returns to the queue by itself (a GitHub Action sweeps every 15 minutes). `crew task cleanup` removes worktrees of closed tasks that have no uncommitted changes and whose work is already saved in `main` or on GitHub.
194
+
195
+ ### Areas and owners
196
+ Every task belongs to exactly one area (`web`, `api`, `infra`, ...). The `crew-team` block of the PRD maps areas to people:
197
+
198
+ ````
199
+ ```crew-team
200
+ alice: web, review # frontend + reviewer
201
+ bob: api
202
+ ```
203
+ ````
204
+
205
+ `crew task next` offers a person's agent its own tasks first, then unowned ones, then other people's areas ("help the owner"). The `review` role marks the team's reviewers.
206
+
207
+ ### Review-first queue
208
+ `crew task next` serves the team before itself: your own PR that needs fixes, then a ready PR to merge, then a PR waiting for your review, and only then a new task. This keeps work from piling up behind review.
209
+
210
+ ### Cross-agent review and `crew-guard`
211
+ Claude's code is reviewed by Codex and vice versa: different models catch different mistakes. `crew-guard` is a commit status set on every PR:
212
+
213
+ - `failure` if the PR changes the rules of agents or CI (`crew.config.json`, `.github/**`, `AGENTS.md`, `CLAUDE.md`, `agents/**`, `events/**`). Agents may not do this at all; the rules are changed by a maintainer;
214
+ - `failure` if the PR changes or deletes an **existing** acceptance test and its task does not allow it (the `changes_acceptance` field of the PRD task). Adding new tests is fine;
215
+ - `failure` if the reviewer asked for changes; `pending` while waiting for review; `success` when **another agent** reviewed the current commit (`crew pr review <n> --verdict approve`), two reviews for `risk:high`;
216
+ - for `risk:high`, tests and code are written by **different agents**: the tests task (`tests_for`) puts them into `tests/pending/<T>/`, and the main task must move them into `tests/acceptance/` without a single edit (otherwise `failure`); `crew task claim` does not let the test author take the code;
217
+ - who reviews is set in `crew.config.json -> review`: by default an agent of another vendor, and if none shows up within 30 minutes, any other agent. A Claude-only team uses `"require": "other-agent"` or `"hosts": ["claude"]`;
218
+ - the `crew-guard.yml` workflow is taken from `main`, not from the PR branch (`pull_request_target`), and never runs PR code, so a PR cannot weaken its own check;
219
+ - on a PR, `crew check` in CI uses the `crew.config.json` of the base commit, not of the PR branch; on push to `main` it uses its own.
220
+
221
+ `crew guard --pr <n>` shows the same locally: why a PR does not merge.
222
+
223
+ ### Protected `main`
224
+ `crew github setup --apply` makes `main` PR-only with `check` and `crew-guard` required. Humans do not approve every PR: they test the running product and file feedback, and the planner turns it into tasks. See the note about public repos above.
225
+
226
+ **Emergency stop:** create an issue labeled `crew:pause`; agents finish the current step and stop. This is in code: while such an issue is open, `crew task next` and `crew task claim` return a `paused` error.
227
+
228
+ ## `crew` commands
229
+
230
+ | Command | What it does |
231
+ |---|---|
232
+ | `crew task next [--area web] [--tier low] [--wait 20]` | the next item for you: own PR to fix, PR to merge, review, or a free task for your area and model tier; with `--wait N` it polls once a minute for up to N minutes when idle (the in-chat loop for Codex) |
233
+ | `crew task claim <id>` | take a task: label, lease, branch `crew/<id>-...`, separate worktree |
234
+ | `crew check` | run lint/types/tests from `crew.config.json`; short error summary, full log in `.crew/logs/`; each step has `timeout_s` (default 600), a hung step is killed and yields `ci_red` |
235
+ | `crew commit -m "feat: ..."` | commit with `Agent` and `Issue` trailers |
236
+ | `crew pr open` | open a PR (only after a green check), task -> `review` |
237
+ | `crew pr review <n> --verdict approve\|changes --note "..."` | a reviewing agent's verdict (counted by `crew-guard`; you cannot review your own work) |
238
+ | `crew guard --pr <n>` | why a PR does not merge: rules, acceptance tests, review (CI sets the status with `--report`) |
239
+ | `crew task status <id> blocked --note "..."` | change the status and leave a handoff |
240
+ | `crew task release <id>` / `heartbeat <id>` | give a task back / extend the lease (your own only; someone else's needs a human with `--force`) |
241
+ | `crew shots before\|after --url <page> [--name <screen>]` | before/after screenshot (Playwright) for a task that changes the UI; `crew pr open` shows them as a Before / After table |
242
+ | `crew board [--port 4747]` | local task board in the browser: queue by status, PRs waiting; set assignee, status and priority by hand (no agent tokens) |
243
+ | `crew upgrade [--apply]` | update an existing project to the installed version (rules, skills, workflows, agent configs; migrates hk projects); `--apply` opens a PR |
244
+ | `crew ask <area\|@login> --text "..." [--task N] [--human]` | ask the owner of an area; the question is an issue (`crew:question`), the answer arrives in `crew task next` |
245
+ | `crew inbox [--ack N]` / `crew answer N --text "..." [--human]` | questions waiting for you and answers to yours / answer and close (or hand to a human with `needs-human`) |
246
+ | `crew pr waive <n> --rule <r> --reason "..."` | human only: waive a paperwork rule of crew-guard (closes, agent_trailer, not_crew_pr) for the current commit of a PR made outside crew; the review is still required |
247
+ | `crew merge-ready [--dry_run]` | merge PRs that are ready (review, green check and crew-guard) but not auto-merged; the scheduled CI job runs it, no agent session needed |
248
+ | `crew digest [--post]` | team status without an LLM: what needs a human, stale leases, PRs waiting, open questions, idle members; the scheduled CI job keeps it in a pinned issue |
249
+ | `crew task cleanup [--dry_run]` | remove worktrees of closed tasks (only those with no uncommitted changes and with work already saved in main or on GitHub) |
250
+ | `crew task lint` | validate `docs/prd.md` offline: all errors at once (line, id, rule) |
251
+ | `crew task sweep` / `crew task promote` | return expired leases to the queue / move `waiting` tasks to `ready` when their dependencies close (run by CI) |
252
+ | `crew kickoff [--apply]` | create issues and epics from the approved PRD (dry run by default) |
253
+ | `crew status` | what is in the queue, who does what, what is blocked |
254
+ | `crew worker --host codex` | a headless loop that takes tasks and runs an agent on each (humans only) |
255
+ | `crew metrics`, `crew eval` | per-agent metrics from the event log / comparing agents on reference tasks |
256
+ | `crew compliance check` / `disclosure` | event mode: rules check / disclosure file for a submission |
257
+ | `crew up`, `crew init`, `crew adapters build`, `crew labels sync`, `crew doctor` | setup (humans; `crew up` does it all, see docs/AGENT-SETUP.md) |
258
+ | `crew github setup [--apply]` | `main` protection, `CREW_HARNESS` variable, labels: the plan, or with `--apply` execute it (humans) |
259
+ | `crew mcp` | the MCP server: the same commands as `crew_*` tools for agents |
260
+
261
+ The MCP server runs in the project root, so `crew_check`, `crew_commit`, `crew_pr_open`, `crew_task_claim` and `crew_compliance_check` accept an optional `cwd`: the absolute worktree path from `crew_task_claim -> artifacts.worktree`. Without it the tools work on the root, not on the task branch.
262
+
263
+ Every command answers in one shape, so the agent never has to guess:
264
+
265
+ ```json
266
+ {
267
+ "schema": "crew/v1",
268
+ "status": "error",
269
+ "summary": "Failed: api-test",
270
+ "next_actions": ["fix it and run crew check again"],
271
+ "artifacts": { "log": ".crew/logs/check-2026-12-05T12-00-00.txt" },
272
+ "error": {
273
+ "code": "ci_red",
274
+ "cause_hint": "FAILED tests/test_auth.py::test_login - assert 401 == 200",
275
+ "retry": "fix it and run crew check again",
276
+ "stop_when": "the same error 3 times in a row -> crew task status <id> blocked"
277
+ }
278
+ }
279
+ ```
280
+
281
+ ## crew kickoff
282
+
283
+ The planner (skill `crew-kickoff`) reads `docs/brief.md` and `docs/brief-analysis.md` and writes only `docs/prd.md` with `crew-team`, `crew-task` and `crew-epic` blocks ([format](skills/crew-kickoff/task-format.md)). Code creates the issues:
284
+
285
+ ```bash
286
+ crew task lint # validate the PRD offline: all errors at once (line, id, rule)
287
+ crew kickoff # plan (dry run): what will be created, statuses, order
288
+ crew kickoff --apply # create tasks and epics, only if the PRD is approved
289
+ ```
290
+
291
+ - **Approval** is the first PRD line `<!-- crew:prd status: approved by: <login> at: <ISO> -->`. Without it `--apply` answers `plan_not_approved`. Only the captain can apply. `--apply` also refuses with `team_not_collaborator` when the `crew-team` block names someone who is not a collaborator of the repo.
292
+ - **Skeleton**: the first block (`skeleton: true`, `tier/risk: high`); all other tasks implicitly wait for it. A task with dependencies is created as `status:waiting` ("after #N"), without them as `ready`, and `ready: false` gives `needs-spec`.
293
+ - **waiting -> ready** is done by `crew task promote`: the `promote` job in `crew.yml` when an issue closes, and `crew task sweep` on a schedule.
294
+ - **Risk** is `low | med | high` (default `med`), one area per task, acceptance criteria as `Given/When/Then` (Russian `Дано/Когда/Тогда` is also accepted), `req: [R1]` becomes "Brief requirements" in the issue.
295
+ - **Safe to repeat**: tasks are found by the `crew:task` marker in the body and only new ones are created; changed or removed blocks only produce warnings. There is a 1 s pause between `gh issue create` calls and a retry after 10/30/60 s on rate limit; a failure midway is `kickoff_partial`, just run it again.
296
+
297
+ ## crew worker
298
+
299
+ An agent can also work the queue headlessly: a human starts a worker and goes on with their own work.
300
+
301
+ ```bash
302
+ crew worker --host codex --area api --tier mid # Codex takes tasks of area api
303
+ crew worker --host claude --max-tasks 3 --dry-run # show what it would take, touch nothing
304
+ ```
305
+
306
+ The loop: `crew task next` -> `crew task claim <id>` -> the agent starts in the task worktree (`CREW_AGENT=<host>/<model>`) with a short prompt ("work only on #id per crew-workflow; finish with `crew pr open` or `crew task status blocked/needs-spec`") -> the worker checks the issue status -> the next task. **Every task is a new agent process**, i.e. a clean context at the phase boundary.
307
+
308
+ | Flag | Default | What it does |
309
+ |---|---|---|
310
+ | `--host claude\|codex` | none | which agent to launch (`adapter.headless()`) |
311
+ | `--area`, `--tier` | any, `high` | as in `crew task next`; the model comes from `crew.config.json -> tiers` |
312
+ | `--model` | from tier | a specific model |
313
+ | `--max-tasks` | 5 | how many tasks to take per run |
314
+ | `--max-failures` | 3 | stop after N failures in a row |
315
+ | `--task-timeout-min` | 60 | kill the agent (the whole process tree) on a task |
316
+ | `--wait` | off | empty queue: poll every 5 min instead of exiting |
317
+ | `--dry-run` | off | only show the task and the launch command |
318
+
319
+ - **Success**: after the agent exits, the task is in `review`/`done`. `blocked`/`needs-spec` is a handoff, not a failure.
320
+ - **Failure**: the task stayed `claimed` (the agent crashed, exited silently, timed out): the worker runs `crew task release` with a note and a link to the log.
321
+ - **Stops**: pause (`crew:pause`), empty queue, task limit, N failures in a row, 3 claim conflicts in a row, the agent will not start.
322
+ - Task progress goes to stderr, agent output to `.crew/logs/worker-<id>-*.log`, the result is a `crew/v1` answer with `artifacts: { done, failed, blocked, stopped_reason }`.
323
+ - Codex is launched as `codex exec --json -s workspace-write -c sandbox_workspace_write.network_access=true -C <worktree> --add-dir <repo .git> -` (the prompt goes to stdin). Claude as `claude -p <prompt> --output-format json --permission-mode acceptEdits` with an explicit `--allowedTools` list.
324
+ - For humans only: the worker is not exposed over MCP.
325
+
326
+ ## Metrics and eval
327
+
328
+ Without data you cannot tell whether the tool got better, so every `crew` command writes an event to a log.
329
+
330
+ **The log.** After every command a line is appended to `.crew/metrics.jsonl` (in the root of the main repo, shared by all worktrees):
331
+
332
+ ```json
333
+ {"command":"check","issue":12,"agent":"codex/gpt-5","status":"error","error_code":"ci_red","duration_ms":8123,"at":"2026-12-05T12:00:00.000Z"}
334
+ ```
335
+
336
+ The task number comes from the `id` argument, from `artifacts.issue` or from the branch `crew/<id>-...`. It is written only inside a project with `crew.config.json`, and a write never breaks a command. Disable with `CREW_METRICS=off`.
337
+
338
+ **Summary:** `crew metrics [--agent codex] [--since 2d]` shows, per agent:
339
+
340
+ | Metric | How it is computed |
341
+ |---|---|
342
+ | completion rate | successful `pr open` / successful `task claim` |
343
+ | checks per task (retries) | average number of `crew check` runs per task |
344
+ | claim -> PR | median time from claim to the first successful `pr open` of the same task |
345
+ | frequent errors | top 5 `error.code` over all events |
346
+
347
+ `--agent codex` also matches `codex/gpt-5`; `--since` accepts a date, an ISO time or `30m` / `6h` / `2d`.
348
+
349
+ **Eval.** `crew eval` compares agents on the same reference tasks. Use it to see whether a change to `AGENTS.md`, skills or roles made agents worse, and which model to put on which tier:
350
+
351
+ ```bash
352
+ crew eval --dry-run # validate tasks and show the plan, no agents are started
353
+ crew eval --agents claude,codex --runs 3 # tasks x agents x runs
354
+ crew eval --agents claude:opus,claude:sonnet --task fix-off-by-one
355
+ ```
356
+
357
+ Each run happens in a fresh temporary copy of the fixture repo (pinned to `commit` when given): the agent is started through its adapter's `headless()`, then deterministic judges (`command` for tests/build, `grep` for a pattern in files) decide pass/fail. The report is a table plus `artifacts.results`: **pass@1**, **pass@k**, **consistency**, average time and cost (if the agent reports it) per agent and task; the full report is in `.crew/evals/`.
358
+
359
+ Tasks are `evals/tasks/*.json` in a format close to [agent-eval](https://github.com/joaquinhuigomez/agent-eval) (JSON instead of YAML, no dependencies), the fixture is `evals/fixtures/mini-app/`. The format, the mapping to agent-eval and how to add a task are in [`evals/README.md`](evals/README.md). In CI (`.github/workflows/eval.yml`) a `--dry-run` runs on PRs touching `templates/product/AGENTS.md`, `skills/`, `roles/`, `evals/`; a real run is started manually because agents need API keys.
360
+
361
+ ## ECC and optional MCP servers
362
+
363
+ - **[ECC](https://github.com/affaan-m/ECC)** is enabled for Claude Code automatically (`.claude/settings.json`). Which ECC skills to use per role is in [`ecc/profile.json`](ecc/profile.json). ECC is an accelerator, not a dependency: the `crew` protocol works without it, so Codex works as an equal.
364
+ - **Optional MCP servers** live in `crew.config.json -> mcp` and are off by default. Keys come only from environment variables, never from files:
365
+ - `context7`: fresh library and API documentation (enable this first);
366
+ - `perplexity`: deep web search for kickoff and pitches (`PERPLEXITY_API_KEY`; verify the package name before enabling);
367
+ - `playwright`: a browser for end-to-end demo paths.
368
+
369
+ After changing: `crew adapters build`.
370
+
371
+ ## Event mode
372
+
373
+ The tool itself is neutral; for hackathons and other time-boxed events there is an optional mode driven by `events/event.json` (copy it from `event.example.json`, and set `"event": "events/event.json"` in `crew.config.json`; `crew up --start ... --end ...` does this for you):
374
+
375
+ - CI checks that there are no commits before the start or after the end, that PRs come only from `team_members`, and that AI is used only if allowed;
376
+ - `crew compliance check` runs those checks locally; `crew compliance disclosure` writes `DISCLOSURE.md`: which tools and agents were used and how many commits came from whom;
377
+ - the repo of the product is created empty at the start (`crew init`), and during the event only team members commit to it;
378
+ - the product playbooks in `templates/product/docs/playbooks/` describe a timeline for a day of such an event ([`timeline.md`](templates/product/docs/playbooks/timeline.md)), a pre-event checklist ([`preflight.md`](templates/product/docs/playbooks/preflight.md)) and the issue rules: statuses, labels, Definition of Ready, who does what ([`issues.md`](templates/product/docs/playbooks/issues.md)).
379
+
380
+ Always re-read the rules of each event; organizers differ. Without `events/event.json` none of this applies.
381
+
382
+ ## Extending
383
+
384
+ | I want | What to do |
385
+ |---|---|
386
+ | A new `crew` command | a file in `src/commands/` + a line in `src/core/registry.js`; it then appears in both the CLI and MCP |
387
+ | Support for a new agent (Gemini, Cursor, ...) | `adapters/<host>/adapter.js` with `generate()` and `headless()`, add the host to `hosts` |
388
+ | A new stack | `templates/stacks/<name>.json`: areas, generators, checks |
389
+ | A new role or skill | `roles/<name>.md` or `skills/<name>/SKILL.md` (Agent Skills format) |
390
+
391
+ Details: [`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md). What prior art we studied and how we differ: [`docs/RESEARCH.md`](docs/RESEARCH.md).
392
+
393
+ ## Limitations
394
+
395
+ - **Branch protection needs a public repo or GitHub Pro/Team.** A private repo on the free GitHub plan cannot protect `main`; `crew github setup --apply` returns HTTP 403.
396
+ - **`crew-guard` catches laziness and mistakes, not malice.** Agents work under their humans' accounts, so an agent that deliberately forges a `crew:review` marker in someone else's name or merges with `--admin` is not technically stopped; that is forbidden in `AGENTS.md` and visible in PR history. Weakening a test, "fixing" CI or approving its own work by accident will not work.
397
+ - **Headless Claude** for `crew worker` uses `claude -p` with `--permission-mode acceptEdits` and an explicit `--allowedTools` list (file edits, `npm`/`node`/`uv`, read-only `git`, `crew`); the flags follow the Claude Code docs and have had less live testing than Codex. Try one task on your machine first. Headless Codex (`codex exec`) was verified live on codex-cli 0.166: `crew` tools are called without confirmation (`default_tools_approval_mode = "approve"` for the `crew` server only).
398
+ - **The Perplexity MCP package is not chosen:** `templates/mcp.optional.json` contains the placeholder `VERIFY-PACKAGE-NAME-BEFORE-ENABLING`; enable it only after verifying the package name.
399
+ - **Privacy of your rules:** `crew init` copies rules, roles, skills and workflows into the product repo, so if that repo is public, those files are public too.
400
+ - A commit status `crew-guard` set by `GITHUB_TOKEN` is counted with the GitHub Actions `app_id`; if your setup differs, set branch protection to accept "any source".
401
+
402
+ ## Roadmap
403
+
404
+ - [x] **v0**: `crew` (CLI + MCP), AGENTS.md, roles and skills, Claude Code and Codex adapters, GitHub templates, CI, compliance
405
+ - [x] **v1**: MCP in the task worktree (`cwd`), leases by commits, `crew:pause` in code, `crew check` timeouts, config protection in CI, `crew github setup`, `crew worker`, `crew metrics`, `crew eval`, `crew kickoff` with the `crew-team` block, `crew up`, review-first queue; see [`docs/ROADMAP-v1.md`](docs/ROADMAP-v1.md)
406
+ - [ ] **v1 (remaining)**: a `--budget` flag for the worker, verified headless flags for Claude
407
+ - [ ] **v2**: auto-merge of green PRs, nightly checks, a digest bot, adapters for Gemini and Cursor
408
+
409
+ ## Developing the tool itself
410
+
411
+ ```bash
412
+ npm test
413
+ ```
414
+
415
+ Rules for contributors (and their agents) are in [`AGENTS.md`](AGENTS.md) at the root of this repo.
416
+
417
+ ## License
418
+
419
+ Apache-2.0. See [LICENSE](LICENSE).