Skip to content

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 ​

CheckBuild artifactObservable pass/fail signal
ExplainOne-page data-flow noteYou can name the trust boundary, source locator, and refusal path.
PerformFixture run and cited answernpm run run prints an answer with a current source ID.
DebugStale, conflict, timeout, and injection tracesEach fixture leaves a trace event and a bounded outcome.
TransferAdapt the policy to a support or documentation featureA second tenant or corpus keeps the same report contract.
RetainReport plus interview explanationThe report records source snapshot, model revision, prompt hash, and reviewer.

Build sequence ​

  1. Snapshot public or synthetic source text and compute a hash for every locator.
  2. Implement deterministic file/search retrieval before adding embeddings.
  3. Filter by tenant and access before ranking or generating an answer.
  4. Treat retrieved text as data. Ignore instructions inside untrusted sources.
  5. Prefer the newest trusted source and expose stale or conflicting evidence in the trace.
  6. Checkpoint after retrieval so an interrupted run can replay without changing the answer.
  7. Add a provider adapter only after the local fixture passes. Keep model calls optional in development and CI.
  8. 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.

Built for frontend engineers · Powered by VitePress