← Agent Project Management → Agent Platform Phase 2 · Prompt Deck
Agent Project Management Spec
How does an agent know whether to fix, file, or build?
Success
Right mindset, skills + tools always load at the right time, no bloat, no hallucination, minimum token cost, maximum effectiveness.
Intent
Projects contain plans. Plans contain tasks. Each layer carries different context.
| Layer | Carries | Example |
|---|---|---|
| Project | Scope, team, goals | Agent Platform |
| Plan | Agents (system prompts), required skills | Phase 1: Issue CRUD |
| Task | Instruction prompt, tools, skills, pattern | "Create issue-cli.ts create command" |
Tools + skills = capabilities. Tasks also carry a best-practice pattern (nx generator, MCP tool, or CLI) that the prompt should activate.
Three problems to solve:
- Context budget — Monitor fill. Each project/plan/task must carry enough guidance to save useful asides (failing tests, type errors, tech debt) to memory, then
/clearbefore the next task to keep peak performance. - Capability loading — Each plan should activate only the agents, skills, and MCP tools it needs. Loading everything wastes tokens and confuses routing.
- Structured persistence — Issues and decisions go to the DB (queryable). Unstructured notes go to markdown in working memory. Both survive
/clear.
This is a dedicated PRD — not an expansion of Agent Platform.
Intent Contract
| Dimension | Statement |
|---|---|
| Objective | Structured issue tracking and decision routing so commissioners and agents stop managing work in markdown files that can't be queried |
| Outcomes | 1. All issues queryable by PRD, severity, status via CLI within 30 days. 2. Decision routing (fix/PRD/story) codified and enforced. 3. Engineering reads from DB, not markdown. |
| Health Metrics | Issue resolution time. Zero data loss during migration. |
| Constraints | Hard: Multi-tenant isolation. Soft: Reuse existing priority_problems table where schema aligns. |
| Autonomy | Allowed: CLI implementation, schema migration, query design. Escalate: UI decisions, new DB tables. Never: Delete resolved issues, modify other PRD scopes. |
| Stop Rules | Complete when: engineering reads issues from DB for 2 consecutive sprints. Halt when: priority_problems schema divergence requires full rewrite. |
| Counter-metrics | Commissioner issue logging speed must not increase. Current file-based workflow takes <2 min per issue. |
| Blast Radius | priority_problems table, planning_issue_links junction, feature-matrix.md, issues-log.md. |
| Rollback | Markdown file remains source of truth until Phase 2 proven. CLI writes to both DB and file during transition. |
Story Contract
| # | Intention | Trigger | Observable Success | Forbidden Outcome | Evidence Type | Escalation |
|---|---|---|---|---|---|---|
| S1 | Commissioner logs issue without editing markdown | Commissioner finds bug during dogfood | CLI returns issue ID + issue appears in DB query within 5s | Issue logged to DB but missing from markdown backup | e2e | --- |
| S2 | Agent decides fix vs PRD vs story | Issue requires >30 min or new schema | CLI outputs routing decision with reasoning | Issue sits unrouted for >1 sprint | integration | Agent must stop if routing is ambiguous |
| S3 | Engineering reads fix queue from DB | Engineer starts fix session | CLI query returns filtered, sorted issues matching old markdown view | DB query returns different results than markdown | e2e | --- |
| S4 | Resolved issues retain evidence | Engineer closes issue | Resolved record has date, resolver, evidence link | Resolution overwrites or deletes the issue record | unit | --- |
| S5 | HITL creates plan without leaving browser | Commissioner starts new work stream | Plan appears in /plans table and DB within 2s of form submit | Plan created without name or team assignment | e2e | --- |
| S6 | HITL sees plan progress and linked issues | Commissioner checks work stream health | Plan detail page shows tasks, completion %, and linked issues | Plan detail exposes data from other orgs | e2e | --- |
| S7 | Dashboard reflects reality, not hardcoded zeros | Commissioner opens /plans | Stat cards show actual counts matching DB query | Metrics include plans from other orgs | integration | --- |
Build Contract
Job: Issue CRUD via CLI
| # | ID | Function | Artifact | Success Test | Safety Test | Regression Test | Value | State |
|---|---|---|---|---|---|---|---|---|
| 1 | PLAT-001 | Create issue with prd_slug, severity, page, summary | issue-cli.ts create command | create --prd=prd-sales-crm-rfp --severity=HIGH --page=/crm/companies --summary="Permission error" returns ID | Never creates issue without prd_slug or severity | Existing agent-comms.ts CLI still works | Log issues in 30s, not 2 min | Gap |
| 2 | PLAT-001 | List issues filtered by prd, severity, status | issue-cli.ts list command | list --prd=prd-sales-crm-rfp --status=open returns matching subset | Never exposes issues across org boundaries | prioritise-prds.mjs still runs | Find the fix queue instantly | Gap |
| 3 | PLAT-001 | Resolve issue with evidence | issue-cli.ts resolve command | resolve --id=26 --evidence="PR #210" sets status, date, resolver | Never deletes the issue record (soft close only) | Resolved count in feature-matrix stays accurate | Prove the fix happened | Gap |
| 4 | PLAT-001 | Aggregate counts by prd, severity, status | issue-cli.ts summary command | summary output matches current Issue Summary table format | Never double-counts issues across PRDs | Dashboard page still renders | Replace manual summary table | Gap |
Job: Decision Routing
| # | ID | Function | Artifact | Success Test | Safety Test | Regression Test | Value | State |
|---|---|---|---|---|---|---|---|---|
| 5 | PLAT-001 | Route issue: fix (<30 min, no new schema) vs story (within frozen scope) vs PRD (new schema/API/UI) | issue-cli.ts route command | route --id=26 outputs decision + reasoning based on issue characteristics | Never adds a feature ID to a frozen PRD scope | PRD maintenance checks still pass | Know what to do, not just what's broken | Gap |
Job: HITL Plans Dashboard
Dogfood evidence (2026-03-10): /plans renders empty shell — 0 plans, no create action. /plans/analytics shows zero metrics. /calendar (Team Calendar) shows "No Plans Scheduled." Plans exist in DB via plan-cli.ts but the UI reads nothing. The HITL has no way to create, view, or manage plans through the web interface.
| # | ID | Function | Artifact | Success Test | Safety Test | Regression Test | Value | State |
|---|---|---|---|---|---|---|---|---|
| 8 | PROJ-001 | Create plan from UI with name, team, template | /plans create button+form | Click "Create Plan" → fill name+team → plan appears in table within 2s | Never creates plan without name or org assignment | Existing plan-cli.ts create still works | HITL can start a plan without CLI | Gap |
| 9 | PROJ-001 | View plan detail with tasks and progress | /plans/[id] detail page | Click plan row → detail page shows tasks, status, completion %. Task list matches DB. | Never exposes plans across org boundaries | Plan CLI status command returns same data | See what needs doing without terminal | Gap |
| 10 | PROJ-001 | Dashboard shows real metrics from DB | /plans stat cards | Total Plans, Active, Completed, Completion Rate reflect actual DB rows. Not hardcoded zeros. | Never counts plans from other orgs | /plans/analytics doesn't break | Know project health at a glance | Gap |
| 11 | PROJ-001 | Plans appear on Team Calendar with date ranges | /calendar timeline | Plan with start/end dates renders as bar on Team Calendar. Click navigates to plan detail. | Never shows plans the user lacks permission to view | Week View (/calendar/week) still renders | See timeline without switching tools | Gap |
| 12 | PROJ-001 | Analytics page shows completion trends | /plans/analytics charts | Completion Rate, Avg Cycle Time, Abandoned count derive from real plan data. At least 1 chart/graph. | Never surfaces individual task-level data in aggregates | Plan list page still loads | Measure whether planning improves | Gap |
| 13 | PLAT-001 | Link issues to plans via UI or CLI | Issue-plan association | issue-cli.ts link --issue=N --plan=P creates junction row. Plan detail shows linked issues. | Never creates orphan links (both sides must exist) | planning_issue_links table backwards-compatible | Connect problems to work streams | Gap |
Job: Migration
| # | ID | Function | Artifact | Success Test | Safety Test | Regression Test | Value | State |
|---|---|---|---|---|---|---|---|---|
| 6 | PLAT-001 | Backfill existing markdown issues to DB | issue-cli.ts migrate command | All 6 active + 15 resolved issues appear in DB with matching fields | Never loses data during migration (row count match) | issues-log.md remains readable as static page | One-time bridge from file to DB | Gap |
| 7 | PLAT-001 | Generate markdown from DB (transition period) | issue-cli.ts export command | export produces markdown matching current issues-log.md format | Never overwrites manually edited markdown without --force flag | issues-log.md page still renders on site | Engineering can read either source | Gap |
Principles
The Job
| Element | Detail |
|---|---|
| Situation | Commissioner finds issue during dogfood or agent hits friction mid-session |
| Intention | Issue tracked, routed (fix/PRD/story), resolved with evidence -- queryable by anyone |
| Obstacle | Markdown can't be queried; eng's priority_problems table doesn't match spec; no routing logic |
| Hardest Thing | Decision routing -- knowing when something is a 30-min fix vs a new PRD vs a story in frozen scope |
Why Now
6 active issues in markdown. Volume growing. Engineering already built priority_problems + planning_issue_links but schema doesn't match commissioning workflow. The gap between what exists and what's needed is small but structural.
Design Constraints
| Constraint | Rationale |
|---|---|
| CLI-first, UI later | Follows agent-comms.ts pattern. Agents and commissioners use terminal. |
Extend priority_problems, don't replace | Engineering already has the table. Add columns, don't rebuild. |
| Multi-tenant | Issues belong to an org, not global |
| Severity enum: HIGH/MEDIUM/LOW | Keeps aggregation clean, matches existing log |
| Soft delete only | Resolved issues are historical record |
Decision Routing Logic
Issue discovered
|
+-- Can fix in < 30 min, no new schema?
| YES --> FIX (log via issue-cli, engineering picks from queue)
|
+-- Needs new schema/API/UI?
| +-- <= 5 feature IDs? --> NEW PRD (create-prd skill)
| +-- > 5 feature IDs? --> SPLIT into multiple PRDs
|
+-- Existing PRD covers this?
+-- Within frozen scope? --> ADD STORY to spec
+-- Outside frozen scope? --> NEW PRD
Performance
Priority Score
PRIORITY = Pain x Demand x Edge x Trend x Conversion
| Dimension | Score (1-5) | Evidence |
|---|---|---|
| Pain | 4 | 8 min per issue in markdown. Can't query, filter, or route. Volume growing. Engineering reads wrong source. |
| Demand | 4 | Every commissioning session produces issues. Engineering, commissioners, and agents all blocked by the same file. Critical operating process. |
| Edge | 3 | Decision routing logic (fix/PRD/story) is novel. Fits commissioning model no competitor has. |
| Trend | 4 | Agent project management is structural -- every AI team needs this |
| Conversion | 3 | Internal infrastructure that unblocks all other PRDs. Platform value, not direct revenue. |
| Composite | 576 | 4 x 4 x 3 x 4 x 3 |
Quality Targets
- Issue creation: <30s via CLI
- Query response: <500ms
- Migration: 0 data loss (row count match)
Failure Budget
| Failure Type | Budget | Response |
|---|---|---|
| Lost issue | 0% | Halt migration, investigate |
| Misrouted decision | 10% | Log override, improve routing heuristic |
Kill signal: If engineering still edits issues-log.md manually after Phase 2 ships, migration failed.
Platform
Current State
| Component | Built | Wired | Working | Notes |
|---|---|---|---|---|
priority_problems table | Yes | Partial | No | Missing severity, page, prd_slug fields |
planning_issue_links junction | Yes | Yes | No | Links issues to plans, not PRDs |
issues-log.md | Yes | Yes | Yes | Current source of truth |
agent-comms.ts CLI | Yes | Yes | Yes | Pattern to follow for issue-cli |
prioritise-prds.mjs | Yes | Yes | Yes | Needs issue count integration |
Build Ratio
~60% composition (extend existing table + follow CLI pattern), ~40% new code (routing logic, migration).
Protocols
Build Order
| Sprint | Features | What | Effort | Acceptance |
|---|---|---|---|---|
| 0 | #1, #2, #3, #4 | Issue CRUD CLI | 2 days | All 4 commands work against DB |
| 1 | #6, #7 | Migration + export | 1 day | Row count matches, markdown generates |
| 2 | #5, #13 | Decision routing + link | 1 day | Route decision correct for 3 cases. Issue-plan link works |
| 3 | #8, #9, #10 | Plans UI (HITL) | 3 days | Create plan, view detail, dashboard reads real data |
| 4 | #11, #12 | Calendar + analytics | 2 days | Plans on timeline, analytics shows trends |
Commissioning
| # | Feature | Install | Test | Operational | Optimize |
|---|---|---|---|---|---|
| 1 | Create issue | --- | --- | --- | --- |
| 2 | List issues | --- | --- | --- | --- |
| 3 | Resolve issue | --- | --- | --- | --- |
| 4 | Summary | --- | --- | --- | --- |
| 5 | Route | --- | --- | --- | --- |
| 6 | Migrate | --- | --- | --- | --- |
| 7 | Export | --- | --- | --- | --- |
| 8 | Create plan (UI) | --- | --- | --- | --- |
| 9 | Plan detail page | --- | --- | --- | --- |
| 10 | Plans dashboard | --- | --- | --- | --- |
| 11 | Calendar timeline | --- | --- | --- | --- |
| 12 | Plans analytics | --- | --- | --- | --- |
| 13 | Issue-plan link | --- | --- | --- | --- |
Agent-Facing Spec
Commands:
npx tsx tools/scripts/issues/issue-cli.ts create --prd=SLUG --severity=HIGH|MEDIUM|LOW --page=ROUTE --summary="TEXT"
npx tsx tools/scripts/issues/issue-cli.ts list [--prd=SLUG] [--severity=X] [--status=open|resolved|wont-fix]
npx tsx tools/scripts/issues/issue-cli.ts resolve --id=N --evidence="TEXT"
npx tsx tools/scripts/issues/issue-cli.ts summary
npx tsx tools/scripts/issues/issue-cli.ts route --id=N
npx tsx tools/scripts/issues/issue-cli.ts migrate
npx tsx tools/scripts/issues/issue-cli.ts export
Boundaries:
- Always: Create, list, summary, export
- Ask first: Resolve (requires evidence), route (outputs recommendation, human confirms)
- Never: Delete issues, modify resolved records, change severity after resolution
Test Contract:
| # | Feature | Test File | Assertion |
|---|---|---|---|
| 1 | Create | issue-cli.test.ts | Returns ID, fields match input, org isolated |
| 2 | List | issue-cli.test.ts | Filters return correct subset, sorted by created_at |
| 3 | Resolve | issue-cli.test.ts | Status changes, date set, record preserved |
| 4 | Summary | issue-cli.test.ts | Counts match manual calculation |
| 5 | Route | issue-cli.test.ts | Fix/PRD/story decision matches expected for 3 scenarios |
Players
Demand-Side Jobs
Job 1: Commissioner Logs Issue
Situation: During dogfood session, commissioner finds a bug or UX issue.
| Element | Detail |
|---|---|
| Struggling moment | Open markdown file, find right table, format row, push to git |
| Current workaround | Edit issues-log.md directly, hope format is right |
| What progress looks like | One CLI command, issue tracked, queryable immediately |
| Hidden objection | "The file works fine for now" |
| Switch trigger | Issue volume exceeds what markdown can handle (>20 active) |
Features that serve this job: #1, #2, #3
Job 2: HITL Manages Plans
Situation: Commissioner (wik) opens /plans to see what work streams exist and create new ones.
| Element | Detail |
|---|---|
| Struggling moment | /plans shows 0 plans. No create button. Plans exist in DB via CLI but UI is blind. |
| Current workaround | Use plan-cli.ts in terminal. Can't share view with non-technical stakeholders. |
| What progress looks like | Open /plans, see active work, create new plan, drill into tasks and issues. |
| Hidden objection | "CLI is fine for agents, why do I need a UI?" |
| Switch trigger | Need to show progress to someone who doesn't use a terminal. |
Features that serve this job: #8, #9, #10, #11, #12, #13
Job 3: Agent Routes Work
Situation: Agent discovers friction that could be a bug, a missing feature, or a process gap.
| Element | Detail |
|---|---|
| Struggling moment | No decision framework -- logs everything as an issue or ignores it |
| Current workaround | Ask human what to do, or guess |
| What progress looks like | CLI route command outputs fix/PRD/story with reasoning |
| Hidden objection | "Routing is a human judgment call" |
| Switch trigger | Same routing mistake made twice |
Features that serve this job: #5, #13
Role Definitions
| Role | Access | Permissions |
|---|---|---|
| Commissioner | All issues in own org | Create, list, resolve, route, export |
| Engineer | All issues in own org | List, resolve |
| Agent | All issues in own org | Create, list, route |
Relationship to Other PRDs
| PRD | Relationship | Data Flow |
|---|---|---|
| Agent Platform | Parent | Consolidated — this spec is Phase 2 |
| Sales CRM & RFP | Consumer | Most issues originate from CRM commissioning |
Context
- PRD Index — Agent Project Management → Agent Platform Phase 2
- Prompt Deck — 5-card pitch