Skip to content

docs: architecture map with a numbered diagram - #1

Merged
Aly700 merged 2 commits into
mainfrom
docs/architecture
Oct 15, 2026
Merged

Aly700 merged 2 commits into
mainfrom
docs/architecture

Conversation

@Aly700

@Aly700 Aly700 commented Oct 15, 2026 •

Copy link
Copy Markdown
Owner

Adds a reference-architecture drawing and a walkthrough for this repository.

  • docs/architecture.svg: boxed regions, component icons and numbered arrows, rendered from a JSON spec and checked by a geometry gate (text fits its box with slack for wider fonts; nothing touches or crosses anything else).
  • docs/architecture.md: the numbered path arrow by arrow, the component table, the trust and data boundaries, what is proven and where the evidence lives, and the identifiers the code relies on. Every claim comes from this repository's own README, ADRs and code, and the page says what is not claimed.
  • README: an Architecture section that shows the drawing and links the page.

Two commits: the map, then the geometry pass.

Aly700 and others added 2 commits October 15, 2026 10:47
Add docs/architecture.md: the components, the trust and data boundaries,
the path one request or run takes through the system as numbered steps
that match the arrows on docs/architecture.svg, and a table of what is
proven and where the evidence lives. The README gains an Architecture
section that shows the diagram and links the page.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Expand the canvas and nested regions, enlarge text areas, align the main
flow, and move external services below AWS. Route edges orthogonally with
separate service ports; place badges, labels, and notes clear of borders
and other objects. Simplify the ECR connection and separate the logs label
from the engine-loop note.

Preserve every label and fact with no cuts or Markdown edits. The supplied
renderer is unchanged. Three sighted render rounds, the geometry gate,
content comparisons, and edge-intersection checks pass.

Co-Authored-By: Codex astra <noreply@openai.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-15T16:49:22.976231Z bb9c48f PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bb9c48f98f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/architecture.md
5. **Worker → Anthropic API.** The `capstan.model` built-in calls the model. The server brackets each call with `ReserveAICall` and `FinishAICall`, prices the usage into `ai_call`, and enforces `CAPSTAN_DAILY_CAP_USD` (default 2.00, counted on the America/Toronto day).
6. **Worker → AgentOps Gate.** The `capstan.gate.decide` built-in posts the proposed action to the gate's `POST /decisions` with `X-API-Key` and an `Idempotency-Key`.
7. **Server → AgentOps Gate (polling).** When the gate answers `REQUIRE_APPROVAL`, the `approvals` loop polls `GET /approvals/{id}` outside any transaction, backing off from 15 s to 5 min, and appends `ApprovalResolved` when a human decides. A waiting run holds no task, no lease and no worker. Humans can also resolve through `ResolveApproval` on the client API.
8. **Server → Amazon CloudWatch.** Logs go to `/capstan/server` (7 days). A Lambda publishes `Capstan/Service RunningTaskCount`; the alarms `capstan-http-5xx-rate` and `capstan-no-running-task` notify the `capstan-alerts` SNS topic. A $10 monthly budget caps the account.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Describe the $10 budget as an alert, not a cap

For an AWS deployment that continues running after reaching $10, this promises a hard spending limit that does not exist. infra/lib/budget.ts configures only email notifications at 50%, 90%, and 100%, with no budget action to stop resources; docs/runbook.md also explicitly calls it “not a hard spending cap.” Calling it a cap may cause operators to rely on protection that will not prevent further charges.

Useful? React with 👍 / 👎.

Comment thread docs/architecture.md
## Boundaries

- **Trust.** Every RPC and `/metrics` needs a Bearer key that the server checks against SHA-256 hashes in `CAPSTAN_API_KEY_HASHES`. `/healthz`, `/readyz` and the viewer's static files are open. The sandbox exists for replay determinism, not as a security boundary: workers run trusted code. Payloads are opaque to the server and visible to any key holder.
- **Secrets.** The worker holds the Capstan key, `ANTHROPIC_API_KEY` and the gate key. The server holds the database URL, the key hashes and the gate key for polling. On AWS these live in four Secrets Manager entries read at task start.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Separate worker credentials from AWS task secrets

In the documented AWS topology, the worker runs outside AWS, so its Capstan, Anthropic, and Gate credentials do not live in Secrets Manager or get read at task startup. infra/lib/service.ts injects only the database URL, API-key hashes, and optional server Gate key into the task; the fourth secret created by infra/lib/data.ts is the database credential used to construct the URL, not a worker credential or task injection. This boundary description should distinguish external worker configuration from the four AWS secret resources.

Useful? React with 👍 / 👎.

@Aly700
Aly700 merged commit 8938bfa into main Oct 15, 2026
7 of 9 checks passed
Aly700 added a commit that referenced this pull request Oct 15, 2026
docs: architecture map with a numbered diagram
@Aly700
Aly700 deleted the docs/architecture branch October 15, 2026 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant