Single source of product requirements and core user workflows for CodeFRAME.
Complements, but does not duplicate, the architecture spec inspecs/CODEFRAME_SPEC.mdand the sprint index inSPRINTS.md.
CodeFRAME is an autonomous AI development system where multiple specialized agents (lead, backend, frontend, test, review) collaborate to turn natural‑language requirements into working, tested code.
Unlike traditional AI coding assistants, CodeFRAME:
- Runs as a long‑lived service (CLI + FastAPI backend + React dashboard).
- Owns the full lifecycle: discovery → PRD → planning → execution → review → quality enforcement → session resume.
- Maintains persistent context (tiered memory, checkpoints, session state).
- Enforces tests and quality gates so agents cannot “cheat” by skipping tests.
This PRD defines:
- Target users and workflows.
- Functional and non‑functional requirements.
- A set of canonical E2E workflows for Sprint 10+ E2E testing.
- Known gaps between requirements and current implementation.
For architecture details, see specs/CODEFRAME_SPEC.md.
For sprint history and status, see SPRINTS.md.
Most AI tools today assist with isolated code edits in a single file. They do not:
- Own the product requirements (PRD).
- Maintain a consistent plan from idea → issues → tasks.
- Manage multi‑agent execution and human‑in‑the‑loop decisions.
- Enforce tests, coverage, and security as non‑negotiable gates.
Solo devs and small teams end up stitching together:
- Spec tools, AI assistants, PR reviewers, issue trackers, and CI.
- With lots of manual glue, lost context, and inconsistent TDD.
CodeFRAME’s goal: Provide a single, opinionated system that:
- Captures requirements conversationally.
- Produces a structured PRD and a hierarchical plan.
- Executes the plan with multiple agents.
- Surfaces blockers and quality signals in one dashboard.
- Preserves context and sessions across days/weeks.
-
End‑to‑end new‑project workflow
From empty directory to agents running on real tasks via:
codeframe init,codeframe serve, web UI project creation, discovery, PRD, issues/tasks, agent execution.- See Sprint 9.5 + 10 entries in
SPRINTS.md.
-
Socratic discovery and PRD generation
- Lead Agent conducts a structured Q&A.
- Discovery state and Q&A stored in DB.
- Lead Agent generates a Product Requirements Document (PRD).
- See
docs/SPRINT2_PLAN.mdandLeadAgent.generate_prd()incodeframe/agents/lead_agent.py.
-
Hierarchical planning (PRD → Issues → Tasks)
- Issues: user‑level work items editable in the dashboard.
- Tasks: agent‑only units with dependencies and status.
- Exposed via
/api/projects/{id}/issues?include=tasksand rendered byTaskTreeView. - Contract defined in Sprint 2 foundation API contract in
docs/API_CONTRACT_ROADMAP.md.
-
Multi‑agent execution
- Backend, frontend, test, and review agents execute tasks concurrently.
- Agent pool reuse and dependency resolution.
- Architecture in
specs/CODEFRAME_SPEC.md, Sprint 4–5.
-
Human‑in‑the‑loop blockers
- Agents create blockers with severity (SYNC/ASYNC).
- User answers via dashboard → agents resume.
- Defined in
specs/049-human-in-loop/spec.md.
-
Context management and session lifecycle
- HOT/WARM/COLD tiers and flash‑save (Sprint 7,
CLAUDE.md, “Context Management System”). - Session files
.codeframe/session_state.jsonand CLI/API integration (Sprint 9.5,specs/014-session-lifecycle/spec.md).
- HOT/WARM/COLD tiers and flash‑save (Sprint 7,
-
Quality enforcement and review
- Dual‑layer enforcement (language‑agnostic + CodeFRAME‑specific).
- Lint enforcement, review worker, security patterns, quality ratchet.
- Defined in
AI_Development_Enforcement_Guide.mdanddocs/ENFORCEMENT_ARCHITECTURE.md.
- Full multi‑repo orchestration (focus is a single repo per project).
- Complex team RBAC (assume single owner + agents).
- Full production deployment tooling (deployment docs exist, but automated production deployment is not the MVP focus). See
docs/DEPLOYMENT.md.
- Comfortable with CLI and modern web stacks.
- Wants to offload implementation and mechanical work to agents while retaining control over requirements and quality.
- Focuses on what the system should do, not low‑level implementation.
- Interacts via discovery Q&A, PRD review, dashboard, and blocker answers.
High‑level architecture is defined in specs/CODEFRAME_SPEC.md and summarized in the root README.md (“Architecture” section):
- CLI (
codeframe/cli.py) – project initialization, server start, session commands. - Backend API (
codeframe/ui/server.py) – projects, agents, tasks, blockers, discovery, PRD, context, session. - Agent layer (
codeframe/agents/*) – lead + worker agents + pool + dependency resolver. - Persistence (
codeframe/persistence/database.py) – all state with flattened v1.0 schema. - Context & session (
codeframe/lib/context_manager.py,codeframe/core/session_manager.py). - Dashboard (
web-ui/*) – React/TypeScript UI with SWR and WebSocket integration.
This section captures the stepwise workflows; the next section defines formal E2E scenarios around them.
Actor: Developer
Requirements
-
Documented in root
README.mdandTESTING.md:- Python 3.11+, Node 18+, Git, Anthropic API key.
uv sync(or equivalent) for backend;npm installforweb-ui.
-
Must be able to:
- Run full tests:
uv run pytest(see README “Testing”). - Start backend and dashboard manually (if not using
codeframe serve).
- Run full tests:
Goal: Create a project and see it in the dashboard.
Flow (Sprint 1 + 9.5):
-
codeframe init my-app
→ creates./my-app,.codeframe/state.db, default config.
Implemented incodeframe/core/project.pyandcodeframe/cli.py. -
codeframe servefrom repo root
→ validates port, startsuvicorn codeframe.ui.server:app, opens browser.
Implemented inservecommand incodeframe/cli.py(see Sprint 9.5). -
Browser at
/:- Renders Welcome +
ProjectCreationFormas specified in
specs/011-project-creation-flow/spec.md. - Validates name/type/description client‑side.
- Renders Welcome +
-
Submitting form:
- Calls
POST /api/projects(seeprojectsApi.createProjectinweb-ui/src/lib/api.ts). - Backend creates project row and initializes metadata.
- Redirects to
/projects/{id}(Dashboard).
- Calls
Goal: Turn conversational answers into a PRD.
Flow (Sprint 2):
-
Dashboard discovery panel (
DiscoveryProgresscomponent) fetches discovery state via
GET /api/projects/{id}/discovery/progress(seeprojectsApi.getDiscoveryProgressand server handler). -
Lead Agent manages discovery state and question selection; design in
docs/SPRINT2_PLAN.mdunder cf‑15 and cf‑17, plusLeadAgent.get_discovery_status(). -
User answers questions inline:
POST /api/projects/{id}/discovery/answer(see implementation incodeframe/ui/server.py).- Lead Agent updates structured discovery data, broadcasts events via WebSocket.
-
When discovery is complete:
- Lead Agent generates PRD using
generate_prd()inlead_agent.py. - PRD stored in DB (as memory with
category='prd') and file (.codeframe/memory/prd.md).
- Lead Agent generates PRD using
-
Dashboard can fetch PRD:
GET /api/projects/{id}/prd→ contract defined in Sprint 2 foundation API contract indocs/API_CONTRACT_ROADMAP.md.projectsApi.getPRD+PRDResponsetype inweb-ui/src/types/api.ts.
Goal: Represent PRD‑derived work as issues + tasks with dependencies.
Flow:
-
Lead Agent converts PRD → Issues via
generate_issues_from_prdandLeadAgent.generate_issues
(seelead_agent.pyand the “Hierarchical Issue/Task Model” inspecs/CODEFRAME_SPEC.md). -
DB keeps issues/tasks plus DAG dependencies; implementation lives in:
codeframe/persistence/database.pymethods for issues, tasks,task_dependencies.tests/api/test_api_issues.pyverifies the contract.
-
API and UI:
GET /api/projects/{id}/issues?include=tasksreturnsIssuesResponseas defined in Sprint 2 foundation API contract indocs/API_CONTRACT_ROADMAP.md.- Dashboard uses
projectsApi.getIssuesand renders viaTaskTreeView(web-ui/src/components/TaskTreeView.tsx).
- Dashboard uses
Goal: Multiple worker agents execute tasks concurrently, respecting dependencies.
Flow (Sprints 3–5):
-
Lead Agent or a separate coordinator selects ready tasks based on:
- DAG in
task_dependencies(seeDatabase.add_task_dependencyetc.). - Task status (
pendingvsblockedvsin_progress).
- DAG in
-
Agents:
- Backend worker → backend tasks.
- Frontend worker → UI tasks.
- Test worker → tests and verification.
- Review worker → code review and analysis.
-
Agent pool:
- Managed by
AgentPoolManagerincodeframe/agents/agent_pool_manager.py. - Reuses idle agents; limits concurrency (see docstring and tests).
- Managed by
-
UI:
- Agent cards, task statuses, and activity feed updated via WebSocket events.
- High‑level behavior documented in
docs/BIG_PICTURE.mdand Sprints 3–5 entries inSPRINTS.md.
Goal: Surface agent questions and resume work after human answers.
Flow (Sprint 6, 049‑human‑in‑loop):
-
When blocked, worker agents create blockers in DB:
- Schema and behavior in
specs/049-human-in-loop/spec.md. - Implementation in
codeframe/persistence/database.pyandcodeframe/ui/server.pyendpoints:GET /api/projects/{id}/blockersGET /api/blockers/{id}POST /api/blockers/{id}/resolve
- Schema and behavior in
-
Dashboard:
- Fetches blockers via
blockersApi.listandblockersApi.get. - Renders panels and modals (see
web-uicomponents and tests).
- Fetches blockers via
Context (Sprint 7):
- Defined in
CLAUDE.md(“Context Management System (007-context-management)”) andspecs/007-context-management/spec.md. - Implemented in
codeframe/lib/context_manager.pyand related tests.
Session Lifecycle (Sprint 9.5, 014‑session‑lifecycle):
- Design documented in
CLAUDE.md(“Session Lifecycle Management (014-session-lifecycle)”) andspecs/014-session-lifecycle/spec.md. - Implemented in
codeframe/core/session_manager.py, CLIclear-session, and/api/projects/{id}/session.
These E2E workflows are the canonical testable journeys the system must support. They should be covered by Sprint 10 E2E tests (e.g., Playwright + pytest).
Goal: New user goes from a bare clone to agents executing tasks.
Preconditions
- Repo installed per
README.md. - Valid
ANTHROPIC_API_KEY.
Steps
codeframe init my-appcodeframe serve- In browser at
/:- Use
ProjectCreationFormto create a project.
- Use
- Land on
/projects/{id}:- Discovery panel shows active discovery.
- Answer discovery questions until completion.
- Check:
- PRD available via “View PRD” →
/api/projects/{id}/prd. - Issues/tasks available via
/api/projects/{id}/issues?include=tasks.
- PRD available via “View PRD” →
- Start agent execution (via dashboard control or API call). Tasks transition through
pending → in_progress → completedwith real agents.
Expected Results
- Project, discovery, PRD, issues, and tasks persisted in DB.
- Dashboard shows real, non‑mocked data (no placeholder tasks).
- At least one backend/frontend/test agent appears active with live WebSocket updates.
References
specs/011-project-creation-flow/spec.mddocs/SPRINT2_PLAN.mddocs/API_CONTRACT_ROADMAP.md– Sprint 2 foundation API contract- Sprint 9.5 entry in
SPRINTS.md
Goal: Returning user sees “where they left off” and continues.
Preconditions
- Project with partial progress and existing
.codeframe/session_state.json.
Steps
- Stop work (Ctrl+C on CLI, stop dashboard).
- Later:
- Run
codeframe start my-apporcodeframe serveand open/projects/{id}.
- Run
- Session state is loaded:
- Show “Last session” summary.
- Show “Next actions” list and
progress_pct. - Show any “active_blockers”.
- Confirm and continue:
- Agents resume work from remaining tasks.
- Dashboard updates accordingly.
Expected Results
- Session state matches schema in
CLAUDE.md(Session Lifecycle section). GET /api/projects/{id}/sessionreturns expected fields.- Dashboard
SessionStatuscomponent displays correct data.
Gap (to track): codeframe start currently prints a static message and must be wired to SessionManager to fully satisfy this E2E.
References
codeframe/core/session_manager.pycodeframe/cli.py(clear-session)specs/014-session-lifecycle/spec.md- Tests under
tests/agents/test_lead_agent_session.py,tests/cli/test_cli_session.py,tests/api/test_api_session.py,tests/integration/test_session_lifecycle.py
Goal: Agents ask questions; user responds via dashboard; work resumes.
Preconditions
- Running agents capable of creating blockers.
- WebSocket + notifications active.
Steps
- Agent hits ambiguous requirement; creates blocker in DB.
- Dashboard indicates a new blocker:
- Badge or panel shows new blocker.
- User:
- Opens blocker detail.
- Submits answer.
- Backend:
- Marks blocker resolved.
- Emits
blocker_resolvedandagent_resumedevents.
- Agent continues work and task updates in dashboard.
Expected Results
GET /api/projects/{id}/blockersshows blocker before resolution and omits it afterward.POST /api/blockers/{id}/resolvebehaves per spec incodeframe/ui/server.py.- Activity feed logs blocker lifecycle.
References
specs/049-human-in-loop/spec.mdcodeframe/ui/server.pyblocker endpointsweb-uiblocker components and testsdocs/ENFORCEMENT_ARCHITECTURE.md(SYNC/ASYNC semantics)
Goal: Agents can’t mark tasks complete unless tests and quality gates pass.
Preconditions
- Enforcement and review components enabled (see
AI_Development_Enforcement_Guide.md).
Steps
- Agent completes code changes for a task.
- System runs:
- Language‑specific tests via adaptive test runner.
- Linting and static checks.
- If any gate fails:
- Self‑correction loop (up to N attempts).
- Each attempt logged and associated with task.
- Once all gates succeed:
- Task marked
completed. - Review Worker Agent runs; findings recorded.
- Auto‑commit may occur if configured.
- Task marked
Expected Results
- No task transitions to
completedwith failing tests or coverage below threshold (MIN_COVERAGE_PERCENT). scripts/quality-ratchet.pysees non‑decreasing test counts and coverage.- Lint and review results accessible via API and dashboard.
References
AI_Development_Enforcement_Guide.mddocs/ENFORCEMENT_ARCHITECTURE.mdcodeframe/enforcement/*,codeframe/agents/review_worker_agent.py- Tests under
tests/enforcement/,tests/git/,tests/notifications/
Goal: Use CodeFRAME just for discovery, PRD, and planning without running agents.
Preconditions
- Project in
discoveryorplanningphase.
Steps
- Follow E2E‑1 up through discovery completion.
- Verify:
- PRD is generated and available at
/api/projects/{id}/prd. - Issues/tasks exist via
/api/projects/{id}/issues?include=tasks.
- PRD is generated and available at
- Export:
- Download PRD markdown via API.
- Export issue/task tree (via API or future export UI).
- Do not start multi‑agent execution.
Expected Results
- Planning artifacts (PRD, issues, tasks) complete and usable in isolation.
- No agents must run; project can serve purely as a planning artifact.
References
This PRD relies on functional details already captured in:
specs/CODEFRAME_SPEC.md– architecture & data models.docs/API_CONTRACT_ROADMAP.md– key Sprint 2 API contracts (later sections are roadmap).- Feature specs under
specs/*/spec.md. - Sprint completion docs under
sprints/.
Rather than duplicating all endpoint and schema details, this section points to those sources and constrains them via the E2E workflows above.
Key expectations:
- All E2E flows use only documented, stable endpoints and UI components.
- Breaking API changes must be reflected in:
- This PRD.
docs/API_CONTRACT_ROADMAP.md.- Related feature specs and sprints.
-
Performance
- Basic API endpoints (e.g.,
GET /api/projects) p95 latency < 500 ms locally (seeTESTING.md“Performance Verification”). - Context operations within targets in
CLAUDE.md(Context Management section).
- Basic API endpoints (e.g.,
-
Reliability
- All tests must pass from a clean checkout (
uv run pytest) and a cleanweb-uiinstall. - Session file corruption handled gracefully (see
SessionManagertests).
- All tests must pass from a clean checkout (
-
Security
- Command execution guarded per
docs/DEPLOYMENT.md. - No secrets persisted in session or context summaries.
- Command execution guarded per
-
Quality
- Overall coverage ≥ 85%; stricter for enforcement and session modules (see
SPRINTS.mdmetrics and enforcement docs). - TDD process observed as in
.claude/rules.mdand verified byscripts/verify-ai-claims.sh.
- Overall coverage ≥ 85%; stricter for enforcement and session modules (see
The following items are explicitly not yet fully implemented, but required to fully satisfy this PRD:
-
CLI Lifecycle Integration
codeframe start,pause,resume,status,chat,checkpoint,agentscurrently have placeholder implementations.- Decision: either promote them to first‑class orchestrators (wired into agents + session) or clearly document them as legacy/low‑priority.
-
Tasks API
GET /api/projects/{id}/tasksreturns stub data with a TODO.- Decision: align
/taskswith theTaskshape used by the UI or officially treat/issues?include=tasksas the primary tasks surface.
-
Lead Agent Bottleneck Detection and Assignment
LeadAgent.assign_taskanddetect_bottlenecksare TODOs.- Spec for bottleneck detection is in
specs/CODEFRAME_SPEC.md; implementation should either be completed or scaled back in PRD.
-
CLI
start& Session Lifecycle- As noted in E2E‑2,
codeframe startshould be wired toSessionManagerto display real session state.
- As noted in E2E‑2,
-
Documentation Synchronization
- This PRD is the source of truth for user workflows and E2E scenarios.
- Other docs (Sprint plans, legacy agile docs, older architecture write‑ups) should either:
- Be updated to reflect this PRD, or
- Be clearly marked as historical (see “doc cleanup checklist”).