Lattice
Lattice is a file-based operating system for AI agent teams. It replaces volatile chat windows with persistent files, enabling agents to work stably through long, iterative development cycles via an 8-phase execution pipeline.
Why Lattice?
- Stable long-running execution — File-driven state machine ensures agents stay on track across sessions. No context window overflow, no drift. Tasks complete reliably over hours or days through structured iteration.
- Three-tier failure handling — When an agent gets stuck: (1) Model Escalation retries with stronger models, (2) Peer Consult gathers parallel opinions from multiple models, (3) Auto-Triage makes a judgment call (relax constraints / defer / block for human). Most blockers resolve automatically.
- Per-phase model configuration — Thinking-heavy phases (planning, review, architecture) need strong reasoning models; token-heavy phases (implementation, testing) can use cost-efficient coding models. This dramatically reduces overall token cost without sacrificing quality where it matters.
Example model assignment (from a production setup):
| Phase |
Model tier |
Example |
| Constitute (architecture) |
Strong reasoning |
Claude Opus |
| Research |
Strong reasoning |
Gemini Pro |
| Specify (design) |
Strong reasoning |
Claude Opus |
| Plan + Tasks |
Strong reasoning |
Claude Opus |
| Implement |
Cost-efficient coding |
GPT Codex |
| Test |
Cost-efficient coding |
GPT Codex |
| Review |
Strong reasoning |
Claude Opus |
| Gap Analysis |
Strong reasoning |
Gemini Pro |
The key insight: implementation and testing consume the most tokens (writing/running code), but don't require the most expensive models. Planning and review consume fewer tokens but need deeper reasoning. Match model strength to cognitive demand, not token volume.
- Multi-project parallel execution — Run multiple projects simultaneously, each with its own cron-scheduled orchestrator. Combined with OpenClaw's cron system, projects advance autonomously on independent cadences.
Templates are bundled at templates/ORG/ relative to this skill directory.
Quick Reference
- Full design doc:
templates/ORG/PROJECTS/pipeline-framework/DESIGN.md
- Pipeline guide (all agents):
templates/ORG/PIPELINE_GUIDE.md
- Sub-agent guide:
templates/ORG/PROJECTS/pipeline-framework/templates/PIPELINE_GUIDE_FOR_SUBAGENTS.md
- Orchestrator prompt template:
templates/ORG/PROJECTS/pipeline-framework/templates/ORCHESTRATOR_PROMPT.template.md
- Phase prompt templates:
templates/ORG/PROJECTS/pipeline-framework/templates/PHASE_PROMPTS/
- State machine template:
templates/ORG/PROJECTS/pipeline-framework/templates/PIPELINE_STATE.template.json
Task: Initialize a New Organization (lattice init)
1. Gather Information
Ask the user for:
- Organization name (e.g. "Acme Labs")
- Target directory — where to create the
ORG/ folder (default: current workspace root)
- Departments — list of department names (e.g. Research, Engineering, Reliability)
- First project (optional) — name + one-line description
Keep it conversational. Don't dump all questions at once.
2. Scaffold the ORG Directory
Copy the entire templates/ORG/ directory to <target>/ORG/.
Then customize:
- ORG_README.md — Replace the example org structure in §5 with the user's actual departments
- TASKBOARD.md — Leave the template structure intact (user fills in priorities later)
- Departments — For each department the user listed:
- Copy
DEPARTMENTS/example-dept/ → DEPARTMENTS/<dept-name>/
- In each copied department, replace
<Department Name> placeholders in CHARTER.md, RUNBOOK.md, HANDOFF.md with the actual department name
- Reset STATE.json to
{"lastRun": null, "cursor": null, "notes": "Initial state"}
- Remove
DEPARTMENTS/example-dept/ after creating real departments (unless user wants to keep it as reference)
3. Create the First Project (if requested)
- Copy
PROJECTS/example-project/ → PROJECTS/<project-name>/
- Update STATUS.md with the project name
- Update DECISIONS.md header
- Configure PIPELINE_STATE.json (see "Configure Pipeline State" below)
- Remove
PROJECTS/example-project/ after creating the real project
4. Configure Pipeline State
Read templates/ORG/PROJECTS/pipeline-framework/templates/PIPELINE_STATE.template.json as the reference.
Ask the user:
- Which agents will run each phase? (agentId per role — or a single agent for all)
- Which models for each phase? (or a default model)
- Escalation chain — list of models from cheapest to strongest (e.g.
["gflash", "gpro", "sonnet"])
- Peer consult models — which models to consult in parallel when stuck
- Synthesizer/triage model — typically the strongest available model
- Notification channel (optional) — where to send pipeline status updates
Fill in the project's PIPELINE_STATE.json with these values, replacing all <placeholder> tokens.
5. Set Up the Orchestrator Cron Job
Read templates/ORG/PROJECTS/pipeline-framework/templates/ORCHESTRATOR_PROMPT.template.md.
Create a cron job using the cron tool:
- Schedule:
every 30 minutes (adjustable)
- Session target:
isolated
- Payload kind:
agentTurn
- Model: the user's chosen orchestrator model
- Message: the orchestrator prompt template, with all
<placeholder> tokens filled in:
<project> → project name
<org-root> → absolute path to the ORG directory
<project-root> → absolute path to the project directory
<repo-root> → absolute path to the code repository (ask user)
- Phase prompt paths → absolute paths to the skill's bundled phase prompt templates
Tell the user the cron job ID so they can manage it later.
6. Summary
Print a brief summary:
- ORG directory location
- Departments created
- Project(s) created
- Cron job ID and schedule
- Remind them to fill in TASKBOARD.md with initial priorities
Task: Add a New Project (lattice new-project)
- Ask for: project name, one-line description, code repo path
- Copy
templates/ORG/PROJECTS/example-project/ → ORG/PROJECTS/<name>/
- Customize STATUS.md, DECISIONS.md, PIPELINE_STATE.json (same as step 3-4 above)
- Optionally create a new orchestrator cron job for this project
Task: Add a New Department (lattice new-dept)
- Ask for: department name, mission (one sentence)
- Copy
templates/ORG/DEPARTMENTS/example-dept/ → ORG/DEPARTMENTS/<name>/
- Fill in CHARTER.md with the department name and mission
- Update ORG_README.md §5 to include the new department
Task: Check Organization Status (lattice status)
- Read
ORG/TASKBOARD.md — summarize active priorities
- For each project in
ORG/PROJECTS/:
- Read
STATUS.md — current phase and progress
- Read
PIPELINE_STATE.json — phase statuses, blockers, run number
- For each department in
ORG/DEPARTMENTS/:
- Read
HANDOFF.md — current state and blockers
- Present a concise status report
Pipeline Architecture (for reference)
8 Phases
Constitute → Research → Specify → Plan+Tasks → Implement → Test → Review → Gap Analysis
3-Layer Assistance (when a phase gets stuck)
- Model Escalation — retry with progressively stronger models
- Peer Consult — parallel multi-model consultation + synthesis
- Auto-Triage — automated judge decides: RELAX (loosen constraints) / DEFER (next iteration) / BLOCK (wait for human)
Key Files per Project
ORG/PROJECTS/<project>/
├── STATUS.md # Human-readable status
├── DECISIONS.md # Key decisions + rationale
├── PIPELINE_STATE.json # Phase state machine
├── PIPELINE_LOG.jsonl # Append-only history
├── pipeline/ # Current run artifacts
└── pipeline_archive/ # Historical runs
1---
2name: lattice
3description: >
4 Initialize and manage Lattice organizations — a file-based operating system for AI agent teams
5 that enables stable, long-running iterative development through an 8-phase pipeline.
6 Core strengths: (1) File-driven state keeps agents on track across sessions — no context loss,
7 no drift, tasks complete reliably over hours or days. (2) Three-tier failure handling
8 (model escalation → peer consult → auto-triage) automatically unblocks stuck agents without
9 human intervention. (3) Per-phase model configuration — use strong models for thinking-heavy
10 phases (planning, review), cost-efficient models for token-heavy phases (implementation, testing),
11 optimizing token cost. (4) Multi-project parallel execution
12 with cron scheduling — run several projects simultaneously, each on its own cadence.
13 Triggers: lattice, org framework, pipeline setup, agent team, multi-agent project, 8-phase pipeline,
14 new org, new project, department setup, pipeline orchestrator, long-running tasks, model escalation,
15 peer consult, auto-triage, token optimization.
16metadata:
17 source: https://skillmd.com/skills/modbender/lattice
18---
19
20# Lattice
21
22Lattice is a file-based operating system for AI agent teams. It replaces volatile chat windows with persistent files, enabling agents to work stably through long, iterative development cycles via an 8-phase execution pipeline.
23
24**Why Lattice?**
25
26- **Stable long-running execution** — File-driven state machine ensures agents stay on track across sessions. No context window overflow, no drift. Tasks complete reliably over hours or days through structured iteration.
27- **Three-tier failure handling** — When an agent gets stuck: (1) Model Escalation retries with stronger models, (2) Peer Consult gathers parallel opinions from multiple models, (3) Auto-Triage makes a judgment call (relax constraints / defer / block for human). Most blockers resolve automatically.
28- **Per-phase model configuration** — Thinking-heavy phases (planning, review, architecture) need strong reasoning models; token-heavy phases (implementation, testing) can use cost-efficient coding models. This dramatically reduces overall token cost without sacrificing quality where it matters.
29
30**Example model assignment (from a production setup):**
31
32| Phase | Model tier | Example |
33|-------|-----------|---------|
34| Constitute (architecture) | Strong reasoning | Claude Opus |
35| Research | Strong reasoning | Gemini Pro |
36| Specify (design) | Strong reasoning | Claude Opus |
37| Plan + Tasks | Strong reasoning | Claude Opus |
38| Implement | Cost-efficient coding | GPT Codex |
39| Test | Cost-efficient coding | GPT Codex |
40| Review | Strong reasoning | Claude Opus |
41| Gap Analysis | Strong reasoning | Gemini Pro |
42
43The key insight: implementation and testing consume the most tokens (writing/running code), but don't require the most expensive models. Planning and review consume fewer tokens but need deeper reasoning. Match model strength to cognitive demand, not token volume.
44- **Multi-project parallel execution** — Run multiple projects simultaneously, each with its own cron-scheduled orchestrator. Combined with OpenClaw's cron system, projects advance autonomously on independent cadences.
45
46Templates are bundled at `templates/ORG/` relative to this skill directory.
47
48## Quick Reference
49
50- Full design doc: `templates/ORG/PROJECTS/pipeline-framework/DESIGN.md`
51- Pipeline guide (all agents): `templates/ORG/PIPELINE_GUIDE.md`
52- Sub-agent guide: `templates/ORG/PROJECTS/pipeline-framework/templates/PIPELINE_GUIDE_FOR_SUBAGENTS.md`
53- Orchestrator prompt template: `templates/ORG/PROJECTS/pipeline-framework/templates/ORCHESTRATOR_PROMPT.template.md`
54- Phase prompt templates: `templates/ORG/PROJECTS/pipeline-framework/templates/PHASE_PROMPTS/`
55- State machine template: `templates/ORG/PROJECTS/pipeline-framework/templates/PIPELINE_STATE.template.json`
56
57---
58
59## Task: Initialize a New Organization (`lattice init`)
60
61### 1. Gather Information
62
63Ask the user for:
64- **Organization name** (e.g. "Acme Labs")
65- **Target directory** — where to create the `ORG/` folder (default: current workspace root)
66- **Departments** — list of department names (e.g. Research, Engineering, Reliability)
67- **First project** (optional) — name + one-line description
68
69Keep it conversational. Don't dump all questions at once.
70
71### 2. Scaffold the ORG Directory
72
73Copy the entire `templates/ORG/` directory to `<target>/ORG/`.
74
75Then customize:
76
771. **ORG_README.md** — Replace the example org structure in §5 with the user's actual departments
782. **TASKBOARD.md** — Leave the template structure intact (user fills in priorities later)
793. **Departments** — For each department the user listed:
80 - Copy `DEPARTMENTS/example-dept/` → `DEPARTMENTS/<dept-name>/`
81 - In each copied department, replace `<Department Name>` placeholders in CHARTER.md, RUNBOOK.md, HANDOFF.md with the actual department name
82 - Reset STATE.json to `{"lastRun": null, "cursor": null, "notes": "Initial state"}`
834. **Remove** `DEPARTMENTS/example-dept/` after creating real departments (unless user wants to keep it as reference)
84
85### 3. Create the First Project (if requested)
86
87- Copy `PROJECTS/example-project/` → `PROJECTS/<project-name>/`
88- Update STATUS.md with the project name
89- Update DECISIONS.md header
90- Configure PIPELINE_STATE.json (see "Configure Pipeline State" below)
91- Remove `PROJECTS/example-project/` after creating the real project
92
93### 4. Configure Pipeline State
94
95Read `templates/ORG/PROJECTS/pipeline-framework/templates/PIPELINE_STATE.template.json` as the reference.
96
97Ask the user:
98- **Which agents** will run each phase? (agentId per role — or a single agent for all)
99- **Which models** for each phase? (or a default model)
100- **Escalation chain** — list of models from cheapest to strongest (e.g. `["gflash", "gpro", "sonnet"]`)
101- **Peer consult models** — which models to consult in parallel when stuck
102- **Synthesizer/triage model** — typically the strongest available model
103- **Notification channel** (optional) — where to send pipeline status updates
104
105Fill in the project's `PIPELINE_STATE.json` with these values, replacing all `<placeholder>` tokens.
106
107### 5. Set Up the Orchestrator Cron Job
108
109Read `templates/ORG/PROJECTS/pipeline-framework/templates/ORCHESTRATOR_PROMPT.template.md`.
110
111Create a cron job using the `cron` tool:
112- **Schedule**: `every 30 minutes` (adjustable)
113- **Session target**: `isolated`
114- **Payload kind**: `agentTurn`
115- **Model**: the user's chosen orchestrator model
116- **Message**: the orchestrator prompt template, with all `<placeholder>` tokens filled in:
117 - `<project>` → project name
118 - `<org-root>` → absolute path to the ORG directory
119 - `<project-root>` → absolute path to the project directory
120 - `<repo-root>` → absolute path to the code repository (ask user)
121 - Phase prompt paths → absolute paths to the skill's bundled phase prompt templates
122
123Tell the user the cron job ID so they can manage it later.
124
125### 6. Summary
126
127Print a brief summary:
128- ORG directory location
129- Departments created
130- Project(s) created
131- Cron job ID and schedule
132- Remind them to fill in TASKBOARD.md with initial priorities
133
134---
135
136## Task: Add a New Project (`lattice new-project`)
137
1381. Ask for: project name, one-line description, code repo path
1392. Copy `templates/ORG/PROJECTS/example-project/` → `ORG/PROJECTS/<name>/`
1403. Customize STATUS.md, DECISIONS.md, PIPELINE_STATE.json (same as step 3-4 above)
1414. Optionally create a new orchestrator cron job for this project
142
143---
144
145## Task: Add a New Department (`lattice new-dept`)
146
1471. Ask for: department name, mission (one sentence)
1482. Copy `templates/ORG/DEPARTMENTS/example-dept/` → `ORG/DEPARTMENTS/<name>/`
1493. Fill in CHARTER.md with the department name and mission
1504. Update ORG_README.md §5 to include the new department
151
152---
153
154## Task: Check Organization Status (`lattice status`)
155
1561. Read `ORG/TASKBOARD.md` — summarize active priorities
1572. For each project in `ORG/PROJECTS/`:
158 - Read `STATUS.md` — current phase and progress
159 - Read `PIPELINE_STATE.json` — phase statuses, blockers, run number
1603. For each department in `ORG/DEPARTMENTS/`:
161 - Read `HANDOFF.md` — current state and blockers
1624. Present a concise status report
163
164---
165
166## Pipeline Architecture (for reference)
167
168### 8 Phases
169```
170Constitute → Research → Specify → Plan+Tasks → Implement → Test → Review → Gap Analysis
171```
172
173### 3-Layer Assistance (when a phase gets stuck)
1741. **Model Escalation** — retry with progressively stronger models
1752. **Peer Consult** — parallel multi-model consultation + synthesis
1763. **Auto-Triage** — automated judge decides: RELAX (loosen constraints) / DEFER (next iteration) / BLOCK (wait for human)
177
178### Key Files per Project
179```
180ORG/PROJECTS/<project>/
181├── STATUS.md # Human-readable status
182├── DECISIONS.md # Key decisions + rationale
183├── PIPELINE_STATE.json # Phase state machine
184├── PIPELINE_LOG.jsonl # Append-only history
185├── pipeline/ # Current run artifacts
186└── pipeline_archive/ # Historical runs
187```