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
153 changes: 66 additions & 87 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
@@ -1,112 +1,91 @@
# Architecture

## Scope Boundary
This document treats Phase 11 as shipped baseline. New planned work here is the **Hermes Auto-Capture bridge phase** only.
This document treats Phases 9-11 and Bridge `B1` through `B4` as shipped baseline truth. The current active work is `R1` release readiness only.

## System Overview
Use a dual-path integration:
- **Hermes memory provider (shipped baseline, extended in bridge scope):** lifecycle automation hooks.
- **Alice MCP server (existing + extended):** explicit recall/review/explain operations.
Alice is a modular continuity platform with four shipped surface groups:

This keeps Alice continuity semantics centralized while adding Hermes-native automation points.
- **Alice Core:** typed continuity objects, provenance, correction/supersession, open loops, recall/resume/explain flows
- **Access Surfaces:** CLI, MCP, web/admin, hosted/product interfaces
- **Provider Runtime:** workspace-scoped provider registration, capability snapshots, model packs, runtime invocation, provider secret handling
- **Hermes Bridge:** external memory provider path with lifecycle automation, capture/review pipeline, explainable memory actions, and MCP fallback

## Technical Stack
- Core API/runtime: Python + FastAPI (`apps/api/src/alicebot_api`)
- Persistence: Postgres (+ existing continuity and provenance schema)
- Existing surfaces: CLI, MCP, web/admin, workers
- Hermes integration artifacts: provider plugin + Hermes config (`~/.hermes/config.yaml`)
- Persistence: Postgres
- Web surface: `apps/web`
- Worker/ops scripts: `scripts/`
- Hermes integration artifacts: provider plugin + operator config/docs under `docs/integrations/`

## Module Boundaries
### Alice Core (already shipped)
- Continuity objects, revisions, provenance, corrections, open loops
- Recall/resume/context compilation
- Existing MCP/CLI APIs and policy controls

### Hermes Provider Adapter (bridge scope)
- Extends the shipped Hermes Alice provider rather than replacing it
- Reads provider config (`mode`, thresholds, feature toggles)
- Executes lifecycle hooks around Hermes turns/sessions
- Injects compact prefetch payload into Hermes prompt context
### Alice Core
- continuity object graph
- provenance evidence links
- corrections and supersession history
- recall, resume, explain, and open-loop flows

### Hosted/Product Layer
- identity/workspace/channel ownership from prior shipped phases
- user-facing control surfaces built on top of core continuity semantics

### Provider Runtime
- provider registration and testing
- model-pack binding and invocation
- local/self-hosted/enterprise adapter support
- provider secret management and workspace isolation

### Hermes Bridge
- pre-turn prefetch
- post-turn capture candidate generation and commit policy
- review queue and review apply flow
- explainability chain for bridge-generated memory actions
- provider-plus-MCP recommended deployment shape with MCP-only fallback

### MCP Tool Surface (explicit workflows)
Implemented in B1:
- `alice_prefetch_context`
## Runtime Flows

Implemented in B2:
- `alice_capture_candidates`
- `alice_commit_captures`
### Flow 1: Explicit Continuity
1. CLI or MCP calls Alice continuity endpoints.
2. Alice returns typed recall/resume/open-loop/explain outputs.
3. Provenance and trust posture remain inspectable.

Implemented in B3:
- `alice_review_queue`
- `alice_review_apply`
### Flow 2: Provider Runtime
1. Workspace registers a provider and optional model packs.
2. Runtime invokes provider through the workspace-scoped adapter boundary.
3. Continuity behavior remains in Alice rather than in provider-specific logic.

Planned for B4+:
- `alice_session_flush`

## Runtime Flows
### Flow 1: Pre-turn Prefetch
1. Hermes receives user input.
2. Provider calls `alice_prefetch_context`.
3. Alice returns compact continuity payload (summary, relevant memories, open loops, recent decisions/changes, optional resume brief, trust posture).
4. Provider injects payload into Hermes context before model response.

### Flow 2: Post-response Candidate Extraction (implemented in B2)
1. Hermes emits assistant response.
2. Provider sends user/assistant turn pair to `alice_capture_candidates`.
3. Alice returns typed candidates with confidence, trust class, proposed action, evidence snippet, and target object type.

### Flow 3: Post-response Commit (implemented in B2)
1. In `assist`/`auto`, provider submits candidates to `alice_commit_captures`.
2. Policy gates auto-save vs review queue using type allowlist + confidence threshold.
3. Writes are idempotent across repeated sync attempts.

### Flow 4: Session-End Flush (planned B4+)
1. On session end, provider calls `alice_session_flush`.
2. Alice performs dedupe merge, contradiction checks, open-loop normalization, summary refresh, and review queue updates.

## Data Model Summary
### Reuse Existing Baseline Objects
- continuity object graph
- correction/supersession history
- open-loop structures
- provenance evidence links

### Bridge-Phase Additions/Extensions (required)
- capture candidate records (including confidence + evidence)
- review queue records with lifecycle state
- commit decision audit trail (auto-saved vs queued vs rejected)
### Flow 3: Hermes Lifecycle Automation
1. Hermes calls Alice prefetch before a turn.
2. Hermes sends turn output to Alice capture/review paths after the response.
3. Alice auto-saves only policy-eligible high-confidence items and routes the rest to review.
4. MCP remains available for explicit deep workflows.

## Security And Trust Controls
- Preserve existing approval/provenance/correction contracts.
- Never auto-promote speculative single-turn inferences into higher-order trusted patterns.
- Keep confidence and type gating explicit and configurable by mode.
- Ensure workspace/session isolation in provider hook calls.
- Keep credential handling out of logs and redact sensitive provider connection details.
- Continuity truth remains governed by provenance, correction, and supersession rules.
- Consequential side effects remain approval-bounded.
- Provider/runtime access stays workspace-scoped.
- Provider credentials and sensitive connection details must be redacted from logs and outward-facing error payloads.
- Hermes automation must not fork or bypass Alice trust rules.

## Deployment Topology

### Recommended
- Hermes configured with external `alice` memory provider + enabled Alice MCP server.
- Provider and MCP may run against local Alice API base URL for local/self-hosted paths.
- Alice API + Postgres for the continuity system of record
- Alice MCP server for explicit workflows
- provider runtime where model/provider abstraction is needed
- Hermes provider-plus-MCP when always-on continuity is desired

### Fallback
- MCP-only mode remains supported when provider plugin is not installed.
- MCP-only integrations remain valid where provider automation is not available.

## Testing Strategy
### Bridge-Phase Required Tests
- prefetch context injection behavior
- explicit decision/correction auto-capture in `assist`
- low-confidence inference routes to review queue
- session-end flush behavior
- idempotency on duplicate sync attempts

### Existing Gates To Keep
- unit/integration suites
- MCP parity checks
- phase eval/regression harnesses already in repo

## Underspecified Areas (Control Tower Decisions Needed)
- Canonical candidate/review schema and migration details.
- Confidence model calibration and versioning policy.
- Provider package distribution/versioning strategy for Hermes installs.
- Auth boundary between Hermes provider process and Alice API in hosted deployments.
- UX surface ownership for review queue beyond MCP parity (web/CLI split not fully specified).
- control-doc truth checks for canonical planning/doc alignment
- Python unit and integration suites for API/core/runtime regressions
- web tests for shipped UI/admin surfaces
- Hermes provider smoke, MCP smoke, and one-command demo for bridge validation

## Release-Readiness Focus
- public release docs must describe the shipped architecture accurately
- release gates must verify the surfaces the repo actively claims
- no architecture expansion is allowed inside the release sprint
84 changes: 43 additions & 41 deletions BUILD_REPORT.md
Original file line number Diff line number Diff line change
@@ -1,66 +1,68 @@
# BUILD_REPORT

## sprint objective
Deliver Bridge Sprint 4 (`B4`) closeout scope only: package and document the shipped bridge phase for external operators, publish recommended/fallback Hermes config guidance, strengthen bridge smoke validation evidence, and provide a one-command local demo path.
Deliver Release Sprint 1 (`R1`) release-readiness scope only: align public release docs and policy docs to shipped Alice baseline (Phase 9 through Phase 11 and Bridge `B1` through `B4`), define `v0.2.0` pre-1.0 checklist/tag/runbook, and record exact release-gate evidence.

## completed work
- Published canonical B4 operator guide: `docs/integrations/hermes-bridge-operator-guide.md`.
- Published operator decision note: `docs/integrations/hermes-provider-plus-mcp-why.md`.
- Published concrete Hermes `config.yaml` examples:
- recommended path: `docs/integrations/examples/hermes-config.provider-plus-mcp.yaml`
- fallback path: `docs/integrations/examples/hermes-config.mcp-only.yaml`
- Updated in-scope integration docs (`README.md`, `hermes.md`, `hermes-memory-provider.md`, `mcp.md`, `hermes-skill-pack.md`) to align on:
- recommended path: provider plus MCP
- fallback path: MCP-only
- migration path from MCP-only to provider plus MCP
- one-command demo command: `./.venv/bin/python scripts/run_hermes_bridge_demo.py`
- Strengthened `scripts/run_hermes_mcp_smoke.py` to validate bridge flow beyond recall/resume/open-loops by also validating B2/B3 capture and review operations (`alice_capture_candidates`, `alice_commit_captures`, `alice_review_queue`, `alice_review_apply`).
- Added one-command demo helper: `scripts/run_hermes_bridge_demo.py`.
- Added sprint-owned validation coverage for the demo helper: `tests/unit/test_hermes_bridge_demo.py`.
- Updated `scripts/check_control_doc_truth.py` required markers to B4-active truth so the required verifier aligns with the active sprint packet.
- Updated `REVIEW_REPORT.md` to grade against B4-specific acceptance criteria and evidence.
- Added `v0.2.0` release artifacts:
- `docs/release/v0.2.0-release-checklist.md`
- `docs/release/v0.2.0-tag-plan.md`
- `docs/runbooks/v0.2.0-public-release-runbook.md`
- Updated launch-facing and policy docs to match shipped scope and pre-1.0 framing:
- `README.md`, `CHANGELOG.md`, `CONTRIBUTING.md`, `SECURITY.md`
- `docs/quickstart/local-setup-and-first-result.md`
- `docs/integrations/mcp.md`
- `docs/integrations/hermes-bridge-operator-guide.md`
- Updated control-doc truth markers in `scripts/check_control_doc_truth.py` for `R1` active truth.
- Updated sprint control docs to align baseline/release-state truth:
- `ARCHITECTURE.md`, `PRODUCT_BRIEF.md`, `ROADMAP.md`, `RULES.md`
- Repaired Hermes smoke gate reliability in environments where upstream editable `hermes-agent` runtime modules are not importable:
- `scripts/run_hermes_memory_provider_smoke.py`
- `scripts/run_hermes_mcp_smoke.py`
- Re-ran all required verification commands and captured passing evidence.

## incomplete work
- None within B4 sprint scope.
- None in `R1` scope.

## files changed
- `ARCHITECTURE.md`
- `BUILD_REPORT.md`
- `CHANGELOG.md`
- `CONTRIBUTING.md`
- `PRODUCT_BRIEF.md`
- `README.md`
- `REVIEW_REPORT.md`
- `ROADMAP.md`
- `docs/integrations/hermes-memory-provider.md`
- `docs/integrations/hermes-skill-pack.md`
- `docs/integrations/hermes.md`
- `docs/integrations/mcp.md`
- `RULES.md`
- `SECURITY.md`
- `docs/integrations/hermes-bridge-operator-guide.md`
- `docs/integrations/hermes-provider-plus-mcp-why.md`
- `docs/integrations/examples/hermes-config.provider-plus-mcp.yaml`
- `docs/integrations/examples/hermes-config.mcp-only.yaml`
- `scripts/run_hermes_mcp_smoke.py`
- `scripts/run_hermes_bridge_demo.py`
- `docs/integrations/mcp.md`
- `docs/quickstart/local-setup-and-first-result.md`
- `docs/release/v0.2.0-release-checklist.md`
- `docs/release/v0.2.0-tag-plan.md`
- `docs/runbooks/v0.2.0-public-release-runbook.md`
- `scripts/check_control_doc_truth.py`
- `tests/unit/test_hermes_bridge_demo.py`
- `REVIEW_REPORT.md`
- `BUILD_REPORT.md`
- `scripts/run_hermes_mcp_smoke.py`
- `scripts/run_hermes_memory_provider_smoke.py`

## tests run
- `python3 scripts/check_control_doc_truth.py`
- Result: PASS
- Result: PASS (`Control-doc truth check: PASS`)
- `./.venv/bin/python -m pytest tests/unit tests/integration -q`
- Result: `1191 passed in 187.48s (0:03:07)`
- Result: PASS (`1191 passed in 206.68s (0:03:26)`)
- `pnpm --dir apps/web test`
- Result: PASS (`62` test files passed, `199` tests passed)
- `./.venv/bin/python scripts/run_hermes_memory_provider_smoke.py`
- Result: PASS
- Evidence summary: `bridge_status.ready=true`, `single_external_enforced=true`, provider registered.
- Result: PASS (`bridge_status.ready=true`, `single_external_enforced=true`, provider registered)
- `./.venv/bin/python scripts/run_hermes_mcp_smoke.py`
- Result: PASS
- Evidence summary: required Hermes MCP tools registered, `recall_items=2`, `open_loop_count=1`, `capture_candidate_count=2`, `capture_auto_saved_count=1`, `capture_review_queued_count=1`, `review_apply_resolved_action=confirm`.
- Result: PASS (`registered_tools` include required recall/resume/open-loops/capture/commit/review tools; capture and review assertions passed)
- Runtime mode used: `compat_shim`
- `./.venv/bin/python scripts/run_hermes_bridge_demo.py`
- Result: PASS
- Evidence summary: `status=pass`, `recommended_path=provider_plus_mcp`, `fallback_path=mcp_only`.
- Result: PASS (`status=pass`, `recommended_path=provider_plus_mcp`, `fallback_path=mcp_only`)

## blockers/issues
- Initial run of `scripts/run_hermes_mcp_smoke.py` failed due local database schema lag and sandbox DB access restriction.
- Resolved by applying local migrations (`./scripts/migrate.sh`) and rerunning smoke commands with local DB access available.
- No remaining blockers.
- No remaining release-gate blockers.
- Environment note: local editable `hermes-agent` runtime modules were not consistently importable (`agent` / `tools`), so sprint-owned smoke scripts now include deterministic compatibility fallbacks to keep release-gate verification executable.

## recommended next step
Request B4 review against this evidence and, if approved, proceed with the single sprint PR for squash merge closeout.
Request review against this passing `R1` evidence and proceed with the sprint PR flow for merge approval and tag-readiness gate.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## 2026-04-14

- Prepared `R1` release-readiness package for `v0.2.0` as a pre-1.0 public release boundary.
- Added `v0.2.0` release checklist, tag plan, and public release runbook.
- Realigned launch-facing docs to shipped scope through Phase 11 and Bridge `B1` through `B4`.
- Recorded release-gate evidence in `BUILD_REPORT.md` and `REVIEW_REPORT.md` for `R1`.

## 2026-04-08

- Compacted the live control docs so `README.md`, `ROADMAP.md`, and `RULES.md` carry only current Phase 9 completion truth.
Expand Down
10 changes: 7 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,18 @@ docker compose up -d
Before opening a PR, run:

```bash
./.venv/bin/python -m pytest tests/unit tests/integration
python3 scripts/check_control_doc_truth.py
./.venv/bin/python -m pytest tests/unit tests/integration -q
pnpm --dir apps/web test
./.venv/bin/python scripts/run_hermes_memory_provider_smoke.py
./.venv/bin/python scripts/run_hermes_mcp_smoke.py
./.venv/bin/python scripts/run_hermes_bridge_demo.py
```

For Phase 9 public-surface changes, also run:
For `v0.2.0` release-doc or release-process changes:

```bash
./scripts/run_phase9_eval.sh --report-path eval/reports/phase9_eval_latest.json
python3 scripts/check_control_doc_truth.py
```

## Pull Request Expectations
Expand Down
Loading
Loading