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.
- package/.claude/agents/architect.md +69 -0
- package/.claude/agents/auditor.md +44 -0
- package/.claude/agents/developer.md +86 -0
- package/.claude/agents/devops-engineer.md +38 -0
- package/.claude/agents/docs-librarian.md +36 -0
- package/.claude/agents/ideation-strategist.md +54 -0
- package/.claude/agents/product-manager.md +54 -0
- package/.claude/agents/qa-engineer.md +58 -0
- package/.claude/agents/security-reviewer.md +44 -0
- package/.claude/agents/tech-lead.md +80 -0
- package/.claude/hooks/_common.py +209 -0
- package/.claude/hooks/gate_stamp.py +77 -0
- package/.claude/hooks/gates_detect.py +387 -0
- package/.claude/hooks/guard_commit.py +123 -0
- package/.claude/hooks/guard_frozen.py +135 -0
- package/.claude/hooks/guard_spec.py +95 -0
- package/.claude/hooks/guard_tests.py +124 -0
- package/.claude/hooks/no_slop.py +134 -0
- package/.claude/hooks/session_start.py +63 -0
- package/.claude/hooks/stop_gate.py +59 -0
- package/.claude/settings.json +70 -0
- package/.claude/skills/autopilot/SKILL.md +65 -0
- package/.claude/skills/brainstorm/SKILL.md +61 -0
- package/.claude/skills/company-init/SKILL.md +51 -0
- package/.claude/skills/cr/SKILL.md +44 -0
- package/.claude/skills/feature/SKILL.md +42 -0
- package/.claude/skills/gates/SKILL.md +33 -0
- package/.claude/skills/onboard/SKILL.md +52 -0
- package/.claude/skills/orchestrator/SKILL.md +84 -0
- package/.claude/skills/standup/SKILL.md +38 -0
- package/.mcp.json +1 -0
- package/LICENSE +21 -0
- package/ORCHESTRATOR.md +191 -0
- package/README.md +236 -0
- package/bin/claude-company.js +112 -0
- package/company/EXTENDING.md +58 -0
- package/company/GATES.md +59 -0
- package/company/GIT.md +119 -0
- package/company/IDEATION.md +102 -0
- package/company/LOOPS.md +108 -0
- package/company/METHOD.md +151 -0
- package/company/frozen-surfaces.json +17 -0
- package/company/gates.config +5 -0
- package/company/run-gates.sh +158 -0
- package/company/state/DECISIONS.md +9 -0
- package/company/state/RESUME.md +28 -0
- package/company/state/STATUS.md +30 -0
- package/company/state/WORRIES.md +12 -0
- package/company/state/adherence.log +1 -0
- package/company/templates/BRIEF-TEMPLATE.md +69 -0
- package/company/templates/CR-TEMPLATE.md +28 -0
- package/company/templates/MODULE-TEMPLATE.md +23 -0
- package/company/templates/OPTIONS-TEMPLATE.md +42 -0
- package/company/templates/REPORT-TEMPLATE.md +35 -0
- package/company/templates/SPEC-TEMPLATE.md +69 -0
- package/docs/customizing.md +88 -0
- package/docs/getting-started.md +99 -0
- package/docs/how-it-works.md +153 -0
- package/install +4 -0
- package/install.sh +331 -0
- package/lib/install-tui.js +1600 -0
- package/package.json +47 -0
package/company/GIT.md
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# GIT.md - Worktrees, branches, commits, and integration
|
|
2
|
+
|
|
3
|
+
How this company uses git. Every agent that touches the repository follows
|
|
4
|
+
this page; the CEO enforces it at integration. The goal is that parallel
|
|
5
|
+
teams cannot collide, every commit traces to a work order, and the repository
|
|
6
|
+
tells the truth about what happened.
|
|
7
|
+
|
|
8
|
+
## The model in one picture
|
|
9
|
+
|
|
10
|
+
```text
|
|
11
|
+
main integration branch. Protected: no direct push
|
|
12
|
+
(hook-enforced), merges by the CEO only.
|
|
13
|
+
task/<slug> one branch per workstream, created WITH its
|
|
14
|
+
worktree. Lives in .claude/worktrees/<slug>.
|
|
15
|
+
(developers) work INSIDE the lead's worktree, on the
|
|
16
|
+
disjoint directories their task orders name.
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
One workstream = one worktree = one branch = one accountable tech lead.
|
|
20
|
+
|
|
21
|
+
## Worktrees
|
|
22
|
+
|
|
23
|
+
Create (CEO does this at dispatch):
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
git worktree add .claude/worktrees/<task-slug> -b task/<task-slug>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
- **Developers do not get their own worktrees.** A lead's developers share
|
|
30
|
+
the lead's worktree and are kept apart by directory ownership, which their
|
|
31
|
+
task orders name exactly. Separate worktrees per developer would multiply
|
|
32
|
+
dependency installs and stale build artifacts without adding isolation the
|
|
33
|
+
ownership map does not already give.
|
|
34
|
+
- **One agent per directory, ever.** If two agents need the same directory,
|
|
35
|
+
the decomposition is wrong; fix the task orders, not the git layout.
|
|
36
|
+
- **QA works in the same worktree read-only** and saves screenshots to
|
|
37
|
+
`company/evidence/<task-slug>/`, which is committed with the task: the
|
|
38
|
+
evidence bundle is part of the deliverable.
|
|
39
|
+
- Never nest a worktree inside another worktree, and never run two leads in
|
|
40
|
+
one worktree.
|
|
41
|
+
|
|
42
|
+
## Commits
|
|
43
|
+
|
|
44
|
+
- **Conventional messages, scoped to the workstream:**
|
|
45
|
+
`feat(waitlist): add signup endpoint`, `fix(api): reject expired tokens`.
|
|
46
|
+
Subject line 72 characters or less, imperative mood.
|
|
47
|
+
- **Reference the work order.** Every commit on a task branch carries a
|
|
48
|
+
trailer naming the brief: `Task: <task-slug>`. Cite requirement ids in the
|
|
49
|
+
body when a commit implements them (`Implements: FR-03, FR-04`).
|
|
50
|
+
- **Stage explicit paths only.** Never `git add -A` or `git add .` from a
|
|
51
|
+
worktree: symlinked `node_modules` and stray artifacts get staged and can
|
|
52
|
+
destroy the real thing on checkout. Name the files you mean.
|
|
53
|
+
- **Commit per coherent step**, not per session. A session must not end with
|
|
54
|
+
uncommitted work unless the report says so and why.
|
|
55
|
+
|
|
56
|
+
## Sync discipline
|
|
57
|
+
|
|
58
|
+
- **Rebase at session start.** An agent resuming work in an existing
|
|
59
|
+
worktree rebases onto main first: `git rebase main`. Same after the CEO
|
|
60
|
+
applies any change request to a frozen surface.
|
|
61
|
+
- **Conflicts have meaning.** A conflict inside your owned directories is
|
|
62
|
+
yours to resolve now. A conflict that crosses an ownership boundary means
|
|
63
|
+
the ownership map is wrong: stop and surface it; do not resolve it by
|
|
64
|
+
judgment.
|
|
65
|
+
|
|
66
|
+
## Integration (CEO only)
|
|
67
|
+
|
|
68
|
+
Merge only after verification (gates rerun on the integrated result,
|
|
69
|
+
ownership diff checked, evidence judged - see `ORCHESTRATOR.md`):
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
git merge --no-ff task/<task-slug>
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
- **Always `--no-ff`**: the merge commit is the audit record. Its message
|
|
76
|
+
carries the task slug, the gate summary, and what was verified:
|
|
77
|
+
|
|
78
|
+
```text
|
|
79
|
+
merge task/waitlist: signup + admin view
|
|
80
|
+
|
|
81
|
+
Verified: gates green on integrated main, ownership diff clean,
|
|
82
|
+
QA evidence judged against acceptance criteria.
|
|
83
|
+
Task: waitlist
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
- **Dependency order**: the API side merges before the UI that calls it;
|
|
87
|
+
within a program wave, providers before consumers.
|
|
88
|
+
- **After every merge**: rerun the gates on main and stamp, then clean up.
|
|
89
|
+
|
|
90
|
+
## Cleanup
|
|
91
|
+
|
|
92
|
+
After a task integrates (or is abandoned):
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
git worktree remove .claude/worktrees/<task-slug>
|
|
96
|
+
git branch -d task/<task-slug>
|
|
97
|
+
git worktree prune
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
- Use `-d`, not `-D`. A branch that will not delete cleanly holds unmerged
|
|
101
|
+
work: investigate before forcing, because a "failed" agent may have
|
|
102
|
+
finished on disk without reporting.
|
|
103
|
+
- **Session-start hygiene (CEO):** `git worktree list` and compare against
|
|
104
|
+
RESUME.md's in-flight table. A worktree nobody claims is either unreported
|
|
105
|
+
finished work (recover it) or an abandoned task (record the abandonment in
|
|
106
|
+
STATUS, then remove).
|
|
107
|
+
|
|
108
|
+
## Hazards (learned the hard way)
|
|
109
|
+
|
|
110
|
+
- `git add -A` in a worktree with symlinked `node_modules` can stage the
|
|
111
|
+
symlink and destroy the real directory. Explicit paths only.
|
|
112
|
+
- A dead agent's worktree may contain completed work; a blind respawn
|
|
113
|
+
double-writes. Read the worktree's `git log` first.
|
|
114
|
+
- A worktree's green gate stamp proves that worktree only. Stale artifacts
|
|
115
|
+
in worktrees mask contract drift; the integrated-main stamp is the one
|
|
116
|
+
that counts.
|
|
117
|
+
- Pushing is owner territory: no agent pushes to main/master (hook-blocked).
|
|
118
|
+
Remote pushes of task branches happen only if the owner has asked for
|
|
119
|
+
remote backups or PR-based review.
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# IDEATION.md - How this company thinks before it builds
|
|
2
|
+
|
|
3
|
+
Great builds die in the first five minutes, when the first workable idea gets
|
|
4
|
+
mistaken for the best one. This playbook is how the company generates and
|
|
5
|
+
selects ideas - for products, features, and architectures - at a
|
|
6
|
+
production-grade bar.
|
|
7
|
+
|
|
8
|
+
Two standing doctrines:
|
|
9
|
+
|
|
10
|
+
1. **Diverge before you converge.** Never spec, design, or build the first
|
|
11
|
+
idea that works. Generate a real option space (the patterns below), then
|
|
12
|
+
converge with explicit criteria. The road not taken is recorded in the
|
|
13
|
+
options memo so the client can see it and veto the choice.
|
|
14
|
+
2. **Autonomous posture.** Ideation never interviews the client. The company
|
|
15
|
+
runs the patterns itself, converges to a recommendation, and delivers an
|
|
16
|
+
options memo (`company/templates/OPTIONS-TEMPLATE.md`) with veto rights.
|
|
17
|
+
The only exceptions are the standing owner-escalation topics (money,
|
|
18
|
+
business policy), which land as decisions in the memo, not questions
|
|
19
|
+
mid-flow.
|
|
20
|
+
|
|
21
|
+
## The patterns (pick by goal, use at least three categories per divergence)
|
|
22
|
+
|
|
23
|
+
**Goal: quantity - fill the option space fast (8-15 directions)**
|
|
24
|
+
|
|
25
|
+
1. **Perspective multiplication.** Generate ideas as N distinct stakeholders
|
|
26
|
+
would see the problem: the daily power user, the first-time user, the
|
|
27
|
+
admin, the attacker, the support engineer, the CFO, the competitor. Each
|
|
28
|
+
perspective must produce at least one idea the others would not.
|
|
29
|
+
2. **Feature decomposition (SCAMPER).** Take the current or obvious solution
|
|
30
|
+
and systematically Substitute, Combine, Adapt, Modify/Magnify, Put to
|
|
31
|
+
other uses, Eliminate, Reverse each major attribute. Eliminate is the
|
|
32
|
+
most underused: what if this feature simply did not exist - what would
|
|
33
|
+
users do, and is THAT the product?
|
|
34
|
+
|
|
35
|
+
**Goal: depth - refine promising directions**
|
|
36
|
+
|
|
37
|
+
3. **Constraint variation.** Re-solve the same problem under artificial
|
|
38
|
+
constraints, one at a time: 10x less budget, zero new dependencies, must
|
|
39
|
+
ship in a day, must work offline, one-tenth the UI. Constraints expose
|
|
40
|
+
which parts of a design are load-bearing and which are habit.
|
|
41
|
+
4. **Chain refinement.** Take the strongest idea and run three explicit
|
|
42
|
+
passes: strip it to its irreducible core; find the weakest assumption and
|
|
43
|
+
redesign without it; then add back only what earns its place.
|
|
44
|
+
|
|
45
|
+
**Goal: breakthrough - escape the local maximum**
|
|
46
|
+
|
|
47
|
+
5. **Inversion.** State the goal, then design for the opposite: "how would we
|
|
48
|
+
guarantee users churn / data corrupts / the team ships slowly" - then read
|
|
49
|
+
the anti-design as a checklist of what the real design must prevent. The
|
|
50
|
+
negative space usually contains at least one requirement nobody listed.
|
|
51
|
+
6. **Extreme scaling.** Redesign as if usage were 100x, then as if it were
|
|
52
|
+
1/100th (a single user who pays 100x). The 100x version surfaces the
|
|
53
|
+
architecture; the 1/100th version surfaces the actual value.
|
|
54
|
+
7. **Analogical transfer.** Name three domains that solved a structurally
|
|
55
|
+
similar problem (logistics, gaming, banking, biology) and port their
|
|
56
|
+
mechanism, not their surface. Say the mapping out loud: "X is to us what
|
|
57
|
+
the dispatch board is to trucking."
|
|
58
|
+
|
|
59
|
+
**Goal: differentiation - win against alternatives**
|
|
60
|
+
|
|
61
|
+
8. **Competitive positioning matrix.** List the real alternatives (including
|
|
62
|
+
"do nothing" and spreadsheets), score them on the two axes clients
|
|
63
|
+
actually feel, and design for the empty quadrant. An idea that lands in
|
|
64
|
+
an occupied quadrant needs a 10x edge or a different quadrant.
|
|
65
|
+
|
|
66
|
+
**Goal: customer-centric - features that matter**
|
|
67
|
+
|
|
68
|
+
9. **Journey friction walk.** Walk the primary persona's end-to-end journey
|
|
69
|
+
step by step; at each step ask what they feel, what they wait for, what
|
|
70
|
+
they re-enter, what they screenshot to send someone. Every friction point
|
|
71
|
+
is a feature candidate ranked by frequency x pain.
|
|
72
|
+
10. **Assumption challenge.** List the premises the request smuggles in
|
|
73
|
+
("users want a dashboard", "this needs accounts"), then generate one
|
|
74
|
+
idea per premise that drops it. Half of production-grade simplicity is
|
|
75
|
+
a premise someone refused.
|
|
76
|
+
|
|
77
|
+
## Output discipline (applies to every divergence)
|
|
78
|
+
|
|
79
|
+
- Ideas are NUMBERED, in a table: `# | Idea | Reasoning | Production risks |
|
|
80
|
+
Trade-offs`. Reasoning is mandatory - an idea without a why is a slogan.
|
|
81
|
+
- Convergence uses explicit, written criteria (client value, production
|
|
82
|
+
risk, cost to build, cost to operate, reversibility) - never vibes.
|
|
83
|
+
- Production-grade filter before any idea reaches the memo: how does it
|
|
84
|
+
fail, how is it observed, what does it cost at 10x, can it be rolled back,
|
|
85
|
+
what does it force on future modules?
|
|
86
|
+
- The memo records winners AND the strongest rejected option with the reason
|
|
87
|
+
it lost. If the strongest rejected option keeps winning arguments later,
|
|
88
|
+
the convergence was wrong - reopen it.
|
|
89
|
+
|
|
90
|
+
## Who runs what
|
|
91
|
+
|
|
92
|
+
- **product-manager**: divergence is mandatory before any spec (8-15
|
|
93
|
+
directions, at least 3 pattern categories); the spec carries an "options
|
|
94
|
+
considered" section.
|
|
95
|
+
- **architect**: the solutioning gate - 2-3 scored architecture options
|
|
96
|
+
before any program build; the memo shows the scoring.
|
|
97
|
+
- **ideation-strategist**: deep divergence on demand. For big engagements
|
|
98
|
+
the CEO spawns 2-3 strategists in parallel with different assigned lenses
|
|
99
|
+
and synthesizes their outputs into one memo.
|
|
100
|
+
- **CEO**: classifies fuzzy or new-idea requests as `ideation` engagements,
|
|
101
|
+
synthesizes memos, owns the recommendation, and proceeds on it unless the
|
|
102
|
+
client vetoes.
|
package/company/LOOPS.md
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# LOOPS.md - Standing operation (loop engineering) [EXPERIMENTAL]
|
|
2
|
+
|
|
3
|
+
**Experimental and strictly opt-in.** Nothing in this page runs unless the
|
|
4
|
+
owner explicitly invokes `/autopilot` or schedules it themselves. No agent,
|
|
5
|
+
including the CEO, starts a loop on its own initiative. The intended moment
|
|
6
|
+
is the end phase of a product: the main build shipped interactively, and the
|
|
7
|
+
loop burns down the backlog, polish items, and worry ledger in bounded,
|
|
8
|
+
reviewable ticks.
|
|
9
|
+
|
|
10
|
+
Prompting the company task by task is mode one. Mode two is the loop: the
|
|
11
|
+
company runs on a heartbeat, discovers its own work, executes it through the
|
|
12
|
+
normal pipeline, and surfaces only what needs the owner. This page is the
|
|
13
|
+
doctrine for running unattended without becoming a runaway process.
|
|
14
|
+
|
|
15
|
+
The premise (loop engineering, 2026): the human stops being the person who
|
|
16
|
+
prompts the agent and becomes the person who designs the system that
|
|
17
|
+
prompts, checks, and reruns the agent. claude-company already carries the
|
|
18
|
+
load-bearing parts of that system - worktrees, maker/checker separation,
|
|
19
|
+
persistent state, skills, hooks. The loop adds the heartbeat and the
|
|
20
|
+
discipline around it.
|
|
21
|
+
|
|
22
|
+
## The iron rules (before any loop runs)
|
|
23
|
+
|
|
24
|
+
1. **No loop without a mechanical verifier.** Every iteration ends at the
|
|
25
|
+
gates and the evidence protocol, same as interactive work. A loop that
|
|
26
|
+
trusts its own narration is a mistake generator with a scheduler.
|
|
27
|
+
2. **No loop without a cap.** Every loop declares, before it starts: max
|
|
28
|
+
engagements per run, max attempts per failure, and when it must stop and
|
|
29
|
+
surface. A loop with no ceiling spends until the tokens run out.
|
|
30
|
+
3. **The owner's attention is the scarce resource.** The loop optimizes for
|
|
31
|
+
review throughput: small integrated deliveries with evidence bundles,
|
|
32
|
+
never a week of unreviewed output. Unread loop output is comprehension
|
|
33
|
+
debt - the company ships code nobody understands.
|
|
34
|
+
4. **Loops accelerate understood work; they never replace thinking.** Fuzzy
|
|
35
|
+
or novel asks still route through ideation and specs. The loop is for
|
|
36
|
+
the backlog, the red gates, and the worry ledger - not for inventing
|
|
37
|
+
strategy unattended.
|
|
38
|
+
|
|
39
|
+
## The heartbeat (one iteration)
|
|
40
|
+
|
|
41
|
+
Each tick of the standing loop is one pass of the operating loop, bounded:
|
|
42
|
+
|
|
43
|
+
```mermaid
|
|
44
|
+
flowchart LR
|
|
45
|
+
A([tick]) --> B["Triage: gates on main,
|
|
46
|
+
WORRIES P0/P1, open CRs,
|
|
47
|
+
in-flight tasks, BACKLOG"]
|
|
48
|
+
B --> C{anything
|
|
49
|
+
actionable?}
|
|
50
|
+
C -->|no| D([sleep - long interval])
|
|
51
|
+
C -->|owner-only items| E([surface + sleep])
|
|
52
|
+
C -->|yes| F["Pick ONE: unblock beats
|
|
53
|
+
new work; red beats green;
|
|
54
|
+
P0 worry beats backlog"]
|
|
55
|
+
F --> G[Run it through the
|
|
56
|
+
normal pipeline]
|
|
57
|
+
G --> H[Verify + integrate
|
|
58
|
+
+ record state]
|
|
59
|
+
H --> I{caps hit? owner
|
|
60
|
+
decision needed?}
|
|
61
|
+
I -->|yes| E
|
|
62
|
+
I -->|no| A
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Triage order is fixed: red gates on main first, then in-flight work to
|
|
66
|
+
unblock or integrate, then P0/P1 worries, then open CRs, then the top of
|
|
67
|
+
`company/state/BACKLOG.md`. New backlog work starts only when nothing above
|
|
68
|
+
it needs attention.
|
|
69
|
+
|
|
70
|
+
## Stop-and-surface conditions (every loop honors all of these)
|
|
71
|
+
|
|
72
|
+
| Condition | Why the loop must not push through |
|
|
73
|
+
|---|---|
|
|
74
|
+
| An owner-escalation item (money, deploy, scope, policy) | Those decisions are never made unattended |
|
|
75
|
+
| The same gate red twice on the same cause | Design problem, not an agent problem |
|
|
76
|
+
| Per-run engagement cap reached | Review throughput is the bottleneck, not generation |
|
|
77
|
+
| Two consecutive ticks with nothing actionable | An idle loop burning tokens is waste; lengthen the interval or stop |
|
|
78
|
+
| Any hook block the loop cannot self-serve per the recipe | The enforcement layer outranks the loop |
|
|
79
|
+
|
|
80
|
+
## Running it
|
|
81
|
+
|
|
82
|
+
The `/autopilot` skill is the payload; Claude Code's native loop primitives
|
|
83
|
+
are the scheduler. Pick by attendance:
|
|
84
|
+
|
|
85
|
+
| Mode | How | Fits |
|
|
86
|
+
|---|---|---|
|
|
87
|
+
| Attended burst | `/autopilot` once | Clear a backlog while you watch the reports land |
|
|
88
|
+
| Semi-attended | `/loop /autopilot` (self-paced) | You are around; the company self-paces its ticks and you can interrupt |
|
|
89
|
+
| Unattended | `/schedule` a cloud routine running `/autopilot` | Overnight/weekend triage and small deliveries, capped tight |
|
|
90
|
+
|
|
91
|
+
Unattended runs get the tightest caps: fewer engagements per run, quick and
|
|
92
|
+
feature class only (never program, never hotfix), and every delivery waits
|
|
93
|
+
merged-but-unreported until the owner reads the evidence.
|
|
94
|
+
|
|
95
|
+
## State the loop lives on
|
|
96
|
+
|
|
97
|
+
The loop is stateless between ticks by design; everything it knows is in
|
|
98
|
+
files (the model forgets, the repo remembers):
|
|
99
|
+
|
|
100
|
+
- `company/state/BACKLOG.md` - the discovered-work queue. The owner drops
|
|
101
|
+
wishes here in one line each; triage, audits, and QA findings append
|
|
102
|
+
candidates. The loop pulls from the top; nothing enters the pipeline
|
|
103
|
+
without becoming a classified engagement first.
|
|
104
|
+
- `company/state/RESUME.md` - what the last tick finished and what the next
|
|
105
|
+
should do first.
|
|
106
|
+
- `company/state/STATUS.md`, `WORRIES.md`, `DECISIONS.md`, `adherence.log` -
|
|
107
|
+
the same truth the interactive company keeps; the loop reads them at every
|
|
108
|
+
tick and writes them after every action.
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
# METHOD.md - How this company works
|
|
2
|
+
|
|
3
|
+
claude-company turns a repository into a small software company run by AI agents
|
|
4
|
+
under one accountable orchestrator (the CEO, your main Claude session). This file
|
|
5
|
+
is the method. Every agent reads it once and holds to it. The CEO's private
|
|
6
|
+
runbook is `ORCHESTRATOR.md` (repo root); subagents never read that file.
|
|
7
|
+
|
|
8
|
+
The thesis, in one line: **gates are enforced, not narrated.** Process that lives
|
|
9
|
+
only in prose gets skipped under pressure. Here, the load-bearing rules are
|
|
10
|
+
backed by hooks and scripts that mechanically block; the prose explains why.
|
|
11
|
+
|
|
12
|
+
## The five mechanisms
|
|
13
|
+
|
|
14
|
+
1. **Canon before code (and spec before feature).** Features become spec-ready
|
|
15
|
+
before any build. A spec (see `company/templates/SPEC-TEMPLATE.md`) carries
|
|
16
|
+
stable requirement IDs (FR/BR/OQ) and a build-readiness section. Agents
|
|
17
|
+
implement against the spec's derived brief and never resolve an ambiguity by
|
|
18
|
+
personal judgment - they implement the brief's stated fallback and tag the
|
|
19
|
+
site (`// OQ-XX-NN assumption`), or file a change request. Autonomy comes
|
|
20
|
+
from removing decisions from agents, not from making agents guess well.
|
|
21
|
+
|
|
22
|
+
2. **Ownership boundaries are hard.** Every dispatched agent owns an explicit
|
|
23
|
+
set of directories named in its brief; everything else is read-only to it.
|
|
24
|
+
Workstreams are directory-disjoint by construction, and building agents work
|
|
25
|
+
in isolated git worktrees (one worktree, one branch, one accountable lead
|
|
26
|
+
per workstream - mechanics in `company/GIT.md`). Nobody fixes things they
|
|
27
|
+
notice outside their scope - they report them.
|
|
28
|
+
|
|
29
|
+
3. **Frozen surfaces change only by change request.** The registry is
|
|
30
|
+
`company/frozen-surfaces.json` (enforced by a PreToolUse hook). An agent that
|
|
31
|
+
needs a frozen surface changed STOPS and files a CR in
|
|
32
|
+
`company/change-requests/`; it never patches locally. The CR queue is the
|
|
33
|
+
integration risk made visible. The bureaucracy is the point.
|
|
34
|
+
|
|
35
|
+
4. **Gates are the definition of done.** "It works locally" is not a state this
|
|
36
|
+
company recognizes. The gate suite (`company/run-gates.sh`, defined per
|
|
37
|
+
project in `company/gates.config`, contract in `company/GATES.md`) decides,
|
|
38
|
+
never an agent's self-report. Every gate is blocking, none is ever waived,
|
|
39
|
+
and commits are hook-blocked while gates are red or stale.
|
|
40
|
+
|
|
41
|
+
5. **Verify, never trust - and never let the producer grade itself.** The agent
|
|
42
|
+
that built something never judges it done. Developers report with evidence;
|
|
43
|
+
tech leads re-check against the brief; QA drives the running product and
|
|
44
|
+
captures screenshots but does not judge them; leads and the CEO judge. The
|
|
45
|
+
CEO re-runs gates, diff-checks ownership, and spot-reads before integrating.
|
|
46
|
+
|
|
47
|
+
## The client posture
|
|
48
|
+
|
|
49
|
+
The owner is a CLIENT of this company, not its process operator. Frictionless
|
|
50
|
+
on the outside, hard-gated on the inside:
|
|
51
|
+
|
|
52
|
+
- **All paperwork is self-generated.** Specs, briefs, task state, gate
|
|
53
|
+
config - agents produce every artifact. The templates in
|
|
54
|
+
`company/templates/` are for agents; a client is never asked to fill,
|
|
55
|
+
read, or approve one.
|
|
56
|
+
- **Hooks teach the machine, not the human.** When a hook blocks, its message
|
|
57
|
+
is a recipe the blocked agent follows to make itself compliant (write the
|
|
58
|
+
brief, set the task state, run the gates) - compliance is self-service,
|
|
59
|
+
enforcement stays mechanical.
|
|
60
|
+
- **Defaults over questions.** Every decision that is not on the owner
|
|
61
|
+
escalation list gets an opinionated default, applied immediately and
|
|
62
|
+
recorded (DECISIONS.md, OQ fallbacks, STATUS notes) where the owner can
|
|
63
|
+
veto it later. Asking is the exception; the escalation list is the whole
|
|
64
|
+
list of exceptions.
|
|
65
|
+
- **Interruptions are batched.** The client hears from the company twice per
|
|
66
|
+
engagement in the common case: owner decisions (batched, once) and
|
|
67
|
+
delivery (evidence bundle: what shipped, gate ladder, screenshots, what is
|
|
68
|
+
next). Process narration is noise.
|
|
69
|
+
- **Uninitialized is not an error.** The orchestrator self-onboards on first
|
|
70
|
+
contact - audits, wires gates, applies frozen defaults - instead of sending
|
|
71
|
+
the client to a setup command.
|
|
72
|
+
|
|
73
|
+
## The hierarchy
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
Owner (human)
|
|
77
|
+
CEO - the main session. Dispatches, arbitrates CRs, verifies,
|
|
78
|
+
integrates, reports upward. Codes only glue and small fixes.
|
|
79
|
+
Staff roles - product-manager (Phase 0 specs), architect (boundaries,
|
|
80
|
+
ownership map, wave plan), auditor (read-only pre-merge audit)
|
|
81
|
+
Tech leads - one per workstream. Decompose the brief, spawn and manage
|
|
82
|
+
their own developers, fill the gaps between developers' work,
|
|
83
|
+
drive QA, run gates, report upward with evidence.
|
|
84
|
+
Developers - build exactly what their task order says, inside owned
|
|
85
|
+
directories, in a worktree.
|
|
86
|
+
QA engineers - drive the built surface (Playwright), capture evidence
|
|
87
|
+
screenshots: loaded / empty / error / after-action.
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Depth is capped at two below the CEO by construction (CEO -> lead -> dev/QA).
|
|
91
|
+
Deeper pyramids multiply handoff drift and token cost without adding judgment.
|
|
92
|
+
|
|
93
|
+
Communication travels through typed artifacts, not conversation: spec -> brief ->
|
|
94
|
+
report -> STATUS. A brief is sealed and self-contained; a report follows
|
|
95
|
+
`company/templates/REPORT-TEMPLATE.md` and contains facts, not adjectives.
|
|
96
|
+
|
|
97
|
+
## Ceremony scales with the task
|
|
98
|
+
|
|
99
|
+
The CEO classifies every incoming request; nobody hand-picks ceremony:
|
|
100
|
+
|
|
101
|
+
| Class | What | Path |
|
|
102
|
+
|---|---|---|
|
|
103
|
+
| `ideation` | The ask is ideas/direction, or too fuzzy to build without guessing | Brainstorm engagement per `company/IDEATION.md`: parallel strategists diverge, CEO converges, client gets an options memo; the winner reclassifies as quick/feature/program. |
|
|
104
|
+
| `quick` | Small bug, copy change, config tweak | Brief only. One developer or the CEO itself. No Phase 0. Gates still gate. |
|
|
105
|
+
| `feature` | New user-visible capability, or anything touching a frozen surface, an invariant, or money | Phase 0 spec -> spec-ready gate -> brief -> one tech lead + team -> QA evidence -> verify -> integrate |
|
|
106
|
+
| `program` | Multi-workstream build (a v1, a big subsystem) | Architect produces ownership map + wave plan. Waves are merge barriers: a wave's exit criteria must be green on main before the next wave starts. One lead per workstream, parallel within a wave. |
|
|
107
|
+
| `hotfix` | Production is on fire | Declared by the CEO in `company/state/active-task.json` (`"type": "hotfix"`). Hooks log the bypass instead of blocking. Retroactive spec/tests within a day. |
|
|
108
|
+
|
|
109
|
+
## The context discipline
|
|
110
|
+
|
|
111
|
+
Spec context and build context are kept apart deliberately:
|
|
112
|
+
|
|
113
|
+
- The **spec** is rich and human-facing. The builder never reads it.
|
|
114
|
+
- The **brief** (`company/templates/BRIEF-TEMPLATE.md`) is the lean execution
|
|
115
|
+
slice derived from the spec: mission, read-first list, owned directories,
|
|
116
|
+
invariants in play, frozen surfaces nearby, ordered scope, DoD, fallbacks,
|
|
117
|
+
out-of-scope. A vague brief is the main cause of a bad agent run.
|
|
118
|
+
- Agents read: the project's `CLAUDE.md`, their brief, and what the brief's
|
|
119
|
+
"Read first" list cites. Nothing else is assumed.
|
|
120
|
+
|
|
121
|
+
## State the company maintains
|
|
122
|
+
|
|
123
|
+
All under `company/state/`, all owned by the CEO:
|
|
124
|
+
|
|
125
|
+
| File | Job |
|
|
126
|
+
|---|---|
|
|
127
|
+
| `STATUS.md` | Current truth board. Red stays red until proven green. Never average a status. |
|
|
128
|
+
| `RESUME.md` | Session handoff: done / running / next, plus the facts every spawn prompt needs. Read first on every session start. |
|
|
129
|
+
| `WORRIES.md` | Terse ledger of suspected-but-unproven risks: `P (P0-P3) \| Worry \| What \| Logic`. A row graduates OUT when it becomes a CR, a STATUS risk, or a verified fix. |
|
|
130
|
+
| `DECISIONS.md` | Owner escalations and their outcomes. |
|
|
131
|
+
| `active-task.json` | The machine-readable pointer to the task in flight (read by hooks). |
|
|
132
|
+
| `gates.status` | The stamped gate result (written only by the gate runner). |
|
|
133
|
+
| `adherence.log` | Every hook block and bypass, one line each. Proof the system enforces. |
|
|
134
|
+
|
|
135
|
+
## What is never decided below the owner
|
|
136
|
+
|
|
137
|
+
1. Weakening any design invariant or frozen surface's guarantees.
|
|
138
|
+
2. Money and billing behavior.
|
|
139
|
+
3. Deploys, prod migrations, cutover. Merge is integration; deploy is a manual
|
|
140
|
+
owner step, never in any script or agent's tooling.
|
|
141
|
+
4. Scope changes beyond a brief.
|
|
142
|
+
5. A gate failing twice on the same cause after a respawn - that signals a
|
|
143
|
+
design problem, not an agent problem. Stop and surface.
|
|
144
|
+
6. Business-policy open questions. Agents run on tagged fallbacks; the owner
|
|
145
|
+
answers the question.
|
|
146
|
+
|
|
147
|
+
## Writing discipline
|
|
148
|
+
|
|
149
|
+
All writing in this repository stays hook-clean: straight quotes, ' - ' rather
|
|
150
|
+
than em dashes, three dots rather than the ellipsis character, and no stock AI
|
|
151
|
+
filler phrases. The `no_slop` PreToolUse hook enforces this mechanically.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$comment": "Frozen-surface registry. Read by .claude/hooks/guard_frozen.py, which blocks Edit/Write to matching paths. Patterns are fnmatch globs tested against the project-relative path and the basename. Populate 'surfaces' for YOUR project during /company-init or /onboard (the architect proposes them; the owner approves). Changes to frozen surfaces go through company/change-requests/, applied by the CEO in a dedicated gated PR. The 'always' list is claude-company's own baseline and applies to every project.",
|
|
3
|
+
"version": 1,
|
|
4
|
+
"surfaces": [],
|
|
5
|
+
"always": [
|
|
6
|
+
".env",
|
|
7
|
+
".env.*",
|
|
8
|
+
"*.lock",
|
|
9
|
+
"package-lock.json",
|
|
10
|
+
"yarn.lock",
|
|
11
|
+
"pnpm-lock.yaml",
|
|
12
|
+
"poetry.lock",
|
|
13
|
+
"Cargo.lock",
|
|
14
|
+
"company/state/gates.status",
|
|
15
|
+
"company/state/adherence.log"
|
|
16
|
+
]
|
|
17
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
{"$comment": "Define your project's mechanical gates. Every gate is blocking. See company/GATES.md.",
|
|
2
|
+
"gates": [
|
|
3
|
+
{"name": "tests", "command": "echo 'CONFIGURE ME: replace with your test command' && exit 1", "blocking": true},
|
|
4
|
+
{"name": "lint", "command": "echo 'CONFIGURE ME' && exit 1", "blocking": true}
|
|
5
|
+
]}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# run-gates.sh - the claude-company gate runner.
|
|
3
|
+
# Reads company/gates.config, runs each gate command from the project root,
|
|
4
|
+
# prints a gate ladder, then stamps results via .claude/hooks/gate_stamp.py.
|
|
5
|
+
# Every gate is blocking: exits non-zero if any gate fails.
|
|
6
|
+
set -euo pipefail
|
|
7
|
+
|
|
8
|
+
# --- resolve project root -------------------------------------------------
|
|
9
|
+
if [ -n "${CLAUDE_PROJECT_DIR:-}" ]; then
|
|
10
|
+
PROJECT_ROOT="$CLAUDE_PROJECT_DIR"
|
|
11
|
+
elif PROJECT_ROOT="$(git rev-parse --show-toplevel 2>/dev/null)"; then
|
|
12
|
+
:
|
|
13
|
+
else
|
|
14
|
+
PROJECT_ROOT="$(pwd)"
|
|
15
|
+
fi
|
|
16
|
+
|
|
17
|
+
CONFIG="$PROJECT_ROOT/company/gates.config"
|
|
18
|
+
STAMPER="$PROJECT_ROOT/.claude/hooks/gate_stamp.py"
|
|
19
|
+
|
|
20
|
+
# --- colors ---------------------------------------------------------------
|
|
21
|
+
if [ -t 1 ]; then
|
|
22
|
+
C_RED=$'\033[31m'; C_GREEN=$'\033[32m'; C_YELLOW=$'\033[33m'; C_BOLD=$'\033[1m'; C_RESET=$'\033[0m'
|
|
23
|
+
else
|
|
24
|
+
C_RED=''; C_GREEN=''; C_YELLOW=''; C_BOLD=''; C_RESET=''
|
|
25
|
+
fi
|
|
26
|
+
|
|
27
|
+
warn() { printf '%s\n' "${C_YELLOW}warning:${C_RESET} $*" >&2; }
|
|
28
|
+
|
|
29
|
+
# --- no config / empty config ---------------------------------------------
|
|
30
|
+
if [ ! -f "$CONFIG" ]; then
|
|
31
|
+
echo "no gates configured - see company/GATES.md"
|
|
32
|
+
exit 0
|
|
33
|
+
fi
|
|
34
|
+
|
|
35
|
+
# --- parse config into "name<TAB>base64(command)" lines -------------------
|
|
36
|
+
# base64-encode the command so arbitrary shell text survives the line format.
|
|
37
|
+
GATE_LINES="$(python3 - "$CONFIG" <<'PY'
|
|
38
|
+
import base64, json, sys
|
|
39
|
+
try:
|
|
40
|
+
with open(sys.argv[1]) as f:
|
|
41
|
+
data = json.load(f)
|
|
42
|
+
except Exception as e:
|
|
43
|
+
sys.stderr.write("failed to parse gates.config: %s\n" % e)
|
|
44
|
+
sys.exit(3)
|
|
45
|
+
gates = data.get("gates") or []
|
|
46
|
+
for g in gates:
|
|
47
|
+
name = str(g.get("name", "")).strip()
|
|
48
|
+
cmd = g.get("command", "")
|
|
49
|
+
if not name or not cmd:
|
|
50
|
+
continue
|
|
51
|
+
enc = base64.b64encode(cmd.encode("utf-8")).decode("ascii")
|
|
52
|
+
sys.stdout.write("%s\t%s\n" % (name, enc))
|
|
53
|
+
PY
|
|
54
|
+
)"
|
|
55
|
+
|
|
56
|
+
if [ -z "$GATE_LINES" ]; then
|
|
57
|
+
echo "no gates configured - see company/GATES.md"
|
|
58
|
+
exit 0
|
|
59
|
+
fi
|
|
60
|
+
|
|
61
|
+
# --- run each gate --------------------------------------------------------
|
|
62
|
+
echo "${C_BOLD}Running gates from ${PROJECT_ROOT}${C_RESET}"
|
|
63
|
+
echo
|
|
64
|
+
|
|
65
|
+
NAMES=""
|
|
66
|
+
OKS=""
|
|
67
|
+
DETAILS_FILE="$(mktemp -t rungates.XXXXXX)"
|
|
68
|
+
LADDER_FILE="$(mktemp -t rungates.XXXXXX)"
|
|
69
|
+
trap 'rm -f "$DETAILS_FILE" "$LADDER_FILE"' EXIT
|
|
70
|
+
|
|
71
|
+
ANY_FAIL=0
|
|
72
|
+
|
|
73
|
+
# Read tab-separated lines without a subshell (so vars persist in bash 3.2).
|
|
74
|
+
while IFS=$'\t' read -r NAME ENC; do
|
|
75
|
+
[ -n "$NAME" ] || continue
|
|
76
|
+
CMD="$(printf '%s' "$ENC" | base64 --decode 2>/dev/null || printf '%s' "$ENC" | base64 -D)"
|
|
77
|
+
|
|
78
|
+
echo "${C_BOLD}-> gate: ${NAME}${C_RESET}"
|
|
79
|
+
START=$(date +%s)
|
|
80
|
+
OUT_FILE="$(mktemp -t rungates.XXXXXX)"
|
|
81
|
+
# Run from the project root. Do not let a failing gate abort the runner.
|
|
82
|
+
set +e
|
|
83
|
+
( cd "$PROJECT_ROOT" && eval "$CMD" ) >"$OUT_FILE" 2>&1
|
|
84
|
+
RC=$?
|
|
85
|
+
set -e
|
|
86
|
+
END=$(date +%s)
|
|
87
|
+
DUR=$((END - START))
|
|
88
|
+
|
|
89
|
+
# Echo the gate output so the user sees it, then keep the last line as detail.
|
|
90
|
+
cat "$OUT_FILE"
|
|
91
|
+
LAST_LINE="$(awk 'NF{last=$0} END{print last}' "$OUT_FILE")"
|
|
92
|
+
rm -f "$OUT_FILE"
|
|
93
|
+
|
|
94
|
+
if [ "$RC" -eq 0 ]; then
|
|
95
|
+
STATUS="PASS"; OK="true"
|
|
96
|
+
else
|
|
97
|
+
STATUS="FAIL"; OK="false"; ANY_FAIL=1
|
|
98
|
+
fi
|
|
99
|
+
|
|
100
|
+
# Record for the ladder and for stamping (base64 the detail for safe transport).
|
|
101
|
+
DENC="$(printf '%s' "$LAST_LINE" | base64 | tr -d '\n')"
|
|
102
|
+
printf '%s\t%s\t%s\n' "$NAME" "$OK" "$DENC" >>"$DETAILS_FILE"
|
|
103
|
+
printf '%s\t%s\t%ss\n' "$NAME" "$STATUS" "$DUR" >>"$LADDER_FILE"
|
|
104
|
+
echo
|
|
105
|
+
done <<EOF
|
|
106
|
+
$GATE_LINES
|
|
107
|
+
EOF
|
|
108
|
+
|
|
109
|
+
# --- print the gate ladder ------------------------------------------------
|
|
110
|
+
echo "${C_BOLD}Gate ladder${C_RESET}"
|
|
111
|
+
printf '%-24s %-6s %s\n' "GATE" "RESULT" "TIME"
|
|
112
|
+
printf '%-24s %-6s %s\n' "------------------------" "------" "------"
|
|
113
|
+
while IFS=$'\t' read -r NAME STATUS DUR; do
|
|
114
|
+
[ -n "$NAME" ] || continue
|
|
115
|
+
if [ "$STATUS" = "PASS" ]; then COLOR="$C_GREEN"; else COLOR="$C_RED"; fi
|
|
116
|
+
printf '%-24s %s%-6s%s %s\n' "$NAME" "$COLOR" "$STATUS" "$C_RESET" "$DUR"
|
|
117
|
+
done <"$LADDER_FILE"
|
|
118
|
+
echo
|
|
119
|
+
|
|
120
|
+
# --- stamp results --------------------------------------------------------
|
|
121
|
+
RESULTS_JSON="$(python3 - "$DETAILS_FILE" <<'PY'
|
|
122
|
+
import base64, json, sys
|
|
123
|
+
gates = []
|
|
124
|
+
with open(sys.argv[1]) as f:
|
|
125
|
+
for line in f:
|
|
126
|
+
line = line.rstrip("\n")
|
|
127
|
+
if not line:
|
|
128
|
+
continue
|
|
129
|
+
parts = line.split("\t")
|
|
130
|
+
if len(parts) < 3:
|
|
131
|
+
continue
|
|
132
|
+
name, ok, denc = parts[0], parts[1], parts[2]
|
|
133
|
+
try:
|
|
134
|
+
detail = base64.b64decode(denc.encode("ascii")).decode("utf-8", "replace")
|
|
135
|
+
except Exception:
|
|
136
|
+
detail = ""
|
|
137
|
+
gates.append({"name": name, "ok": ok == "true", "detail": detail})
|
|
138
|
+
sys.stdout.write(json.dumps({"gates": gates}))
|
|
139
|
+
PY
|
|
140
|
+
)"
|
|
141
|
+
|
|
142
|
+
if [ -f "$STAMPER" ]; then
|
|
143
|
+
if python3 "$STAMPER" --results "$RESULTS_JSON"; then
|
|
144
|
+
:
|
|
145
|
+
else
|
|
146
|
+
warn "gate_stamp.py exited non-zero; gate results were reported above but may not be stamped"
|
|
147
|
+
fi
|
|
148
|
+
else
|
|
149
|
+
warn "gate stamper not found at $STAMPER - skipping stamp (results reported above)"
|
|
150
|
+
fi
|
|
151
|
+
|
|
152
|
+
# --- final exit code ------------------------------------------------------
|
|
153
|
+
if [ "$ANY_FAIL" -ne 0 ]; then
|
|
154
|
+
echo "${C_RED}${C_BOLD}gates FAILED${C_RESET}"
|
|
155
|
+
exit 1
|
|
156
|
+
fi
|
|
157
|
+
echo "${C_GREEN}${C_BOLD}all gates passed${C_RESET}"
|
|
158
|
+
exit 0
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# DECISIONS - owner escalations and outcomes
|
|
2
|
+
|
|
3
|
+
_Questions only the owner may answer (money, invariants, deploys, scope,
|
|
4
|
+
business policy), with what was decided and when. Agents run on tagged
|
|
5
|
+
fallbacks until a row lands here._
|
|
6
|
+
|
|
7
|
+
| # | Date | Question | Decision | Affects |
|
|
8
|
+
|---|---|---|---|---|
|
|
9
|
+
| - | - | - | - | - |
|