Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .cursor/rules/project-conventions.mdc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ There is no bare `python` or `python3` in `$PATH` that has project dependencies.
- `src/bot.py` — Discord bot with slash commands (discord.py)
- `src/task_store.py` — Shared task types (`Task`, enums, `Comment`)
- `src/dynamo_store.py` — DynamoDB-backed task store (`DynamoTaskStore`)
- `src/projects_dynamo.py` — DynamoDB helpers for project records (get/update project, directives, snapshots, proposals, daily plans)
- `src/projects_dynamo.py` — DynamoDB helpers for project records (get/update project, directives, snapshots, proposals, daily plans, docs)
- `src/autopilot.py` — Daily autopilot plan proposal (`propose_daily_plan`); called via `run_task.py --propose-plan`
- `src/pipeline.py` — Task orchestration: plan, execute, PR, cleanup; `run_directive()` for project directives
- `src/objectives.py` — Daily autonomous cycle: observe metrics → reflect → propose actions; `run_daily_cycle()` for projects with KPIs
Expand Down Expand Up @@ -152,7 +152,7 @@ Projects are long-lived entities (`pk=PROJECT#<id>`, `sk=PROJECT`) with a title,
- `project-list-index` (`proj_status`, `project_updated`) — list projects by status

### Hono project routes (`infra/packages/api/src/routes/projects.ts`)
`GET /api/projects`, `GET /api/projects/:id`, `POST /api/projects`, `PATCH /api/projects/:id`, `DELETE /api/projects/:id`, `POST /api/projects/:id/directive`, `GET /api/projects/:id/snapshots`, `GET /api/projects/:id/proposals`, `PATCH /api/projects/:id/proposals/:propSk`, `GET /api/projects/:id/requests`, `PATCH /api/projects/:id/requests/:reqSk`, `GET /api/projects/:id/plans`, `GET /api/projects/:id/plans/:planId`, `PATCH /api/projects/:id/plans/:planId`, `POST /api/projects/:id/plans/:planId/approve`, `POST /api/projects/:id/plans/:planId/regenerate`, `POST /api/projects/:id/cycle/start`, `POST /api/projects/:id/cycle/stop`, `POST /api/projects/:id/cycle/review`
`GET /api/projects`, `GET /api/projects/:id`, `POST /api/projects`, `PATCH /api/projects/:id`, `DELETE /api/projects/:id`, `POST /api/projects/:id/directive`, `GET /api/projects/:id/docs`, `GET /api/projects/:id/docs/:slug`, `PUT /api/projects/:id/docs/:slug`, `DELETE /api/projects/:id/docs/:slug`, `GET /api/projects/:id/snapshots`, `GET /api/projects/:id/proposals`, `PATCH /api/projects/:id/proposals/:propSk`, `GET /api/projects/:id/requests`, `PATCH /api/projects/:id/requests/:reqSk`, `GET /api/projects/:id/plans`, `GET /api/projects/:id/plans/:planId`, `PATCH /api/projects/:id/plans/:planId`, `POST /api/projects/:id/plans/:planId/approve`, `POST /api/projects/:id/plans/:planId/regenerate`, `POST /api/projects/:id/cycle/start`, `POST /api/projects/:id/cycle/stop`, `POST /api/projects/:id/cycle/review`

### Digest Lambda
`infra/packages/digest/` — scheduled Lambda (cron `0 14 * * ? *`) posts a daily summary of task activity and project progress to Discord via webhook. Includes KPI briefings, reflections, and pending proposals for projects with KPIs.
Expand All @@ -168,7 +168,7 @@ Projects can define KPIs (`kpis` array on the PROJECT record). When KPIs are pre

Proposals go through a human approval queue in the web UI. Approved proposals create tasks that flow through the existing pipeline. Rejected proposals carry feedback the agent sees in the next cycle. Proposal outcomes are tracked — when a task completes, the PROP record is updated so the agent can learn what worked.

DynamoDB record types under `PROJECT#<id>`: `PROJECT`, `DIR#<iso>`, `SNAPSHOT#<date>`, `PROP#<date>#<id>`, `PLAN#<YYYY-MM-DD>`. Task records use `TASK#<id>` as pk with sk prefixes `META`, `OUTPUT#`, `COMMENT#`, `PLAN#`, `LOG#`. See `docs/dynamo-schema.md` for the full single-table schema (all record types, GSIs, attributes, access patterns).
DynamoDB record types under `PROJECT#<id>`: `PROJECT`, `DIR#<iso>`, `SNAPSHOT#<date>`, `PROP#<date>#<id>`, `PLAN#<YYYY-MM-DD>`, `DOC#<slug>`. Task records use `TASK#<id>` as pk with sk prefixes `META`, `OUTPUT#`, `COMMENT#`, `PLAN#`, `LOG#`. See `docs/dynamo-schema.md` for the full single-table schema (all record types, GSIs, attributes, access patterns).

See `docs/autonomous-objectives.md` for the full design vision and `docs/autonomous-objectives-setup.md` for human setup steps.

Expand Down
17 changes: 17 additions & 0 deletions docs/dynamo-schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,23 @@ Durable notes written by the daily-cycle agent via `./ctx memory save` (max 50 p

---

### DOC — `pk=PROJECT#{id} sk=DOC#<slug>`

Human-managed project documents for non-repo knowledge (infra references, credentials inventory, business context). Agents read via `./ctx docs [slug]`. No TTL; no max count.

| Attribute | Type | Description |
|-----------|------|-------------|
| title | string | Human-readable document title |
| content | string | Markdown body (max 50000 chars) |
| created_at | string | ISO 8601 |
| updated_at | string | ISO 8601 |

**Slug format:** lowercase alphanumeric, hyphens, underscores; 1–63 chars (`/^[a-z0-9][a-z0-9_-]{0,62}$/`).

**Access:** `Query pk, sk begins_with "DOC#"` — `ScanIndexForward=true` for alphabetical. `GetItem(pk, DOC#<slug>)` for single doc.

---

### PLAN (Autopilot Plan) — `pk=PROJECT#{id} sk=PLAN#…`

Autopilot plans. Sort key is either legacy `PLAN#YYYY-MM-DD` (one per calendar day) or `PLAN#YYYY-MM-DDTHH:MM:SS` (UTC, multiple per day in continuous mode). `plan_date` is always calendar `YYYY-MM-DD` for grouping.
Expand Down
4 changes: 2 additions & 2 deletions frontend/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ src/
pages/Stats.tsx — Usage & cost (today / all-time tokens, budget bar, 14-day chart via GET /api/stats and /api/budget)
pages/ProjectList.tsx — Project list with status, task progress, last directive, target repo
pages/ProjectCreate.tsx — New project form: title, spec (markdown) with optional “Generate from prompt” (Bedrock via API), priority, target repo, autopilot toggle
pages/ProjectDetail.tsx — Spec editor (Generate while editing), progress bar, **Project manager** chat (GET/POST `/projects/:id/chat`, polls while `reply_pending`), autopilot Off/Daily/Continuous + plan timeline (continuous), cycle start/stop/review, daily plan approve/regenerate, directive timeline, active tasks; polls 3s while busy
pages/ProjectDetail.tsx — Spec editor (Generate while editing), progress bar, **Project manager** chat (GET/POST `/projects/:id/chat`, polls while `reply_pending`), autopilot Off/Daily/Continuous + plan timeline (continuous), cycle start/stop/review, daily plan approve/regenerate, **Docs** tab (CRUD for DOC# records via `/projects/:id/docs`), directive timeline, active tasks; polls 3s while busy
pages/Login.tsx — Sign-in page
lib/api.ts — Fetch client; project CRUD; `fetchProjectChat` / `postProjectChat`; plan APIs (fetchPlans, fetchPlanDetail, approvePlan, regeneratePlan, patchPlanItems); continuous autopilot cycle (startAutopilotCycle, stopAutopilotCycle, reviewAutopilotCycle)
lib/api.ts — Fetch client; project CRUD; `fetchProjectChat` / `postProjectChat`; plan APIs (fetchPlans, fetchPlanDetail, approvePlan, regeneratePlan, patchPlanItems); continuous autopilot cycle (startAutopilotCycle, stopAutopilotCycle, reviewAutopilotCycle); project docs (fetchProjectDocs, putProjectDoc, deleteProjectDoc)
lib/types.ts — TypeScript interfaces matching the /api/* responses; Task includes role: string, project_id, directive_sk; Project (with autopilot boolean), Directive, DailyPlan, PlanItem, ProjectListItem types
lib/time.ts — timeAgo utility
index.css — Tailwind imports, dark theme CSS vars, .prose-custom styles (colors use CSS var tokens, not hardcoded oklch literals)
Expand Down
33 changes: 33 additions & 0 deletions frontend/src/lib/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import type {
DailyPlan,
PlanItem,
ProjectChatMessage,
ProjectDoc,
} from "./types"

const BASE = (import.meta.env.VITE_API_BASE_URL ?? "") + "/api"
Expand Down Expand Up @@ -436,3 +437,35 @@ export async function reviewAutopilotCycle(
body: JSON.stringify(opts),
})
}

// ---------------------------------------------------------------------------
// Project Docs
// ---------------------------------------------------------------------------

export async function fetchProjectDocs(projectId: string) {
return request<{ docs: ProjectDoc[] }>(`/projects/${projectId}/docs`)
}

export async function fetchProjectDoc(projectId: string, slug: string) {
return request<{ doc: ProjectDoc }>(
`/projects/${projectId}/docs/${encodeURIComponent(slug)}`,
)
}

export async function putProjectDoc(
projectId: string,
slug: string,
data: { title: string; content: string },
) {
return request<{ doc: ProjectDoc }>(
`/projects/${projectId}/docs/${encodeURIComponent(slug)}`,
{ method: "PUT", body: JSON.stringify(data) },
)
}

export async function deleteProjectDoc(projectId: string, slug: string) {
return request<{ ok: boolean }>(
`/projects/${projectId}/docs/${encodeURIComponent(slug)}`,
{ method: "DELETE" },
)
}
8 changes: 8 additions & 0 deletions frontend/src/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,14 @@ export interface Comment {
created_at: string
}

export interface ProjectDoc {
slug: string
title: string
content: string
created_at: string
updated_at: string
}

export interface Counts {
all: number
pending: number
Expand Down
Loading
Loading