Status: Engineering reference. Current as of 2026-06-30. Version: Right (engineering) Author: Good-Agent-PM Purpose: Single-source-of-truth for the mode flag protocol, sub-agent dispatch interfaces, and the proposed pipeline database schema. No narrative. No metaphor.
Every session begins with:
"I pledge to be a Good Project Manager."
Mode flags: thoughts / plan / proceed / analyze / probe / execute. No flag → mode?
| Flag | Mode | Behavior |
|---|---|---|
| (missing) | — | PM responds mode? — no action taken until a flag is provided. |
thoughts |
Design | Pure discussion. No code, no document changes. |
plan |
Design | Create or update planning document (plan.md). |
proceed |
Direct action | PM edits allowed files (profiles, plan.md) directly. |
analyze |
Analysis | Dispatch good-agent-analyze sub-agent: read-only gap analysis. |
probe |
Probe | Dispatch good-agent-probe sub-agent: adversarial failure-mode analysis. |
execute |
Execution | Dispatch good-agent-execute sub-agent: implement phase exactly. |
| Syntax | Behavior | Example |
|---|---|---|
X and Y |
Parallel dispatch | analyze and probe → both sub-agents run concurrently |
X then Y |
Sequential | plan then analyze and probe → plan first, then analysis + probe in parallel |
Constraint: execute is always single-mode only. Cannot appear in a compound flag.
| Sub-agent | Permission | Input | Output |
|---|---|---|---|
| good-agent-analyze | Read-only (plan + codebase) | Plan document path, phase/scope identifier | Analysis report: gaps, ambiguities, blockers |
| good-agent-probe | Read-only (plan + codebase) | Plan document path, phase/scope identifier | Probe report: failure modes, edge cases, silent breakage |
| good-agent-execute | Read + write (application files) | Plan document path, phase identifier | Implementation. Stops on blockers — reports to PM. |
Rules:
| Layer | Scope | Decomposition axis | Artifact boundary |
|---|---|---|---|
| Project-level | Full application | Horizontal by architectural layer | Briefs, TECH_STACK, schema, queries |
| Within-project | Single app | Vertical by concern/fix | plan.md, analysis/probe reports |
| Framework-level | Agent system | By artifact type | Sessions, decisions, memories |
Architect (design only, no code)
→ Implementer / DBA (code only, no design)
→ Dependency Resolver (from architecture only)
→ Test Planner (from architecture only — no implementation knowledge)
→ Test Builder (from architecture + test plan + implementation)
→ Test Runner (read-only on tests)
→ Gatekeeper (validates against brief → PASS or REVISE)
| Term | Project-level meaning | Within-project meaning | Framework-level meaning |
|---|---|---|---|
| Phase | A–G (feature cycle), P1–P5 (project sequence) | 1–8 (plan.md steps) | — |
| Gate | Cross-project handoff | Phase completion check | — |
| Mode | Mode 1 / Mode 2 | Mode flags (protocol) | — |
Resolution: Prefix or namespace by context. No term should appear without its scope qualifier in cross-layer communication.
| Attribute | temp3 (single-shot) | /root/app/ (project decomposition) |
|---|---|---|
| Build time | ~2 min | ~3 hours (human-gated), ~30 min (agent-gated) |
| Files | 2 (database.py, main.py) | ~40+ across backend/ and ui/ |
| ID strategy | Integer auto-increment | UUIDs |
| Schema evolution | CREATE TABLE IF NOT EXISTS | Alembic migrations |
| Pagination | None | Cursor-based |
| Tests | None | Full (API + UI) |
| Error handling | HTTPException (404 only) | Typed exceptions (404, 409, 422) |
| Frontend | Flat app.js with hash routing | Alpine.js components + router |
| Agent-maintainable? | No — tightly coupled single file | Yes — modular, testable, separable |
| Task type | Approach | Rationale |
|---|---|---|
| Concept validation / PoC | Single-shot (temp3) | 2 minutes, throwaway cost |
| Product with ongoing maintenance | Project decomposition | Modularity enables agent iteration |
| One-time migration / data fix | Single-shot | No need for maintainability |
| Core infrastructure (auth, DB, API) | Project decomposition | Wrong design here compounds |
Note: The opencode SQLite database at
~/.local/share/opencode/opencode.dbalready tracks sessions, tokens, messages, permissions, projects, and todos — much of what the schema below was designed to provide. This schema was drafted before that discovery and is preserved as a historical artifact of what we believed was needed. A Genesis Container implementation should verify whether the opencode schema covers the required observability before implementing the DDL below. The state machine described in the Genesis Container design likely only needs two overlay tables (featuresandtransitions) on top of what opencode already persists.
-- Core: projects/features
CREATE TABLE sprints (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
state TEXT NOT NULL CHECK (state IN ('planning', 'active', 'review', 'closed')),
description TEXT,
is_meta BOOLEAN NOT NULL DEFAULT 0, -- 1 = work on the pipeline itself
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- Within a sprint: sequenced stages
CREATE TABLE phases (
id INTEGER PRIMARY KEY AUTOINCREMENT,
sprint_id INTEGER NOT NULL REFERENCES sprints(id) ON DELETE CASCADE,
name TEXT NOT NULL,
assigned_role TEXT, -- agent role or "human"
status TEXT NOT NULL CHECK (status IN ('pending', 'active', 'completed')),
notes TEXT,
sort_order INTEGER NOT NULL DEFAULT 0,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- Every sub-agent dispatch
CREATE TABLE agent_runs (
id INTEGER PRIMARY KEY AUTOINCREMENT,
phase_id INTEGER NOT NULL REFERENCES phases(id) ON DELETE CASCADE,
agent_type TEXT NOT NULL, -- 'analyze', 'probe', 'execute'
model TEXT, -- e.g. 'deepseek-v4-flash'
prompt_hash TEXT, -- SHA256 of prompt (for dedup)
prompt_tokens INTEGER,
response_tokens INTEGER,
cost REAL,
status TEXT NOT NULL CHECK (status IN ('running', 'completed', 'failed', 'blocked')),
started_at TIMESTAMP,
completed_at TIMESTAMP,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- Every gate check
CREATE TABLE gate_results (
id INTEGER PRIMARY KEY AUTOINCREMENT,
phase_id INTEGER NOT NULL REFERENCES phases(id) ON DELETE CASCADE,
status TEXT NOT NULL CHECK (status IN ('PASS', 'FLAG', 'BLOCKED')),
steward TEXT, -- which agent/role performed the gate
notes TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- Token tracking (denormalized for query speed)
CREATE VIEW agent_run_summary AS
SELECT
s.id AS sprint_id,
s.name AS sprint_name,
p.id AS phase_id,
p.name AS phase_name,
ar.id AS run_id,
ar.agent_type,
ar.model,
ar.prompt_tokens,
ar.response_tokens,
ar.cost,
ar.status,
ar.started_at,
ar.completed_at
FROM agent_runs ar
JOIN phases p ON p.id = ar.phase_id
JOIN sprints s ON s.id = p.sprint_id;
| Decision | Choice | Rationale |
|---|---|---|
| Sprint state values | planning, active, review, closed |
Matches the lifecycle observed across experiments |
is_meta boolean |
On sprints | Distinguishes work on the pipeline vs work in it. Simpler than a separate projects table with category errors |
| agent_runs stores prompt hash, not prompt | Prompt text can be large; hash enables dedup and lookup without bloating rows | |
| GateResult as separate table, not phase column | Multiple gates per phase possible (re-gate after revisions) | |
| Integer PKs | Simpler than UUIDs for an internal tracking system. Sprints don’t merge across instances. |
Recursion: A meta-sprint changes the pipeline schema. The database cannot represent that it is tracking changes to itself. The is_meta boolean papers over this — it identifies meta-sprints but cannot model their effect on the schema.
Path mapping for containerized runs: If agent runs happen inside Docker, the prompt_hash field needs a companion container_id or host_path to resolve artifacts.
| Missing function | Gap | Possible flag |
|---|---|---|
| Destroy/archive | No structural way to say “this sprint is done, close it” | close or archive |
| Rollback | No way to say “undo the last execute, go back N steps” | rewind |
| Status query | No way to say “what state is the project in?” without natural language | status (reads git log + plan.md) |
[flag] + [message content]
Where [flag] is one of: thoughts, plan, proceed, analyze, probe, execute, or a compound of them.
Document path: <path to plan.md>
Phase identifier: <phase number or name>
Instruction: <read the plan, follow the phase, report blockers>
Sub-agents never receive inline content — the plan document is the interface.
On every dispatch:
agent_runs row with phase_id, agent_type, model, status = 'running'gate_results row with PASS/FLAG/BLOCKEDQuery views:
SELECT * FROM phases WHERE status = 'blocked'SELECT sprint_id, COUNT(*) FILTER (WHERE status = 'FLAG') FROM gate_results GROUP BY sprint_idSELECT sprint_name, SUM(cost) FROM agent_run_summary WHERE cost IS NOT NULL GROUP BY sprint_idOrdered by dependency:
status mode flag — shorthand for “what state is this project in?” — reads git log + plan.mdagent_runs tablegate_resultsclose mode flag — structural destroy/archive functionrewind mode flag — structured rollbackThis document is an engineering reference. It describes concrete interfaces and schemas as they exist or are proposed. It is not a reflection — it is a specification. But like all specifications, it will be wrong about something. File an amendment when that happens.