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 .env.default
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
LLM_BASE_URL=https://api.openai.com
LLM_MODEL=gpt-4o-mini
LLM_API_KEY=
OPEN_AI_BASE_URL=https://api.openai.com
OPEN_AI_MODEL=gpt-4o-mini
OPEN_AI_API_KEY=
EMBEDDER_BASE_URL=https://api.openai.com
EMBEDDER_MODEL=text-embedding-3-small
EMBEDDER_API_KEY=
Expand Down
6 changes: 3 additions & 3 deletions .env.dev
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
LLM_BASE_URL=http://localhost:1234
LLM_MODEL=openai/gpt-oss-20b
EMBEDDER_BASE_URL=http://localhost:1234
OPEN_AI_BASE_URL=http://localhost:1234/v1
OPEN_AI_MODEL=google/gemma-4-26b-a4b
EMBEDDER_BASE_URL=http://localhost:1234/v1
EMBEDDER_MODEL=text-embedding-qwen3-embedding-4b
DATABASE_URL=postgres://<user>:<password>@localhost:5432/chartered_dev
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: CI

on:
push:
branches: [main]
branches: [master]
pull_request:
branches: [main]
branches: [master]

env:
CARGO_TERM_COLOR: always
Expand All @@ -15,8 +15,8 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Install protobuf compiler
run: sudo apt-get install -y protobuf-compiler
- name: Install system dependencies
run: sudo apt-get install -y protobuf-compiler libseccomp-dev

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
Expand Down
12 changes: 10 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ Forbidden: uninstructed truncation guards, fallback behaviors (see Error Discipl

**Domain logic in kernel.** The kernel provides mechanisms; domain config provides policy. Hardcoded pattern-matching rules (regex for prices, substring matching for names) that encode domain concepts as kernel code = domain logic in kernel, regardless of how it's dispatched. The kernel may implement generic mechanisms (LLM judgment, registry dispatch). It MUST NOT implement domain-specific algorithms. Test: "Would this code need to change if we switched from medical CX to e-commerce?" Yes → domain logic, belongs in config or domain layer.

**Transcription fidelity.** User-intent artifacts (goals, briefs, mandates, requirements) MUST contain only what the user stated. Assistant contributions during dialogue — analogies, explanations, meta-commentary, proposed extrapolations — MUST NOT enter the artifact, even when they appear to follow. Diagnostic per clause: "Did the user say this, or did I?" Latter → strike. Compression and re-ordering permitted; addition forbidden. Artifact authority comes from being the user's words, not from assistant synthesis.

### Writing Discipline

**Co-location.** Concept and mechanism belong together — in specs, code, comments, docs. Separating them forces readers to hold cross-references across distant locations; readers reliably fail at this. Diagnostic: "To understand this mechanism, how many other locations must the reader hold?" More than one → co-location violation. Applies universally: spec sections co-locate concept with mechanism; code co-locates type with validation; comments co-locate with the code they govern; CONTEXT.md co-locates design intent with the subtree it governs. When modifying any artifact, if co-location violations exist in the touched scope → propose fixes.
Expand Down Expand Up @@ -259,9 +261,15 @@ Each status report: exact commands, exit codes, failing tests + output (quoted),

Verification answers: what proposition? what source? what measurement? how does verdict follow? Any unanswered → not verification.

Implementations include: static checks (lint, type checks, forbidden imports), unit tests for pure deterministic logic, integration tests with real infrastructure, assembly tests wiring several components.
Implementations include static checks (lint, type checks, forbidden imports) and tests across three tiers — unit, integration, e2e.

**Unit tests.** Literally stateless. No filesystem, no env mutation, no IO, no shared in-process state across test cases. Live under `#[cfg(test)] mod tests` in the source file they exercise. Run in CI.

**Integration tests.** Exercise vertical cuts across trait interface boundaries — several components wired together, observed through their declared contracts. May read or write files, but each test run owns its own isolated directory (one `tempfile::tempdir()` per test; no shared paths, no cleanup races). Live under `<crate>/tests/`. Run in CI.

**E2E tests.** Exercise the actual full agent loop, require an actual LLM, and call over the production API via its proper transport protocol. Local-only — never run in CI. Each e2e test MUST be `#[ignore]`d so default `cargo test` skips it; opt-in via `cargo test -- --ignored`. The soft-skip pattern (`if !precondition { return; }`) is forbidden — it masks failure as passing (see "Tests MUST fail when preconditions absent" below).

Mocks only for external services. Internal components → real or test-grade implementations. Every test path requiring external dependency MUST have complementary test using substitute validating same contract.
Mocks only for external services. Internal components → real or test-grade implementations (`InMemoryReceiptStore`, `FakeCognitionBackend`, …). Every test path requiring an LLM MUST have both a fake-LLM variant (queued responses, in-process) and a real-LLM variant (e2e against the production transport). The fake side covers all logic paths; the real side validates the transport, serde, and adapter canonicalization.

Before any test: what requirement? what violation signal? what bugs caught? what bugs missed?

Expand Down
4 changes: 2 additions & 2 deletions CONTEXT.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ Real-backend impl: `runtime::openai_backend::OpenAiCompatibleBackend`.
Same impl serves real OpenAI (`https://api.openai.com/v1` + API key)
and local OpenAI-compatible servers (LM Studio, llama.cpp, vLLM,
SGLang; key optional). Picked per-role via `steward.toml` `backend =
"openai"` + env (`LLM_BASE_URL`, `LLM_MODEL`, `LLM_API_KEY`);
`LLM_BASE_URL` is the versioned API base.
"openai"` + env (`OPEN_AI_BASE_URL`, `OPEN_AI_MODEL`, `OPEN_AI_API_KEY`);
`OPEN_AI_BASE_URL` is the versioned API base.

Frames are Steward-owned weak entities. Any serialized cross-boundary
reference uses `FrameRef { steward_id, frame_id }`; bare `FrameId`
Expand Down
23 changes: 13 additions & 10 deletions core/CONTEXT.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,23 @@ The components that close the negative-feedback loop:
- **Test-grade Tool implementations**: `harness` module. In-memory
only — `MessageLog`, `InMemoryFs`, `ReviewQueue`. Used by kernel
tests and the Runtime binary's scenario mode.
- **Charter loader**: `charter_loader` (charter_loader.rs). Two-stage
construction — `load_charter_def` / `load_role_context_def` parse
`frames.toml` + `scopes.md` / `role_context.md` into data-only
shapes; `build_charter` / `build_role_context` materialize the
runtime types by attaching Evaluator instances and version numbers.
Markdown sections become slugified scope names. Format documented
- **Charter parsers**: `charter_loader` (charter_loader.rs). Two-stage
construction — `parse_charter_def` / `parse_role_context_def` accept
already-loaded text (no filesystem dependency) and produce data-only
shapes; `build_charter` / `build_role_context` materialize the runtime
types by attaching Evaluator instances and version numbers. Markdown
sections become slugified scope names. Filesystem IO that reads
`frames.toml` / `scopes.md` / `behavioral_spec.md` / `role_context.md`
/ `skills/*.md` lives in `runtime::charter_loader`. Format documented
in `examples/charters/CONTEXT.md`.

## What does NOT live here

- Stdlib effect surfaces (`std::fs`, `std::process`, `tokio::net`).
This crate is in-memory only. OS-touching ToolExecutors live in
`dispatch/`. The file-backed Receipt store and the cognition log
live in `runtime/src/persistence.rs`.
- Stdlib effect surfaces (`std::fs`, `std::process`, `tokio::fs`,
`tokio::process`, `tokio::net`). This crate is in-memory only;
filesystem IO for Charter loading lives in `runtime::charter_loader`;
OS-touching ToolExecutors live in `dispatch/`; the file-backed
Receipt store and the cognition log live in `runtime/src/persistence.rs`.
- Real LLM backends. Step 2 adds OpenAI / Anthropic / vLLM / SGLang
as sibling implementations of `CognitionBackend`.
- E2E scenario tests. Those live in `runtime/tests/` and target the
Expand Down
Loading
Loading