Skip to content

overview architecture

bondiano edited this page Nov 12, 2026 · 1 revision

Architecture

Sych separates pure review decisions from external tools and durable state. Five Rust workspace crates form the backend; a Vue dashboard consumes its API and an Astro site publishes the guides. The boundaries are declared in Cargo.toml, web/package.json and site/package.json.

Component map

graph TD
    CLI["sych CLI"] --> App["sych-app orchestration"]
    Hooks["GitHub webhooks"] --> Server["Axum API and workers"]
    UI["Vue dashboard"] --> Server
    Server --> App
    App --> Core["sych-core: contracts, plan, reduce"]
    App --> Adapters["sych-adapters: Git, facts, models, SCM"]
    App --> Storage["sych-storage: durable state"]
    Adapters --> Git["Pinned Git objects"]
    Adapters --> Tools["Pinned tools and bounded model providers"]
    Storage --> DB["SQLite or PostgreSQL"]
    Storage --> Artifacts["Content-addressed artifacts"]
Loading

crates/sych-app/bin/sych.rs is the command entry point. crates/sych-app/src/server/mod.rs assembles HTTP roles. crates/sych-core/src/lib.rs exports contracts and pure logic without HTTP, SQL or model SDK dependencies. Adapters and storage implement the external operations.

Review flow

graph LR
    Snapshot["Pin target, base, head"] --> Policy["Trusted target-tip policy"]
    Policy --> Facts["Semantic, syntax, lint, CI and effects"]
    Facts --> Plan["Plan obligations"]
    Plan --> Context["Bounded evidence packets"]
    Context --> Models["Assess, discover, audit, verify"]
    Models --> Reduce["Deterministic reduction"]
    Reduce --> Save["Immutable result and artifacts"]
    Save --> Publish["Durable publication outbox"]
Loading

The review orchestration lives in crates/sych-app/src/review/mod.rs; the planner and reducer are crates/sych-core/src/plan.rs and crates/sych-core/src/reduce.rs. Context packets in crates/sych-core/src/broker/mod.rs retain selected code coordinates, query completeness, exclusions and gaps instead of presenting an unexplained context string.

Identities and trust

SourceSnapshot in crates/sych-core/src/snapshot.rs pins three separate positions: the target tip that supplies policy, the diff base used for comparison, and the reviewed head. CodeRef binds a location to that snapshot, source side, blob, line range and content hash.

Repository policy changes in the reviewed head are shown as proposed changes, not applied to their own review. The implementation is trusted_config in crates/sych-app/src/review/mod.rs. The security page follows this boundary through tool execution, credentials and model input.

State is not one verdict

crates/sych-core/src/status.rs separates execution state and outcome from coverage, recommendation, publication and relevance. A completed run may still have partial coverage. A confirmed publication only means delivery was confirmed; it does not prove the code is correct.

crates/sych-storage/src/lib.rs stores mutable lifecycle state and artifact pointers. crates/sych-storage/src/artifacts.rs stores immutable bytes by content hash. Database migrations are explicit, not a side effect of opening the store.

Languages and package boundaries

Rust implements the reviewer, transports and persistence. TypeScript and Vue implement the dashboard, while JavaScript and Astro implement the documentation site. SQL migrations exist for both backends. At the documented revision, owned source, separate tests and configuration total 98,036 physical lines: Rust 88,602, Vue 3,743, TypeScript 2,129 and SQL 1,012, with the rest in configuration and support languages. These include comments and blank lines, and exclude generated/vendor content. The full breakdown and counting rules are in By the numbers.

See Crates for dependency boundaries, Apps for runtime entry points and Review for the analysis stages.

Clone this wiki locally