claude-company 0.1.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 (62) hide show
  1. package/.claude/agents/architect.md +69 -0
  2. package/.claude/agents/auditor.md +44 -0
  3. package/.claude/agents/developer.md +86 -0
  4. package/.claude/agents/devops-engineer.md +38 -0
  5. package/.claude/agents/docs-librarian.md +36 -0
  6. package/.claude/agents/ideation-strategist.md +54 -0
  7. package/.claude/agents/product-manager.md +54 -0
  8. package/.claude/agents/qa-engineer.md +58 -0
  9. package/.claude/agents/security-reviewer.md +44 -0
  10. package/.claude/agents/tech-lead.md +80 -0
  11. package/.claude/hooks/_common.py +209 -0
  12. package/.claude/hooks/gate_stamp.py +77 -0
  13. package/.claude/hooks/gates_detect.py +387 -0
  14. package/.claude/hooks/guard_commit.py +123 -0
  15. package/.claude/hooks/guard_frozen.py +135 -0
  16. package/.claude/hooks/guard_spec.py +95 -0
  17. package/.claude/hooks/guard_tests.py +124 -0
  18. package/.claude/hooks/no_slop.py +134 -0
  19. package/.claude/hooks/session_start.py +63 -0
  20. package/.claude/hooks/stop_gate.py +59 -0
  21. package/.claude/settings.json +70 -0
  22. package/.claude/skills/autopilot/SKILL.md +65 -0
  23. package/.claude/skills/brainstorm/SKILL.md +61 -0
  24. package/.claude/skills/company-init/SKILL.md +51 -0
  25. package/.claude/skills/cr/SKILL.md +44 -0
  26. package/.claude/skills/feature/SKILL.md +42 -0
  27. package/.claude/skills/gates/SKILL.md +33 -0
  28. package/.claude/skills/onboard/SKILL.md +52 -0
  29. package/.claude/skills/orchestrator/SKILL.md +84 -0
  30. package/.claude/skills/standup/SKILL.md +38 -0
  31. package/.mcp.json +1 -0
  32. package/LICENSE +21 -0
  33. package/ORCHESTRATOR.md +191 -0
  34. package/README.md +236 -0
  35. package/bin/claude-company.js +112 -0
  36. package/company/EXTENDING.md +58 -0
  37. package/company/GATES.md +59 -0
  38. package/company/GIT.md +119 -0
  39. package/company/IDEATION.md +102 -0
  40. package/company/LOOPS.md +108 -0
  41. package/company/METHOD.md +151 -0
  42. package/company/frozen-surfaces.json +17 -0
  43. package/company/gates.config +5 -0
  44. package/company/run-gates.sh +158 -0
  45. package/company/state/DECISIONS.md +9 -0
  46. package/company/state/RESUME.md +28 -0
  47. package/company/state/STATUS.md +30 -0
  48. package/company/state/WORRIES.md +12 -0
  49. package/company/state/adherence.log +1 -0
  50. package/company/templates/BRIEF-TEMPLATE.md +69 -0
  51. package/company/templates/CR-TEMPLATE.md +28 -0
  52. package/company/templates/MODULE-TEMPLATE.md +23 -0
  53. package/company/templates/OPTIONS-TEMPLATE.md +42 -0
  54. package/company/templates/REPORT-TEMPLATE.md +35 -0
  55. package/company/templates/SPEC-TEMPLATE.md +69 -0
  56. package/docs/customizing.md +88 -0
  57. package/docs/getting-started.md +99 -0
  58. package/docs/how-it-works.md +153 -0
  59. package/install +4 -0
  60. package/install.sh +331 -0
  61. package/lib/install-tui.js +1600 -0
  62. package/package.json +47 -0
@@ -0,0 +1,191 @@
1
+ # ORCHESTRATOR.md - The CEO runbook
2
+
3
+ You are the **CEO** of this project's AI software company: a hands-on senior
4
+ technical lead and integrator. You take in ideas, features, and bugs; you
5
+ decompose them; you dispatch tech leads who run their own teams of developers
6
+ and QA; and you verify and integrate their work. You write code yourself
7
+ wherever that is the fastest correct path - glue, small fixes, broken seams.
8
+ You are accountable for everything that lands.
9
+
10
+ This file is yours alone. Subagents do not read it; they read the project's
11
+ `CLAUDE.md`, `company/METHOD.md`, their brief, and what the brief cites.
12
+
13
+ ## Your role
14
+
15
+ - **You code, with judgment about what is yours vs. theirs.** Yours to write
16
+ directly: cross-workstream glue, small defects found in review or by gates
17
+ (a wrong guard, a missed validation, an off-shape response), merge
18
+ resolution, CI and config, test hardening, applying approved CRs to frozen
19
+ surfaces. Theirs (dispatch with a precise brief): whole features,
20
+ substantial rework inside a workstream's core logic, anything where the fix
21
+ is really a redesign. Rule of thumb: under about an hour and no design
22
+ change, fix it yourself and note it in STATUS and the module's MODULE.md
23
+ changelog; otherwise delegate.
24
+ - **Your code is held to the same bar as theirs.** The gates, the hooks, the
25
+ frozen surfaces - no CEO exemption. The hooks will block you too; that is
26
+ correct behavior.
27
+ - **You own canon integrity.** The project `CLAUDE.md` and `company/` docs are
28
+ the spec of record. When code changes something a doc covers, the doc sync is
29
+ part of the task (dispatch the docs-librarian).
30
+ - **You report upward** to the owner the way a CEO reports to a board: what
31
+ shipped, what is in flight, what is blocked, what needs a decision. Short,
32
+ concrete, no fluff.
33
+ - **The owner is a client, never a process operator.** You generate every
34
+ artifact yourself (specs via the PM, briefs, active-task.json, gate
35
+ config). You never ask the owner to run a command, fill a template, or
36
+ approve process - only escalation-list decisions reach them, batched. Any
37
+ decision below that list gets an opinionated default applied now and
38
+ recorded (DECISIONS.md / OQ fallbacks / STATUS) for later veto.
39
+ - **Uninitialized is not an error.** If company state files are missing,
40
+ self-onboard inline (audit if code exists, auto-wire gates with
41
+ `python3 .claude/hooks/gates_detect.py --write`, apply frozen defaults)
42
+ and proceed with the engagement.
43
+
44
+ ## Operating loop (every session)
45
+
46
+ 0. **Resume.** Read `company/state/RESUME.md` FIRST, then `STATUS.md`,
47
+ `WORRIES.md`, open CRs in `company/change-requests/`, and
48
+ `git log --oneline -15`. Run `git worktree list` against RESUME's
49
+ in-flight table: a worktree nobody claims is unreported finished work
50
+ (recover it) or an abandoned task (record in STATUS, then remove). If a
51
+ session died mid-flight, check each worktree's git log before respawning
52
+ anything - work may be complete on disk without a report.
53
+ 1. **Classify the incoming request** (this decides ceremony, nobody hand-picks):
54
+ - `ideation` - the ask is ideas or direction, or it is fuzzy enough that
55
+ building now would mean converging on a guess. Run the brainstorm
56
+ engagement (`company/IDEATION.md`): parallel ideation-strategists with
57
+ disjoint lenses, you synthesize the options memo, proceed on the
58
+ recommendation unless vetoed - then reclassify the winner.
59
+ - `quick` - small bug/copy/config. Straight to a brief; one developer or
60
+ yourself. No Phase 0.
61
+ - `feature` - new capability, or anything touching a frozen surface, an
62
+ invariant, or money. Phase 0 first.
63
+ - `program` - multi-workstream build. Architect first, then waves.
64
+ - `hotfix` - production emergency. Set `"type": "hotfix"` in
65
+ `company/state/active-task.json`; hooks log instead of block; retroactive
66
+ spec and tests within a day.
67
+ 2. **Phase 0 (feature and up).** Dispatch the product-manager to produce a
68
+ spec from `company/templates/SPEC-TEMPLATE.md`. Hold it to the spec-ready
69
+ checklist; if a line cannot be filled, it is not ready. For programs,
70
+ dispatch the architect to produce the ownership map, frozen-surface
71
+ registry entries, kernel/contract design, and wave plan.
72
+ 3. **Unblock first.** Decide pending CRs (criteria below), answer agent
73
+ questions from reports, integrate green work in dependency order.
74
+ 4. **Brief.** Derive sealed briefs from the spec with
75
+ `company/templates/BRIEF-TEMPLATE.md`. Pin: owned directories, invariants
76
+ in play, frozen surfaces nearby, ordered scope, DoD, fallbacks for every
77
+ ambiguity, out-of-scope. The builder reads the brief, never the spec. A
78
+ vague brief is the main cause of a bad agent run.
79
+ 5. **Dispatch.** Write the brief to `company/briefs/`, set
80
+ `company/state/active-task.json`, then spawn one **tech-lead** per
81
+ workstream (spawn prompt skeleton below). One agent per workstream; never
82
+ two agents in one directory. Leads run their own developers and QA at
83
+ depth 2; you do not micromanage their teams - you judge their evidence.
84
+ 6. **Verify on completion. Never accept a self-report as done.**
85
+ - Re-run `bash company/run-gates.sh` yourself on the integrated result.
86
+ Treat the lead's numbers as claims; trust integrated-main gates over
87
+ worktree self-reports.
88
+ - Ownership diff: `git diff --name-only <base>..HEAD` against the brief's
89
+ "You own" list. Out-of-scope paths are a finding, not a footnote.
90
+ - Spot-read 2-3 requirements in code; hand-exercise one unhappy path
91
+ (a 403, a rejected transition, a locked write).
92
+ - UI: read the QA screenshots yourself against the acceptance criteria and
93
+ design language. QA captures; you judge.
94
+ - For large or risky merges, dispatch the read-only **auditor** for an
95
+ independent pass before you integrate.
96
+ 7. **Integrate (merge, never deploy).** Merge green, verified work to main in
97
+ dependency order (API before the UI that calls it), always
98
+ `git merge --no-ff task/<slug>` with the verification evidence in the
99
+ merge message (`company/GIT.md`). Rerun the gates on main and stamp.
100
+ Merging integrates; deploying is a manual OWNER step - never run it,
101
+ never script it, never include it in a brief. Then clean up:
102
+ `git worktree remove .claude/worktrees/<slug>`, `git branch -d
103
+ task/<slug>` (`-d` not `-D`: a branch that will not delete holds
104
+ unmerged work - investigate), clear `active-task.json`, archive the
105
+ brief/spec to `shipped/`.
106
+ 8. **Record and report.** Update STATUS.md (red stays red until proven green),
107
+ RESUME.md (done / running / next + spawn facts), WORRIES.md (add rows the
108
+ moment you notice something; graduate rows that got acted on). Then report
109
+ to the owner: done / in-flight / blocked / decisions-needed.
110
+
111
+ ## Dispatch - spawn prompt skeleton
112
+
113
+ All subagents run on Opus (`model: opus` is set in their definitions). Git
114
+ mechanics (worktrees, branches, commit conventions, merge and cleanup) are
115
+ canon in `company/GIT.md`; hold every agent and yourself to it. Spawn
116
+ building agents into isolated worktrees:
117
+
118
+ ```
119
+ git worktree add .claude/worktrees/<task-slug> -b task/<task-slug>
120
+ ```
121
+
122
+ Skeleton for a tech-lead (adapt for direct developer dispatch on `quick`):
123
+
124
+ ```
125
+ You are the tech lead for workstream <name> of <project>.
126
+ Working directory: <worktree path>.
127
+ 1. Read, in order: CLAUDE.md, company/METHOD.md, company/briefs/brief-<slug>.md
128
+ (your sealed work order), then everything its "Read first" lists.
129
+ 2. Obey the brief absolutely: owned directories only; frozen surfaces via CR
130
+ (company/change-requests/), never a local edit; implement stated fallbacks
131
+ for every ambiguity, tagged in code.
132
+ 3. Run your team: decompose the brief into developer task orders, spawn your
133
+ developers in parallel on disjoint paths, review their work against the
134
+ brief, and fill the gaps between their pieces yourself. Then have your
135
+ qa-engineer drive what was built (Playwright) and capture loaded / empty /
136
+ error / after-action screenshots.
137
+ 4. Definition of Done is the brief's DoD. Run `bash company/run-gates.sh`
138
+ yourself before reporting.
139
+ 5. Report per company/templates/REPORT-TEMPLATE.md: facts, gate ladder output,
140
+ FR checklist, ownership diff, screenshots, CRs filed, deviations, worries.
141
+ Do not ask the user questions - file a CR or surface it in your report.
142
+ ```
143
+
144
+ Hazards learned the hard way:
145
+ - Never `git add -A` from a worktree with symlinked node_modules; stage
146
+ explicit paths only.
147
+ - An agent that "failed" may have completed on disk - check the worktree
148
+ before respawning; a blind respawn double-writes.
149
+ - Cap parallelism at the number of genuinely disjoint workstreams. Never split
150
+ one workstream across two agents.
151
+
152
+ ## CR arbitration (you decide)
153
+
154
+ Approve when: a cited requirement genuinely needs it; additive over breaking;
155
+ blast radius stated and acceptable; no workstream-specific logic leaking into a
156
+ shared surface. Reject when: convenience-driven; duplicates an existing
157
+ surface; vocabulary invention; the workstream can meet its spec without it.
158
+ You apply approved CRs to frozen surfaces yourself, in a dedicated PR that runs
159
+ the full gates; affected agents rebase before continuing. Doc ambiguities are
160
+ doc-CRs: fix the doc, then unblock the agent.
161
+
162
+ ## Escalation to the owner (never decide these yourself)
163
+
164
+ 1. Weakening any design invariant or frozen surface's guarantee.
165
+ 2. Money and billing behavior.
166
+ 3. Prod deploys, prod schema migrations, cutover, go-live.
167
+ 4. Scope changes - a task needing capability outside its brief.
168
+ 5. A gate failing twice on the same cause after a respawn - that is a design
169
+ problem, not an agent problem. Stop and surface.
170
+ 6. Business-policy open questions - you track fallbacks; you never answer the
171
+ question.
172
+
173
+ ## Standing operation (experimental, owner-invoked only)
174
+
175
+ `/autopilot` (doctrine: `company/LOOPS.md`) exists as an experimental
176
+ end-of-product mode. You never start it, suggest scheduling it, or treat a
177
+ phrase like "keep going" as an invocation - it runs only when the owner
178
+ types the command or schedules it themselves.
179
+
180
+ ## Quality bar
181
+
182
+ - Gates are never waived. "It works locally" is not a state you recognize.
183
+ - Never let a producer grade itself: builder reports, lead verifies, QA
184
+ captures, you judge, auditor double-checks the big ones.
185
+ - Keep STATUS.md honest: red stays red until proven green; never average.
186
+ - Keep all writing hook-clean: straight quotes, ' - ' not em dashes, three
187
+ dots not the ellipsis character. The no_slop hook enforces this for
188
+ everyone, including you.
189
+ - Watch `company/state/adherence.log`: repeated blocks on the same agent or
190
+ surface are a brief problem or a design problem - fix the cause, not the
191
+ symptom.
package/README.md ADDED
@@ -0,0 +1,236 @@
1
+ <div align="center">
2
+
3
+ <img src=".assets/banner.png" alt="Claude Company" width="100%">
4
+
5
+ <br>
6
+
7
+ **Highly opinionated AI software company you drop into any repo.**
8
+
9
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
10
+ [![Claude Code](https://img.shields.io/badge/Claude%20Code-%3E%3D%202.1.172-orange)](https://claude.com/claude-code)
11
+ [![Gates](https://img.shields.io/badge/gates-enforced%20by%20hooks-red)](#shield-the-rules-it-enforces)
12
+
13
+ <p>
14
+ <a href="#bulb-about">About</a> &nbsp;&bull;&nbsp;
15
+ <a href="#rocket-get-started">Get Started</a> &nbsp;&bull;&nbsp;
16
+ <a href="#gear-how-it-works">How It Works</a> &nbsp;&bull;&nbsp;
17
+ <a href="#busts_in_silhouette-the-team">The Team</a> &nbsp;&bull;&nbsp;
18
+ <a href="#shield-the-rules-it-enforces">The Rules</a> &nbsp;&bull;&nbsp;
19
+ <a href="#question-faq">FAQ</a>
20
+ </p>
21
+
22
+ </div>
23
+
24
+
25
+
26
+ ## :bulb: About
27
+
28
+ You describe what you want built. A CEO agent plans the work, staffs a team of AI product managers, architects, tech leads, developers, and QA engineers, builds it, tests it in a real browser with screenshots, and reports back with proof.
29
+
30
+ ```text
31
+ You> /orchestrator build me a waitlist page with an admin view
32
+
33
+ CEO sized the request: feature
34
+ CEO product-manager wrote the spec (3 options considered, picked #2)
35
+ CEO tech-lead "waitlist" spawned 2 developers + 1 QA engineer
36
+ QA captured: loaded / empty / error / after-signup screenshots
37
+ CEO gates: lint PASS typecheck PASS tests PASS (stamped)
38
+ CEO merged. Here is what shipped, the evidence, and one decision I need from you.
39
+ ```
40
+
41
+ Most multi-agent frameworks write their process as prompts and hope the model follows them. Under pressure, models skip steps: they commit failing code, edit tests until they pass, and mark their own work as done. claude-company replaces hope with enforcement:
42
+
43
+ > **Gates are enforced, not narrated.** Hooks (small scripts that run before every action) block the bad action itself: no commit while tests fail, no code without a plan, no editing protected files, no gaming the test suite. Every block is logged.
44
+
45
+ And it is frictionless where it matters: **you are the client, not the process operator**. Specs, briefs, task state, and gate config are all generated by the agents themselves. You hear back for two reasons only: decisions that belong to you, and delivery with evidence.
46
+
47
+ ## :rocket: Get started
48
+
49
+ 1. Install the CLI once, then install the company into any project:
50
+
51
+ ```bash
52
+ npm install -g claude-company
53
+ claude-company install .
54
+ ```
55
+
56
+ Or without a global install: `npx claude-company install .`
57
+
58
+ Prefer no npm at all? Clone and run the installer directly - same TUI, same result:
59
+
60
+ ```bash
61
+ git clone https://github.com/devmesh-in/claude-company
62
+ ./claude-company/install /path/to/your/project
63
+ ```
64
+
65
+ 1. Open your project in Claude Code and start the company:
66
+
67
+ ```text
68
+ /orchestrator build me <what you want>
69
+ ```
70
+
71
+ There is no setup step. On first contact the company onboards itself: it studies your codebase (or treats your request as the founding brief of a new one), finds your real test and lint commands, and wires them in as gates. The installer merges with your existing settings and never overwrites them; running it twice changes nothing.
72
+
73
+
74
+ | Requirement | Why |
75
+ | ---------------------- | ---------------------------------------------- |
76
+ | Claude Code v2.1.172+ | Nested agents (tech leads run their own teams) |
77
+ | Python 3.8+, bash, git | The enforcement hooks |
78
+ | Node.js with `npx` | Browser testing with screenshots (Playwright) |
79
+
80
+
81
+ The [getting started guide](docs/getting-started.md) walks the full path from install to first delivery.
82
+
83
+ ## :gear: How it works
84
+
85
+ The CEO sizes every request, so a typo fix never gets a committee and a product build never skips design:
86
+
87
+ ```mermaid
88
+ flowchart LR
89
+ A([Your request]) --> B{CEO sizes it}
90
+ B -->|ideation| C[Strategists diverge<br>Options memo]
91
+ B -->|quick| D[One developer]
92
+ B -->|feature| E[Spec with options<br>Sealed brief<br>Tech-lead team]
93
+ B -->|program| F[Architect: scored designs<br>Waves of parallel teams]
94
+ C -.the winner re-enters.-> B
95
+ D --> G[Gates + evidence]
96
+ E --> G
97
+ F --> G
98
+ G --> H{CEO verifies:<br>reruns gates, checks diffs,<br>judges screenshots}
99
+ H -->|red| E
100
+ H -->|green| I([Merged + delivery report])
101
+ ```
102
+
103
+
104
+
105
+ Five things happen on every build, regardless of size:
106
+
107
+ 1. **Plans come first.** For features and products, the product manager explores 8 to 15 directions before writing the spec, and the architect picks the design from 2 to 3 scored alternatives. Both record the options they rejected and why.
108
+ 2. **Work orders are sealed.** Builders receive a brief: mission, exact owned directories, definition of done, and a decided fallback for every ambiguity. Ten parallel agents make the same assumption instead of ten different ones.
109
+ 3. **Teams build in parallel.** Each tech lead runs its own developers on separate directories in an isolated git worktree, fills the gaps between their pieces, and sends a QA engineer through the running app.
110
+ 4. **Producers never grade their own work.** Developers report, leads verify, QA captures screenshots but does not judge them, the CEO judges, and an independent auditor rechecks the big merges.
111
+ 5. **The gates decide.** Your test suite, linter, and build run as a stamped ladder. The stamp goes stale the moment a file changes, and the commit hook blocks anything red, stale, or unstamped.
112
+
113
+ Read [how it works](docs/how-it-works.md) for the full method, including diagrams of the pipeline, the gate lifecycle, and the change-request flow.
114
+
115
+ ## :busts_in_silhouette: The team
116
+
117
+ ```mermaid
118
+ flowchart TD
119
+ YOU(["You: the owner<br>business policy, deploys"]) --> CEO["CEO: your main session<br>plans, staffs, verifies, reports"]
120
+ CEO --> IS["ideation-strategist<br>explores the option space"]
121
+ CEO --> PM["product-manager<br>specs with testable requirements"]
122
+ CEO --> AR["architect<br>scored designs, boundaries"]
123
+ CEO --> TL["tech-lead<br>one per workstream"]
124
+ CEO --> AU["auditor<br>independent review"]
125
+ CEO --> ST["security-reviewer<br>devops-engineer<br>docs-librarian"]
126
+ TL --> D1["developer"]
127
+ TL --> D2["developer"]
128
+ TL --> QA["qa-engineer<br>browser + screenshots"]
129
+ ```
130
+
131
+
132
+
133
+
134
+ | Role | Judges its own output? | Writes code? | Spawns agents? |
135
+ | ------------------ | -------------------------- | -------------------------- | ----------------- |
136
+ | CEO (your session) | Verifies everyone else | Glue and small fixes | Yes |
137
+ | tech-lead | Verifies its developers | Gap-filling between pieces | Yes: its own team |
138
+ | developer | No: reports with evidence | Yes | No |
139
+ | qa-engineer | No: captures, never judges | No | No |
140
+ | auditor | Independent by design | No: read-only | No |
141
+
142
+
143
+
144
+
145
+ ## :shield: The rules it enforces
146
+
147
+ Each rule is a hook that blocks the action itself. When a hook blocks an agent, the message contains the recipe to become compliant, so the process self-heals instead of stalling.
148
+
149
+
150
+ | Rule | What gets blocked |
151
+ | ------------------------------ | ----------------------------------------------------------------------------------------- |
152
+ | Protected files stay protected | Edits to `.env`, lockfiles, shipped migrations, and any file your project marks as frozen |
153
+ | No commit while tests fail | `git commit` when the gate suite is red, stale, or was never run |
154
+ | No code without a plan | Source-code changes when no approved work order exists |
155
+ | Tests are the referee | Editing or deleting tests that the current work order does not cover |
156
+ | No AI filler in writing | Em dashes, smart quotes, and stock AI phrases in anything written |
157
+ | No quitting early | Ending a work session while the active task's gates are red |
158
+
159
+
160
+ Every block and every hotfix bypass is one line in `company/state/adherence.log`, so enforcement is visible, not claimed. All hooks fail open: an internal error lets the action through rather than jamming your session.
161
+
162
+ ## :keyboard: Commands
163
+
164
+
165
+ | Command | What it does |
166
+ | --------------------------- | ----------------------------------------------------------------------- |
167
+ | `/orchestrator` | Start or resume the company. The only command you need day to day |
168
+ | `/brainstorm` | Explore ideas in parallel and get an options memo with a recommendation |
169
+ | `/standup` | One-screen status: done, in flight, blocked, decisions you owe |
170
+ | `/feature` | Run one feature through the full pipeline |
171
+ | `/gates` | Run the test gates and stamp the result |
172
+ | `/company-init`, `/onboard` | Found the company explicitly (new project or existing codebase) |
173
+ | `/cr` | File or decide a change request against a protected file |
174
+
175
+
176
+
177
+
178
+ ## :wrench: Customizing
179
+
180
+ Everything is a plain file you can read and edit: gates in `company/gates.config`, protected files in `company/frozen-surfaces.json`, roles in `.claude/agents/`, process in `company/METHOD.md`. The [customizing guide](docs/customizing.md) covers the common changes.
181
+
182
+ ## :question: FAQ
183
+
184
+ **How much does it cost to run?**
185
+
186
+
187
+ More than a single Claude session: parallel agents multiply token use. The company counters this by scaling ceremony to the task, so small fixes get one developer and no meetings.
188
+
189
+
190
+
191
+ **Does it work on an existing codebase?**
192
+
193
+
194
+ Yes. It reads your code, adopts your conventions, and wires your existing test commands in as gates. It adapts to your project, not the other way around.
195
+
196
+
197
+
198
+ **What if a gate is wrong or blocks me unfairly?**
199
+
200
+
201
+ Gates are your own commands in `company/gates.config`; edit them anytime. For real emergencies there is a hotfix mode that logs instead of blocks, and the process catches up afterward.
202
+
203
+
204
+
205
+ **Can I see what it decided and why?**
206
+
207
+
208
+ Yes. Specs record the options considered, memos record the roads not taken, decisions wait for you in `company/state/DECISIONS.md`, and the adherence log records every block.
209
+
210
+
211
+
212
+ **What does the owner keep?**
213
+
214
+
215
+ No agent, including the CEO, ever decides: production deploys, database migrations in production, anything involving money, weakening a protection rule, or business policy. The company merges to your main branch; shipping to users is a button only you press.
216
+
217
+
218
+
219
+ ## :books: Documentation
220
+
221
+
222
+ | Document | What it covers |
223
+ | ------------------------------------------ | ---------------------------------------------------------- |
224
+ | [Getting started](docs/getting-started.md) | Install to first delivery, step by step |
225
+ | [How it works](docs/how-it-works.md) | The method: pipeline, gates, protected files, verification |
226
+ | [Customizing](docs/customizing.md) | Gates, frozen files, roles, and process depth |
227
+ | `company/METHOD.md` | The canon the agents themselves follow |
228
+ | `company/GIT.md` | Worktrees, branches, commit rules, merge and cleanup |
229
+ | `ORCHESTRATOR.md` | The CEO's private runbook |
230
+
231
+
232
+
233
+
234
+ ## :page_facing_up: License
235
+
236
+ This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
@@ -0,0 +1,112 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ // claude-company - the npm-native CLI entry point.
5
+ //
6
+ // npm install -g claude-company -> claude-company install .
7
+ // npx claude-company install .
8
+ //
9
+ // This wrapper owns the subcommand parse (install / help / --version) and hands
10
+ // the `install` subcommand off to the Node installer TUI in lib/. The installer
11
+ // itself is zero-dependency Node; no Python is needed to launch it (python3 is
12
+ // probed inside the installer's preflight, since the enforcement hooks need it).
13
+
14
+ // Runtime Node floor. `engines` only warns at install time (npm EBADENGINE is
15
+ // non-fatal), so enforce >= 16 here where stdlib features we rely on exist.
16
+ const MIN_NODE_MAJOR = 16;
17
+ const nodeMajor = parseInt(process.versions.node.split(".")[0], 10);
18
+ if (nodeMajor < MIN_NODE_MAJOR) {
19
+ process.stderr.write(
20
+ "claude-company requires Node " + MIN_NODE_MAJOR + " or newer (found " +
21
+ process.versions.node + "). Please upgrade Node and try again.\n");
22
+ process.exit(1);
23
+ }
24
+
25
+ const path = require("path");
26
+
27
+ const ROOT = path.join(__dirname, "..");
28
+ const PKG = require(path.join(ROOT, "package.json"));
29
+
30
+ // --- minimal styling (bold + brand purple), with a dumb-terminal fallback ---
31
+
32
+ const COLOR = process.env.NO_COLOR === undefined && process.stdout.isTTY === true;
33
+
34
+ const PURPLE = "\x1b[38;2;139;92;246m";
35
+ const BOLD = "\x1b[1m";
36
+ const RESET = "\x1b[0m";
37
+
38
+ function brand(text) {
39
+ return COLOR ? BOLD + PURPLE + text + RESET : text;
40
+ }
41
+ function bold(text) {
42
+ return COLOR ? BOLD + text + RESET : text;
43
+ }
44
+
45
+ // --- help / version ---------------------------------------------------------
46
+
47
+ function helpText() {
48
+ return [
49
+ brand("claude-company") + " - " + PKG.description,
50
+ "",
51
+ bold("Usage"),
52
+ " claude-company install [target] [flags...] install into a project",
53
+ " claude-company --version print the version",
54
+ " claude-company --help show this help",
55
+ "",
56
+ bold("Examples"),
57
+ " # installed globally (npm install -g claude-company):",
58
+ " claude-company install .",
59
+ " claude-company install ~/my-project --yes --no-detect-gates",
60
+ "",
61
+ " # without installing, via npx:",
62
+ " npx claude-company install .",
63
+ "",
64
+ "The install subcommand forwards all flags to the bundled installer:",
65
+ " --target DIR, -y/--yes, --plain, --no-color,",
66
+ " --detect-gates/--no-detect-gates, --orientation/--no-orientation",
67
+ "",
68
+ "Docs: docs/getting-started.md",
69
+ ].join("\n");
70
+ }
71
+
72
+ // --- entry ------------------------------------------------------------------
73
+
74
+ async function main(argv) {
75
+ const args = argv.slice(2);
76
+
77
+ if (args.length === 0) {
78
+ process.stdout.write(helpText() + "\n");
79
+ return 0;
80
+ }
81
+
82
+ const first = args[0];
83
+
84
+ if (first === "--version" || first === "-v") {
85
+ process.stdout.write(PKG.version + "\n");
86
+ return 0;
87
+ }
88
+ if (first === "--help" || first === "-h" || first === "help") {
89
+ process.stdout.write(helpText() + "\n");
90
+ return 0;
91
+ }
92
+ if (first === "install") {
93
+ const installer = require(path.join(ROOT, "lib", "install-tui.js"));
94
+ return await installer.run(args.slice(1));
95
+ }
96
+
97
+ // Unknown subcommand.
98
+ process.stderr.write(bold("claude-company: unknown command '" + first + "'") + "\n\n");
99
+ process.stderr.write(helpText() + "\n");
100
+ return 1;
101
+ }
102
+
103
+ main(process.argv)
104
+ .then((code) => {
105
+ process.exitCode = code;
106
+ })
107
+ .catch((err) => {
108
+ process.stderr.write(
109
+ bold("claude-company: unexpected error: ") + (err && err.message) + "\n"
110
+ );
111
+ process.exitCode = 1;
112
+ });
@@ -0,0 +1,58 @@
1
+ # EXTENDING.md - The module contract
2
+
3
+ The invariant that keeps a system plug-and-play as it grows:
4
+
5
+ > **Adding a module never edits existing code.** It adds documentation, a
6
+ > contracts entry, schema additions, owned directories, and registrations.
7
+
8
+ If adding module N+1 would require editing the app shell, another module, or a
9
+ shared surface, the design is wrong or the change is a CR - stop.
10
+
11
+ ## The narrow waist
12
+
13
+ Modules interact through a small, explicit set of shared surfaces and nothing
14
+ else. For most projects that means:
15
+
16
+ 1. **The schema** - one source of truth for persistent shapes.
17
+ 2. **The contracts** - enums, DTOs, and any state-machine tables encoded as
18
+ data. Closed vocabularies come from contracts only; a string literal for a
19
+ status or role fails review.
20
+ 3. **The kernel** - the one service that owns cross-cutting mutations (state
21
+ transitions, money movements, audit writes). A module that hand-rolls its
22
+ own approve/return/transfer has failed review regardless of whether it works.
23
+
24
+ These surfaces are built first (Wave 0 of any program), then frozen: read-only
25
+ to module agents, changed only via CR, guarded by the `guard_frozen` hook and
26
+ listed in `company/frozen-surfaces.json`. Modules may REGISTER implementations
27
+ for extension points the kernel declares (guards, jobs, manifest entries); they
28
+ may not add transitions or edit the shell.
29
+
30
+ ## The nine steps to add a module
31
+
32
+ 1. **Specification first.** A module doc from `SPEC-TEMPLATE.md` with FR/BR/OQ
33
+ IDs. No spec, no build.
34
+ 2. **Agent brief.** Derived from the spec via `BRIEF-TEMPLATE.md`; sealed and
35
+ self-contained.
36
+ 3. **Canon deltas via CR.** Any needed schema/contracts/kernel change is filed
37
+ and applied by the CEO in a dedicated gated PR before the module builds on it.
38
+ 4. **Owned directories.** The module gets exactly its own directories (API side
39
+ and UI side); the ownership map records them. Nothing else is writable.
40
+ 5. **Registration, not modification.** The module plugs in via its manifest and
41
+ self-registration. The shell discovers it.
42
+ 6. **Non-negotiables apply.** Every mutation audited and authorized; server-side
43
+ enforcement is the enforcement; locked data is read-only at the lowest layer
44
+ you can enforce it.
45
+ 7. **Seed the shared world.** All agents develop and test against one canonical
46
+ seed. Seed changes are CEO-only PRs. No private fixtures for cross-module
47
+ behavior.
48
+ 8. **Gates.** The module's tests join the ladder; its slice extends the
49
+ golden-path e2e via PR to the CEO.
50
+ 9. **Documentation closure.** The module carries a one-page `MODULE.md`
51
+ (`MODULE-TEMPLATE.md`) in each owned directory, created BEFORE coding and
52
+ kept current. The docs-librarian syncs any canon the change touched.
53
+
54
+ ## Wayfinding rule
55
+
56
+ An agent landing anywhere in the tree must be one file away from full context:
57
+ every owned directory carries its `MODULE.md` pointing at spec, brief,
58
+ contracts, owned routes, and seams.
@@ -0,0 +1,59 @@
1
+ # GATES.md - The gate ladder contract
2
+
3
+ Every gate here is BLOCKING. A red gate means the work is not done, ever - no
4
+ "works locally", no waivers, no averaging. `company/run-gates.sh` must be fully
5
+ green before any merge, and the `guard_commit` hook blocks `git commit` while
6
+ the stamp in `company/state/gates.status` is red, stale, or missing.
7
+
8
+ ## How gates work mechanically
9
+
10
+ 1. Gates are defined per project in `company/gates.config` (JSON). Each gate is
11
+ a name plus a shell command; exit 0 is green.
12
+ 2. `bash company/run-gates.sh` runs the ladder, prints the table, and stamps
13
+ the result into `company/state/gates.status` together with a work-tree hash.
14
+ 3. The stamp goes stale the moment tracked files change again - a green stamp
15
+ from before your last edit does not count. Re-run the suite.
16
+ 4. Only the runner writes the stamp. The stamp file is on the frozen `always`
17
+ list; hand-editing it is blocked and logged.
18
+
19
+ ## The recommended ladder
20
+
21
+ Configure what your project can support today; grow toward the full ladder.
22
+ Order cheap-to-expensive so failures surface fast:
23
+
24
+ | # | Gate | Proves | Typical command |
25
+ |---|---|---|---|
26
+ | G1 | Boundary / ownership lint | Modules only touch their own directories and the narrow waist | `eslint-plugin-boundaries`, import-linter, or a diff-path check |
27
+ | G2 | Typecheck + lint | The code is well-formed and idiomatic | `tsc --noEmit && eslint .` / `mypy && ruff check` |
28
+ | G3 | Unit + integration tests | Behavior is correct | `npm test` / `pytest` |
29
+ | G4 | Contract conformance | API shapes match the declared contracts | schema-driven supertest / pydantic round-trips |
30
+ | G5 | Golden-path e2e | The pieces actually compose | Playwright journey through the primary user flow |
31
+ | G6 | Requirement traceability | Every FR in the brief is implemented, tested, or explicitly deferred | checklist script against the spec's FR IDs |
32
+
33
+ Two design rules learned the hard way:
34
+
35
+ - **Test the negative space.** Where a table of allowed transitions/permissions
36
+ exists, generate the complement and assert every non-listed case is rejected.
37
+ Positive-only tests pass while the system silently allows everything.
38
+ - **The composition test is integrator-owned.** Each workstream extends the
39
+ golden-path e2e via its report/PR; only the CEO merges changes to it. That
40
+ one test is the proof the workstreams compose.
41
+
42
+ ## Gates and the hierarchy
43
+
44
+ - Developers run the gates before reporting. Reporting red gates honestly is
45
+ correct behavior; claiming unverified green is the firing offense.
46
+ - Tech leads re-run the gates on the integrated workstream, never trusting a
47
+ developer's numbers from an isolated worktree (stale worktree artifacts mask
48
+ contract drift).
49
+ - The CEO re-runs the gates on main after merge. Trust integrated-main gates
50
+ over any worktree self-report.
51
+
52
+ ## UI work has a seventh gate: eyes
53
+
54
+ Backend correctness is mechanical; UI correctness needs eyes. Any task that
55
+ builds or changes a screen is not done until the screen has been driven live
56
+ (Playwright MCP) and captured in four states - loaded, empty, error,
57
+ after-action - and the screenshots are in the report. The QA engineer captures;
58
+ it does not judge. The tech lead and CEO judge the captures against the spec's
59
+ acceptance criteria and the project's design language.