Capstone: Build a Cited Knowledge Base Agent
Build a small knowledge-base feature that answers from a versioned corpus, cites the exact source locator, refuses unsafe requests, and emits a machine-readable run report. The capstone uses a provider-free fixture first, so a browser or CI run can verify the application contract without an API key.
Start with the deterministic fixture and compare the generated good report with the deliberately degraded failing report. The report follows the evals learning-agent contract and links the broader workflow evidence bridge.
Prerequisites
- TypeScript or modern JavaScript, Node.js, and JSON.
- Basic HTTP and frontend state management.
- The RAG project and tool-calling contract.
- A willingness to treat source provenance and access policy as application behavior.
Dependency graph
Learning checks
| Check | Build artifact | Observable pass/fail signal |
|---|---|---|
| Explain | One-page data-flow note | You can name the trust boundary, source locator, and refusal path. |
| Perform | Fixture run and cited answer | npm run run prints an answer with a current source ID. |
| Debug | Stale, conflict, timeout, and injection traces | Each fixture leaves a trace event and a bounded outcome. |
| Transfer | Adapt the policy to a support or documentation feature | A second tenant or corpus keeps the same report contract. |
| Retain | Report plus interview explanation | The report records source snapshot, model revision, prompt hash, and reviewer. |
Build sequence
- Snapshot public or synthetic source text and compute a hash for every locator.
- Implement deterministic file/search retrieval before adding embeddings.
- Filter by tenant and access before ranking or generating an answer.
- Treat retrieved text as data. Ignore instructions inside untrusted sources.
- Prefer the newest trusted source and expose stale or conflicting evidence in the trace.
- Checkpoint after retrieval so an interrupted run can replay without changing the answer.
- Add a provider adapter only after the local fixture passes. Keep model calls optional in development and CI.
- Attach the report to a portfolio brief. Metrics describe this run and cannot stand in for mastery.
Portfolio evidence
The portfolio brief includes an architecture diagram, threat model, trace, failing case, latency and cost note, interview explanation, and host-adapter mapping for ai-jue and Pi.