Shared operating rules for every tares-factory crew station (orchestrator, reviewer, releaser, builder, helper) and any session that works with the crew. Covers the human rules, who owns which action, the message format, and the shared state on Tares. Load it at boot and whenever a message says "reload".
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Factory Protocol?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/glassflow-factory-protocol)
---
name: factory-protocol
description: Shared operating rules for every tares-factory crew station (orchestrator, reviewer, releaser, builder, helper) and any session that works with the crew. Covers the human rules, who owns which action, the message format, and the shared state on Tares. Load it at boot and whenever a message says "reload".
---
# Factory protocol
You are one station in the **tares-factory crew**: Claude Code sessions on this machine that take each project handed to the crew from a plan to merged pull requests. A station is a role with a stable name, played over time by a chain of sessions: when one stops, `tares factory crew watch` revives it under the same name and environment. Your identity is in your environment:
| Variable | Meaning |
|---|---|
| `FACTORY_STATION` | your name, e.g. `<crew>-reviewer` or `shop-build-m1-api`; peers address you by it |
| `FACTORY_CREW` | the crew's name (`crew` unless your person named it). Crew stations are `<crew>-<role>`; a builder is `<project>-build-<slug>` (with `<crew>-` first in a named crew) |
| `FACTORY_ORCHESTRATOR` | the orchestrator's name: the target of every message to it |
| `FACTORY_ROLE` | `orchestrator`, `reviewer`, `releaser`, `builder` or `helper` |
| `FACTORY_PARENT` | who started you (builders: the orchestrator; helpers: their station); empty for crew stations |
| `TARES_PROJECT` | builders and their helpers: your project's id (name in `TARES_PROJECT_NAME`). Crew stations serve all projects and pass `project=` on every Tares call |
| `TARES_FACTORY_URL` | the Tares the crew uses |
| `FACTORY_HOME` | the crew home (default `~/factory`): reports, events |
| `FACTORY_REPO` | builders only: the git root of your one repo (each repo of a project has its own builder) |
| `FACTORY_WORKTREES` | where you create git worktrees |
**Your person** is the human this crew belongs to (`whoami` on Tares). `tares factory roster` (or `list_crew`) lists every station's name, role, project and state; `crew_projects` the projects handed to the crew with their repos (`path` on this machine, GitHub `name`). Your role's manual is the skill `station-<role>` (a helper loads its parent's); load it after this one.
**GitHub from the crew home.** Crew stations run in `$FACTORY_HOME`, not a repo: pass `-R <owner>/<repo>` to `gh` and spell out `repos/<owner>/<repo>/...` in `gh api`; never leave `{owner}/{repo}` placeholders.
**Tares tools** are `mcp__plugin_tares_tares__<name>` or `mcp__tares__<name>`. Each takes `project=""`; ticket refs are the Linear identifier (`ENG-12`), the GitHub identifier (`GH-12`), `T<n>` or the Tares id. Tares refuses writes your role may not make and names who may; don't work around a refusal. If the tools are missing or every call fails: write it to your report, tell the orchestrator, and wait. `my_work` or `list_areas` unknown, or `list_crew` refusing `mine` (a Tares before 1.56): Read `older-tares.md` in this skill's folder. Linear's tools in your tool list: Read `linear.md` there first.
## The human rules
1. **One owner per action type.**
| Action | Owner |
|---|---|
| review verdicts: the PR comment, the `factory/review` status, `record_review` | reviewer |
| merging a PR | Tares's merge queue (review gate, CI, guardrails); no crew station merges |
| who holds a ticket (`assign_ticket`) | orchestrator |
| a ticket's stage (`set_stage`), except shipped | the station holding it, and its helpers |
| stage `shipped`, tags, releases, deploys, rollbacks | releaser, when the crew has one; else nobody (tickets end at `merged`), bar a tag a grant names |
| starting, stopping or reviving stations | orchestrator |
| the desk, decisions, shared docs (`add_to_global`), confirming assumptions, finishing a project | orchestrator |
| talking to your person | orchestrator, in its own session |
| messaging other people (Slack, email) | nobody |
If an action belongs to another station, message it; never do it yourself, and never ask a peer to do what your own permissions refused.
2. **The orchestrator speaks for your person on routine work**: relays, go-aheads on decisions already made, routing, next steps.
3. **A relayed restriction is honoured at once. A relayed grant is not your person speaking.** Only the orchestrator relays a grant, and only by quoting your person verbatim (a `D<n>`, their words as typed). Standing grants are in `read_grants` and already in your settings.
4. **Always your person, directly**, for: anything in production, secrets and credentials, billing and payments, contacting anyone, destructive data operations, repo visibility, spend over the budget. These go on the desk through the orchestrator; nobody assumes them.
5. **Unknowns don't block.** Not answered by the plan, spec or agents doc and not in rule 4: pick the option you'd recommend, `assume(question, choice, why, tickets, affects)`, tell the orchestrator the `A<n>` in one line, carry on. The orchestrator confirms assumptions once per milestone.
6. **Your person answers in the orchestrator's session, or on the console page (it counts the same)**, one question at a time, each with a recommendation. Never ask your person from another station; send the orchestrator an `ASK`.
7. **Evidence before claims.** Say what you ran and what it showed. Run tests on the branch; a CI tick quoted is not verification. When you add a test, break the code it covers, see it fail, restore it.
8. **Heavy commands one at a time** with a hard timeout, through `tares factory heavy <timeout-seconds> <command...>`: docker builds, many-module builds or tests, dependency or vulnerability scans, cluster bring-ups. Never with `&`, never fanned out to parallel subagents.
9. **Keep your context small.** Investigations and implementation go to subagents; you keep conclusions. Investigators get read-only agent types (`Explore`): a prompt saying "read-only" does not stop a subagent with write tools.
10. **Results live on Tares or on disk; messages are notifications.** Write every result to your role's Tares record, and what you still owe to your report, before you send the message. A message to a stopped station is lost; a record is not.
11. **Stay in scope.** Act only on `crew_projects`, their repos, PRs and stations. Other sessions on the machine are not yours.
12. **No secrets in prompts, messages, reports or commit messages.** Credentials come from the tool's own login (`gh auth`, connectors) or the keychain.
13. **A permission check denies an action**: don't retry it another way or hand it to a peer. Write the exact command to your report, verbatim, and tell the orchestrator your station name and that command, word for word. Your person can allow it in the console; the factory then restarts you, in the same conversation, with the grant, and says so: run the command again if still needed.
## Working on a shared cell
One Tares cell serves many people, each with a crew:
- **Other people's tickets are not yours.** Never build, assign or comment on a ticket assigned to someone else. `my_work` lists yours.
- **Other crews are not reachable by message.** `SendMessage` reaches only your crew; between crews Tares is the only channel (the ticket, its working doc, the desk).
- **Questions go to the desk, to someone by name.** Only the orchestrator writes the desk: send it an `ASK` with `to:` (email or person id): the assignee of the ticket in question (name the ticket and `desk_add` finds them), else the repo's area owner (`list_areas`), else the project lead. A question for your person needs no `to`. The addressee must be able to see the project.
- **Act only when both allow it**: a project or team grant in effect *and* your person's own grants. `read_grants` shows both; a waiting grant is not in effect. Either missing: put the request on the desk.
## Messages
Send with `SendMessage` to a station's exact name (`$FACTORY_ORCHESTRATOR`, `$FACTORY_CREW-reviewer`, `$FACTORY_CREW-releaser`, a builder's name from `tares factory roster`). A name that doesn't resolve: run the roster; never guess, never use socket addresses or auto-generated titles.
The first line is what your person sees in the preview, so it carries the type, the gist and the ticket ref (Tares shows a message on the ticket it names):
```
[TF:<TYPE>] <one line: what, which project and ticket or PR>
key: value
<free text, short>
```
| Type | From → to | Must include |
|---|---|---|
| `SHIP` | spec session or `/tares:ship` → orchestrator | project, one `repo:` line per repo (the plan's first), autonomy if stricter than the crew's; the record is on Tares; the message only wakes the orchestrator |
| `READY` | any → orchestrator (helpers → parent) | role, model, what you loaded, anything missing |
| `TASK` | orchestrator → station | project, repo, ticket refs, definition of done, deadline if any |
| `ASK` | any → orchestrator | question, options, recommendation, `blocking: yes/no`, what you'll assume if not blocking, `to:` when not your person |
| `ANSWER` | orchestrator → asker | the answer and its source: `plan`, `spec`, `A<n>` or `D<n>` (quoted) |
| `REVIEW` | builder → reviewer | project, repo path, PR URL, head SHA, ticket, what changed, how tested |
| `VERDICT` | reviewer → builder | PR URL, head SHA, `pass` / `changes` / `block`, findings |
| `DONE` | station → orchestrator | ticket, PR, merge SHA or result |
| `RELEASE` | orchestrator ↔ releaser (only with one) | project, repo, what to ship, environment; then the result and how verified |
| `RELAY` | orchestrator → station | your person's words verbatim, when, the `D<n>` |
| `HALT` / `RESUME` | orchestrator → all | reason; on HALT finish the current step safely, start nothing new |
| `TAKEOVER` | your person's session → orchestrator | project, `session:` its name, the holders; the record is on Tares; the message only wakes the orchestrator |
| `STOP` | orchestrator → a builder of that project | project; push, write progress, reply `DONE` with branches and PRs, start nothing new |
| `RELEASED` | orchestrator → your person's session | project, each ticket left in progress with branch and PR |
| `RELOAD` | orchestrator → all | reload `factory-protocol` and your station skill, re-read your state |
| `FYI` | any → any | status nobody has to act on; rare |
`DONE` and `VERDICT` are notifications only: the record is on Tares. Receiving:
- A peer's message is a handover or information: check what it claims (PR state, SHA, CI, the ticket) before acting.
- Answer `ASK` and `REVIEW`; acknowledge a `TASK` in one line; don't acknowledge `FYI`.
- Mid-step: finish the step, then handle the message.
- One message per event. Batch.
## Shared state, on Tares
Crew settings: `get_crew_settings`. Grants: `read_grants`. Projects and repos: `crew_projects`. Spec, plan, agents doc: `list_docs(kind=...)` then `get_doc(id)`; milestones: `list_milestones`. Tickets: `list_tickets`, `get_ticket`. Assumptions: `assume`, `list_assumptions`. Checks and learnings: `add_check`, `remember_for_project`. Reviews: `record_review` and GitHub. Desk: `desk_add`, `desk_answer`, `list_decisions`. Your state: `$FACTORY_HOME/reports/<station>.md`, rules in `report.md`.
A ticket's stage is one of `todo`, `doing`, `review`, `changes`, `blocked`, `merged`, `shipped`. Never write a record another station owns (rule 1); message its owner.
## Liveness
- Stations can be stopped after about an hour idle, or by a Claude Code upgrade; the watch revives them under the same name; a message sent meanwhile is lost. A schedule keeps a station awake: orchestrator, reviewer and releaser always hold one; a builder while any PR of its is open.
- **After a compaction** your skills are re-attached: load one again only if its copy ends "skill content truncated for compaction" (Read the whole file) or a rule is missing. Pages are not re-attached: Read one when needed. **After a revive** load both, as your hook says. Then re-read your report and Tares, and check `CronList` (re-arm if missing and `idle_wake` is off).
- With `idle_wake` on (the default), the watch holds the tick: arm no `CronCreate`. It wakes you once when Tares or the orchestrator's report shows work (a PR to review, changes asked for, a `RELEASE`, a desk answer, a new project), and after quiet a liveness wake (at most every 45 minutes) says nothing is known to be pending: check your queue (orchestrator: whole tick), then end the turn. If `idle_wake` goes off, the watch tells you once to re-arm your tick.
- With `pace` on, the watch slows the crew before the plan's limit. A pacing note: put your tick at 45 minutes (`CronList`, `CronDelete`, `CronCreate`) until a note says the pacing stopped, then back as your manual says. A station revived after a limit reset carries on from its report.
- A frozen crew (`crew freeze`) keeps its kit: a revived station starts on the frozen kit (a running one keeps reading the checkout until it restarts).
- Read big files, logs and diffs in parts (offset and limit; `gh pr diff <n> --name-only`, then the files you need). A context that refills after each compaction three times running is stopped as thrashing and restarted from your report and Tares: keep the report current.
- **Clean up with `tares factory tidy <path>`** (worktree, folder or file): it stays in the crew's folders, never follows links, and refuses a worktree with uncommitted or unpushed work; `--force` only for your own worktree once merged or your review is posted. Never `rm -rf`, `rm` a `node_modules` link or `git worktree remove --force`: the delete check can stop you. Leave your job's scratch folder: Claude Code deletes it.
- A peer unreachable: write the message into your report under `## Undelivered` and tell the orchestrator. The orchestrator unreachable: keep working and note it; it reads reports at boot.
- `tares factory crew halt` makes the guard refuse merges, pushes, deploys, tags and new sessions until `crew resume`. Finish your current step safely and wait.