Expand description
System IR core types.
These types mirror docs/system-ir.schema.json exactly so that a SystemIr
document serializes to the documented export format without translation.
Re-exports§
pub use handles::fnv1a64_hex;pub use handles::ContentHandle;pub use handles::HandleError;pub use handles::HandleKind;pub use languages::extracted_language_ids;pub use languages::language_by_id;pub use languages::language_registry;pub use languages::support_matrix_markdown;pub use languages::LanguageCapability;pub use languages::LanguageTier;pub use languages::LANGUAGE_REGISTRY;pub use lex::bm25_rank;pub use lex::bm25_scores;pub use lex::bm25_scores_with_stats;pub use lex::classify_query;pub use lex::extract_query_mentions;pub use lex::is_exact_anchor;pub use lex::mention_matches_doc;pub use lex::path_matches_locus;pub use lex::ranking_arm_ids;pub use lex::relevance_hits;pub use lex::relevance_hits_with_stats;pub use lex::route_query;pub use lex::subtokens;pub use lex::Bm25CorpusStats;pub use lex::LexDoc;pub use lex::LexField;pub use lex::QueryLocus;pub use lex::QueryMention;pub use lex::QueryShape;pub use lex::RankingArm;pub use lex::RelevanceHit;pub use lex::RetrievalPlan;pub use lex::BM25_B;pub use lex::BM25_K1;pub use lex::QUERY_MENTION_MAX_RAW;pub use lex::WEIGHT_BODY;pub use lex::WEIGHT_DOC;pub use lex::WEIGHT_NAME;pub use lex::WEIGHT_PATH;pub use resolution::choose_representation;pub use resolution::AnalysisQuality;pub use resolution::CallQuality;pub use resolution::FileQuality;pub use resolution::RecvKind;pub use resolution::RepresentationChoice;pub use resolution::RepresentationKind;pub use resolution::ResolutionClass;pub use retrieval::mean_reciprocal_rank;pub use retrieval::recall_at_k;
Modules§
- handles
- Stable content handles for lazy exact-source retrieval.
- identity
- Stable repository identity (mission §XIV).
- kinds
- languages
- Authoritative language-support registry.
- lex
- Relevance-first lexical machinery: subtoken tokenizer, BM25, query shape.
- predicates
- resolution
- Receiver classification, resolution honesty, and representation choice.
- retrieval
- Retrieval metrics for ranking-arm ablations.
Structs§
- Atlas
Component - One architectural component in the atlas. Purpose is the highest-ranked responsibility claim; consumes/produces come from data-flow edges; upstream/downstream from dependency edges; retry/failure from extracted failure behavior.
- Atlas
Entrypoint - Atlas
Flow - A condensed flow: steps collapsed to “Actor: operation” lines, with branch/async/failure markers preserved.
- Atlas
Hierarchy Node - One hierarchical container (service or subsystem) with its direct member
entity ids (component ids, or subsystem ids nested inside a service).
Deterministic:
memberssorted by entity id. - Atlas
Invariant - Atlas
Ownership Claim - A typed ownership claim (provenance preserved — DECLARED intent never promoted).
- Context
Artifact - The deterministic startup artifact (Atlas + Surface), hash-stable per epoch so prompt caches hit.
- Context
Budget - The startup/task context budget split (Wave 14 dynamic budgets).
- Context
Item - A token-optimized context candidate (Aider-style hard budget search).
- Context
Ledger - What the agent has already seen — novelty suppression source (the general form of Aider treating chat files specially).
- Contract
- One first-class contract in the atlas (Wave 9): a typed, evidence-backed
contract surface (http/cli/event/config/annotation) with its producer
symbol and the symbols that consume it.
operationscarries the concrete contract strings (routeGET /api/x, flag--paging, eventuser.created, config keyDEBUG, annotationrouter.get). - Entity
- Evidence
- Flow
- Flow
Edge - Flow
Graph - The canonical causal representation of one flow: a graph, never a flattened linear step list. Alternate execution paths are preserved as branch edges; false sequential causality is impossible by construction.
- Flow
Node - One operation node in the canonical flow graph. The canonical graph retains individual operations — component-level grouping (ComponentSpan) happens only at display/context time.
- Flow
Step - Importance
Profile - A definition deliberately omitted by a token-budget cut — the artifact
never silently implies completeness.
Derived importance explanation for one surface symbol (audit item 3):
topology (exact fan-in/fan-out, never truncated), architecture signals,
and change impact — computed from data the pipeline ALREADY has. Badges
are derived labels over those numbers, not extra scoring magic: the
overall score stays
rank.total. - Invariant
- Invocation
Surface - One invocation surface: a symbol reachable from outside the process.
- Occurrence
- One concrete occurrence of a concept (schema/reactive) in a source file.
- Rank
Node - One node in the heterogeneous ranking universe (Wave 14B): any rankable entity — symbol, component, subsystem, service, flow, contract, state, reactive, route, topic, queue, store, schema, or file. The ranker walks edges whose endpoints are rankable entities, so architectural importance (flows, contracts, state) participates in PageRank directly.
- Reference
Edge - A normalized reference between two symbols (Wave 14): the graph the ranker walks. Many SCC relationships already express these concepts; this layer normalizes them for ranking.
- Relationship
- Repository
- Semantic
Parameter - One function/method parameter in structured form.
- Semantic
Signature - The structured machine form of a signature — the semantic layer over the exact source text. Benchmark matching uses this, never string comparisons of source signatures alone.
- Snapshot
- Source
Range - A source range: file path + 1-based inclusive line span.
- Structural
Source Unit - One structural-source unit: semantic skeleton of an implementation slice (Level 2), with provenance back to the exact source.
- Surface
Entry - One ranked definition on the system surface — a callable/typeable reality of the architecture, with exact signatures and architectural meaning attached.
- Surface
Omission - Surface
Rank - Why a surface entry earned its rank (explainability;
scc surface --explainrenders this). - Surface
Render Result - The production surface render: the budget-selected subset plus honest
omission accounting (Wave 14F).
rendered_idsare exactly the entries the agent sees (ledger recording MUST use only these — omitted candidates are never marked visible);omitted_idsare every candidate the pipeline cut.omissionssummarizes the cuts by kind. - System
Atlas - The full System Atlas: structured architecture before rendering. This is the machine model handed to agents at session start (docs/SYSTEM_DESIGN.md §8, Wave 2).
- System
Ir - System
Surface Map - The System Surface Map: the ranked actual-API layer of a repository, built from System IR (Level 1 of the context stack).
- Task
Seed - One task-seed resolution: task language -> SCC entities.
Enums§
- Archetype
- Repository archetype, detected deterministically from graph evidence
(routes, exports, cli/framework signals, deployment/workspace shape) by
scc_graph::archetype::detect_archetype.Unknownis the honest fallback when no signal fires. - Contract
Subclass - First-class contract subclass (Contract ontology): the semantic contract
family, derived by the extractors from general evidence (public fn
signatures, builder/factory structure, event producer/consumer pairs,
serializer/deserializer pairs, interface+implementations, route/flag/
topic/config facts) and rendered by the atlas as per-subclass groups.
The legacy
kindstring stays for back-compat;subclassis the typed family (http/cli/event/config/public-api/extension/serialization/…). - Evidence
Type - Evidence source type.
- Flow
Edge Kind - Edge kind in the canonical causal graph (P1, docs/SYSTEM_DESIGN.md §9).
- Flow
Kind - Flow view kinds (System Atlas), per docs/SYSTEM_IR_SCHEMA.md §7.
- Invocation
Surface Kind - How a symbol can be invoked from outside the process (Wave 9): the invocation surfaces the flow compiler seeds entrypoints from.
- Provenance
- Evidence class of a fact, per docs/SYSTEM_IR_SCHEMA.md §5.
- Reference
Kind - Severity
- Surface
Kind - The kind of code surface a definition exposes.
- Visibility
- Symbol visibility as declared in source.
Constants§
Functions§
- decode_
component - Inverse of
encode_component: percent-decodes%XXsequences back to bytes. Used by benchmark/impact tooling to map entity ids back to names. - encode_
component - Percent-encode a path/name component for use inside an entity id while
preserving case and common separators (
/,.,_,-). Collision-free wheresanitize_keywould risk merging distinct names. - entity_
id repo://{repo}/{kind}/{key}stable identifier.- estimate_
tokens - Rough token estimate: 4 characters per token (byte-based for ASCII, but we operate on char count which is a close approximation across scripts).
- evidence_
id - Evidence id namespace:
evidence:{n}— stable within a snapshot, assigned by the store. - flow_
kind_ str - now_
rfc3339 - occurrence_
id - Occurrence entity id: collision-free per (concept key, path, owner,
line) — the identity occurrences carry so shared concepts never lose
per-file provenance. Unlike
entity_id, the concept/path/owner components are percent-encoded (@-separated), so case and separator distinctions (a_bvsa-b) never merge distinct occurrences. - ontology_
registries - Authoritative kind and predicate ids. Rankers, exporters, and tests must derive from these slices rather than a second hand-maintained list.
- relationship_
id - Relationship id:
rel:{n}— stable within a snapshot, assigned by store. - sanitize_
key - Sanitize a free-form name into a stable URI key.
- symbol_
id - Stable symbol id:
repo://{repo}/symbol/{encoded-file}/{encoded-name}. - truncate_
to_ budget - Hard-truncate
textto at mostbudgettokens, preferring a clean cut at a line boundary.