Skip to main content

← 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.

LayerCarriesExample
ProjectScope, team, goalsAgent Platform
PlanAgents (system prompts), required skillsPhase 1: Issue CRUD
TaskInstruction 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:

  1. 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 /clear before the next task to keep peak performance.
  2. Capability loading — Each plan should activate only the agents, skills, and MCP tools it needs. Loading everything wastes tokens and confuses routing.
  3. 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

DimensionStatement
ObjectiveStructured issue tracking and decision routing so commissioners and agents stop managing work in markdown files that can't be queried
Outcomes1. 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 MetricsIssue resolution time. Zero data loss during migration.
ConstraintsHard: Multi-tenant isolation. Soft: Reuse existing priority_problems table where schema aligns.
AutonomyAllowed: CLI implementation, schema migration, query design. Escalate: UI decisions, new DB tables. Never: Delete resolved issues, modify other PRD scopes.
Stop RulesComplete when: engineering reads issues from DB for 2 consecutive sprints. Halt when: priority_problems schema divergence requires full rewrite.
Counter-metricsCommissioner issue logging speed must not increase. Current file-based workflow takes <2 min per issue.
Blast Radiuspriority_problems table, planning_issue_links junction, feature-matrix.md, issues-log.md.
RollbackMarkdown file remains source of truth until Phase 2 proven. CLI writes to both DB and file during transition.

Story Contract

#IntentionTriggerObservable SuccessForbidden OutcomeEvidence TypeEscalation
S1Commissioner logs issue without editing markdownCommissioner finds bug during dogfoodCLI returns issue ID + issue appears in DB query within 5sIssue logged to DB but missing from markdown backupe2e---
S2Agent decides fix vs PRD vs storyIssue requires >30 min or new schemaCLI outputs routing decision with reasoningIssue sits unrouted for >1 sprintintegrationAgent must stop if routing is ambiguous
S3Engineering reads fix queue from DBEngineer starts fix sessionCLI query returns filtered, sorted issues matching old markdown viewDB query returns different results than markdowne2e---
S4Resolved issues retain evidenceEngineer closes issueResolved record has date, resolver, evidence linkResolution overwrites or deletes the issue recordunit---
S5HITL creates plan without leaving browserCommissioner starts new work streamPlan appears in /plans table and DB within 2s of form submitPlan created without name or team assignmente2e---
S6HITL sees plan progress and linked issuesCommissioner checks work stream healthPlan detail page shows tasks, completion %, and linked issuesPlan detail exposes data from other orgse2e---
S7Dashboard reflects reality, not hardcoded zerosCommissioner opens /plansStat cards show actual counts matching DB queryMetrics include plans from other orgsintegration---

Build Contract

Job: Issue CRUD via CLI

#IDFunctionArtifactSuccess TestSafety TestRegression TestValueState
1PLAT-001Create issue with prd_slug, severity, page, summaryissue-cli.ts create commandcreate --prd=prd-sales-crm-rfp --severity=HIGH --page=/crm/companies --summary="Permission error" returns IDNever creates issue without prd_slug or severityExisting agent-comms.ts CLI still worksLog issues in 30s, not 2 minGap
2PLAT-001List issues filtered by prd, severity, statusissue-cli.ts list commandlist --prd=prd-sales-crm-rfp --status=open returns matching subsetNever exposes issues across org boundariesprioritise-prds.mjs still runsFind the fix queue instantlyGap
3PLAT-001Resolve issue with evidenceissue-cli.ts resolve commandresolve --id=26 --evidence="PR #210" sets status, date, resolverNever deletes the issue record (soft close only)Resolved count in feature-matrix stays accurateProve the fix happenedGap
4PLAT-001Aggregate counts by prd, severity, statusissue-cli.ts summary commandsummary output matches current Issue Summary table formatNever double-counts issues across PRDsDashboard page still rendersReplace manual summary tableGap

Job: Decision Routing

#IDFunctionArtifactSuccess TestSafety TestRegression TestValueState
5PLAT-001Route issue: fix (<30 min, no new schema) vs story (within frozen scope) vs PRD (new schema/API/UI)issue-cli.ts route commandroute --id=26 outputs decision + reasoning based on issue characteristicsNever adds a feature ID to a frozen PRD scopePRD maintenance checks still passKnow what to do, not just what's brokenGap

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.

#IDFunctionArtifactSuccess TestSafety TestRegression TestValueState
8PROJ-001Create plan from UI with name, team, template/plans create button+formClick "Create Plan" → fill name+team → plan appears in table within 2sNever creates plan without name or org assignmentExisting plan-cli.ts create still worksHITL can start a plan without CLIGap
9PROJ-001View plan detail with tasks and progress/plans/[id] detail pageClick plan row → detail page shows tasks, status, completion %. Task list matches DB.Never exposes plans across org boundariesPlan CLI status command returns same dataSee what needs doing without terminalGap
10PROJ-001Dashboard shows real metrics from DB/plans stat cardsTotal Plans, Active, Completed, Completion Rate reflect actual DB rows. Not hardcoded zeros.Never counts plans from other orgs/plans/analytics doesn't breakKnow project health at a glanceGap
11PROJ-001Plans appear on Team Calendar with date ranges/calendar timelinePlan with start/end dates renders as bar on Team Calendar. Click navigates to plan detail.Never shows plans the user lacks permission to viewWeek View (/calendar/week) still rendersSee timeline without switching toolsGap
12PROJ-001Analytics page shows completion trends/plans/analytics chartsCompletion Rate, Avg Cycle Time, Abandoned count derive from real plan data. At least 1 chart/graph.Never surfaces individual task-level data in aggregatesPlan list page still loadsMeasure whether planning improvesGap
13PLAT-001Link issues to plans via UI or CLIIssue-plan associationissue-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-compatibleConnect problems to work streamsGap

Job: Migration

#IDFunctionArtifactSuccess TestSafety TestRegression TestValueState
6PLAT-001Backfill existing markdown issues to DBissue-cli.ts migrate commandAll 6 active + 15 resolved issues appear in DB with matching fieldsNever loses data during migration (row count match)issues-log.md remains readable as static pageOne-time bridge from file to DBGap
7PLAT-001Generate markdown from DB (transition period)issue-cli.ts export commandexport produces markdown matching current issues-log.md formatNever overwrites manually edited markdown without --force flagissues-log.md page still renders on siteEngineering can read either sourceGap

Principles

The Job

ElementDetail
SituationCommissioner finds issue during dogfood or agent hits friction mid-session
IntentionIssue tracked, routed (fix/PRD/story), resolved with evidence -- queryable by anyone
ObstacleMarkdown can't be queried; eng's priority_problems table doesn't match spec; no routing logic
Hardest ThingDecision 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

ConstraintRationale
CLI-first, UI laterFollows agent-comms.ts pattern. Agents and commissioners use terminal.
Extend priority_problems, don't replaceEngineering already has the table. Add columns, don't rebuild.
Multi-tenantIssues belong to an org, not global
Severity enum: HIGH/MEDIUM/LOWKeeps aggregation clean, matches existing log
Soft delete onlyResolved 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

DimensionScore (1-5)Evidence
Pain48 min per issue in markdown. Can't query, filter, or route. Volume growing. Engineering reads wrong source.
Demand4Every commissioning session produces issues. Engineering, commissioners, and agents all blocked by the same file. Critical operating process.
Edge3Decision routing logic (fix/PRD/story) is novel. Fits commissioning model no competitor has.
Trend4Agent project management is structural -- every AI team needs this
Conversion3Internal infrastructure that unblocks all other PRDs. Platform value, not direct revenue.
Composite5764 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 TypeBudgetResponse
Lost issue0%Halt migration, investigate
Misrouted decision10%Log override, improve routing heuristic

Kill signal: If engineering still edits issues-log.md manually after Phase 2 ships, migration failed.

Platform

Current State

ComponentBuiltWiredWorkingNotes
priority_problems tableYesPartialNoMissing severity, page, prd_slug fields
planning_issue_links junctionYesYesNoLinks issues to plans, not PRDs
issues-log.mdYesYesYesCurrent source of truth
agent-comms.ts CLIYesYesYesPattern to follow for issue-cli
prioritise-prds.mjsYesYesYesNeeds issue count integration

Build Ratio

~60% composition (extend existing table + follow CLI pattern), ~40% new code (routing logic, migration).

Protocols

Build Order

SprintFeaturesWhatEffortAcceptance
0#1, #2, #3, #4Issue CRUD CLI2 daysAll 4 commands work against DB
1#6, #7Migration + export1 dayRow count matches, markdown generates
2#5, #13Decision routing + link1 dayRoute decision correct for 3 cases. Issue-plan link works
3#8, #9, #10Plans UI (HITL)3 daysCreate plan, view detail, dashboard reads real data
4#11, #12Calendar + analytics2 daysPlans on timeline, analytics shows trends

Commissioning

#FeatureInstallTestOperationalOptimize
1Create issue------------
2List issues------------
3Resolve issue------------
4Summary------------
5Route------------
6Migrate------------
7Export------------
8Create plan (UI)------------
9Plan detail page------------
10Plans dashboard------------
11Calendar timeline------------
12Plans analytics------------
13Issue-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:

#FeatureTest FileAssertion
1Createissue-cli.test.tsReturns ID, fields match input, org isolated
2Listissue-cli.test.tsFilters return correct subset, sorted by created_at
3Resolveissue-cli.test.tsStatus changes, date set, record preserved
4Summaryissue-cli.test.tsCounts match manual calculation
5Routeissue-cli.test.tsFix/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.

ElementDetail
Struggling momentOpen markdown file, find right table, format row, push to git
Current workaroundEdit issues-log.md directly, hope format is right
What progress looks likeOne CLI command, issue tracked, queryable immediately
Hidden objection"The file works fine for now"
Switch triggerIssue 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.

ElementDetail
Struggling moment/plans shows 0 plans. No create button. Plans exist in DB via CLI but UI is blind.
Current workaroundUse plan-cli.ts in terminal. Can't share view with non-technical stakeholders.
What progress looks likeOpen /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 triggerNeed 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.

ElementDetail
Struggling momentNo decision framework -- logs everything as an issue or ignores it
Current workaroundAsk human what to do, or guess
What progress looks likeCLI route command outputs fix/PRD/story with reasoning
Hidden objection"Routing is a human judgment call"
Switch triggerSame routing mistake made twice

Features that serve this job: #5, #13

Role Definitions

RoleAccessPermissions
CommissionerAll issues in own orgCreate, list, resolve, route, export
EngineerAll issues in own orgList, resolve
AgentAll issues in own orgCreate, list, route

Relationship to Other PRDs

PRDRelationshipData Flow
Agent PlatformParentConsolidated — this spec is Phase 2
Sales CRM & RFPConsumerMost issues originate from CRM commissioning

Context