Skip to main content

Crate agentstatedeveloper

Crate agentstatedeveloper 

Source
Expand description

AgentStateDeveloper: code-level context and an audit overlay for agent-authored code.

This is the library entry point. It re-exports everything from agentstatedeveloper-core (the engine, schema, stores and index pipeline) and default_adapters, which returns every built-in language adapter.

let adapters = agentstatedeveloper::default_adapters();
assert!(!adapters.is_empty());

The asd command-line tool is in agentstatedeveloper-cli, and the MCP server is in agentstatedeveloper-mcp.

Modules§

adapter
audit
Audit-log event stream — OSS data format.
brief
Plan D t-001 + t-007: shared brief-output projections.
calibration
Plan J t-015: confidence-bucket calibration helpers.
candidates
Shared candidate-selection logic used by CLI commands and the MCP server.
community
Community detection over the call graph (Plan competitive-harvest t-009).
conclusions_export
Plan B t-004: shared conclusion-export pipeline used by both the CLI (asd conclusions export) and MCP (conclusions_export tool).
context
Per-symbol context assembly for asd context-for (CLI) and the mcp__asd__context_for MCP tool.
cross_service
Cross-service / cross-process edges (Plan competitive-harvest t-002).
dataflow
Intra-process data-flow edges (Plan competitive-harvest t-002, slice 4).
doc_adapters
Document adapters: produce SearchDoc chunks from non-code files.
edge_confidence
Confidence for call-graph edges (Plan competitive-harvest t-013).
effects
engine
error
feedback
Feedback store — durable (query, symbol, verdict) triples.
gc
ASD’s garbage-collection retention policy, shared by asd gc and asd-serve’s sweep preview so the two can never disagree about what a sweep keeps.
help
On-demand instruction disclosure (help) — the asd half of the cross-binary help system shared with ctx (CTXone).
index
index_pipeline
Shared indexing pipeline used by both the CLI asd index command and the MCP reindex tool.
ledger
ledger_integrity
Ledger integrity across the three places an entry lives.
map
asd map core — initial-read project summary.
overview
Read-only “orient me” reports shared by the CLI and the asd-mcp server.
paths
ASG path convention for ASD data.
policy
Policy gate.
prepare_change
Plan E t-006: shared helpers for the prepare-change pipeline.
rebind
Moving a symbol’s ledger history onto another symbol.
recipes
Plan C t-004: change-intent recipes.
registry
Shared ASD repo registry — ~/.config/asd/repos.toml.
repair
ASG state repair — scan for corruption and apply safe auto-corrections.
schema
scorecard
The five-dimension benchmark scorecard — truth, feedback, change, uncertainty, workflow — plus the data-quality and token-economy blocks that qualify them.
scratch
Scratchpad store for ephemeral agent working notes.
search_fts
FTS5-backed search index for ASD symbols.
ser_helpers
Serde skip-predicates for agent-mode token economy.
sidecar
On-disk sidecar for the “git roundtrip” promise.
sidecar_config
Plan K t-007: .asd/config.toml reader for opt-in sidecar sharding. Today a single shape: per-package sharding via [sidecar] shard_by = "package". Default is “class” (one file per conclusion class, current behavior).
symbol
test_summary
Compact, failures-only summaries of test-runner output (Plan competitive-harvest t-005). Reads a runner’s verbose output and keeps only what an agent needs to act: the pass/fail counts and each failure with a little context — typically a ~90% token cut versus the raw log.
thinking
Plan G t-006: read-side helper for surfacing captured thinking (Hypothesis / MentalModel / FailedAttempt / OpenQuestion) into prepare-change and context-for responses.
transitive
Transitive effect propagation.
trust
State Trust Score — machine-readable rollup of ASD semantic state quality.
workflow
Workflow Recipe Detection + Task Close Evidence Quality.

Structs§

AnnotatedOwner
An owner with the evidence source that identified them.
ApprovalOutcome
Outcome of LedgerStore::approve_entry. Carries the updated entry and whether it was already approved (caller idempotency hint).
AsgEffectStore
AsgFeedbackStore
AsgIndexStore
ASD index reader/writer.
AsgLedgerStore
AsgScratchStore
ScratchStore backed by an ASG Repository.
AuditEvent
One audit entry. Flat, JSON-serializable. Shared data format — event_hash / prev_event_hash are empty strings / None when the OSS binary emits (via NullSink) and filled in by the Pro sink.
Author
CacheWarmSummary
Result of Engine::warm_caches.
CallEdge
A directed call edge from one qname to another, produced by a language adapter’s intra-module call-graph extractor.
CandidateAggregates
Holds the six parallel collections built up by the per-candidate scan plus the top symbol id (driver for downstream BFS) and the seen_inv dedup set (threaded into the subsequent caller-invariant propagation pass so both invariant sources share one namespace).
CleanFilter
Predicate used by ScratchStore::clean_entries to select entries for permanent deletion.
CollectResult
Result of collecting source files under a path.
CoveringTest
A test symbol that likely covers a given impl symbol.
CrossServiceEdge
A matched cross-service edge: an outbound endpoint linked to an inbound endpoint sharing a contract key. Computed on demand, not materialized.
DataFlowEdge
A resolved data-flow edge: a value flows from a call site in from into param of the callee to.
DataQuality
Distinguishes intentional clean-room state from unexpected data loss.
DetectedDataFlow
A data-flow site detected by an adapter, before the pipeline resolves the callee’s parameter name and symbol identity. The adapter knows the callee by qname and the argument’s position; the pipeline maps position → param name using the callee’s signature.
DetectedEndpoint
An endpoint detected by a language adapter, before the index pipeline enriches it with this repo’s repo_id and the owning symbol’s symbol_id. Adapters work in qnames, so a DetectedEndpoint names its owner by qname.
DocHit
A ranked document search hit.
DynamicDispatchHint
Plan L t-005: one dynamic-dispatch call site detected by an adapter. pattern is a short label (getattr / callback-arg / metaclass); snippet is the source line trimmed for display in CLI warnings.
EdgeEvidence
Accumulated evidence for one directed call edge.
Effect
EffectDecl
EndpointRef
A lightweight reference to one end of a cross-service edge.
Engine
The top-level ASD engine. Owns an ASG repository, a policy gate, an audit sink, and optional commercial ratify operations. Cheap to construct; shared across CLI, MCP, and library consumers.
EvidenceQuality
Per-field evidence quality breakdown for the task closure.
FeedbackEntry
A single feedback record: a (query, symbol, verdict) triple stored durably.
FeedbackImpact
Per-result explanation of which feedback verdict affected a search hit.
FeedbackMetrics
Apply feedback verdicts as score adjustments after candidate selection.
FeedbackState
Explicit description of feedback availability for the current query.
FilePolicyGate
FileRecency
Per-file recency metadata derived from a single git log call.
FtsFilters
Filters applied before BM25 ranking.
FtsHit
A single ranked result from FTS search.
HydrateSummary
Result of hydrate_from_dir. missing_schema_version is true when the sidecar exists but has no meta/schema-version file; hydrate still proceeds but callers should surface the mismatch.
IndexSummary
Summary returned by run_index.
LedgerCounts
Ledger entry counts in each store, plus the gaps between them.
LedgerEntry
LedgerRestoreReport
Outcome of restore_missing_ledger_entries.
Mismatch
NullSink
Swallows every event. The OSS default — tamper-evident file-backed audit is a commercial feature (see agentstatedeveloper-audit-pro).
OwnershipSignal
Ownership signal returned by discover_symbol_ownership.
ParsedSymbol
Parsed symbol returned by a language adapter. Carries enough info to build a full Symbol node.
PermissivePolicyGate
PolicyFile
PolicyRule
Position
Rebind
Record that a symbol was renamed/moved so its ledger history follows it. Written to /asd/v1/rebinds/<from_symbol_id> at rename time.
RebindOutcome
What one rebind moved.
RecoverySuggestion
Recovery quality estimate for a single scoped suggestion.
RepairIssue
A single integrity issue detected in the ASG.
RepairReport
Result returned by repair_asg.
ResolvedSymbol
Full symbol resolution result from the FTS table.
ReviewOutcome
Outcome of LedgerStore::reject_entry / withdraw_entry. Same idempotency shape as ApprovalOutcome.
RuntimeEvidence
Accumulated runtime-trace evidence for a symbol’s declared effects.
ScratchEntry
Ephemeral working note scoped to a symbol and/or named workflow.
ScratchFilter
Predicate applied by ScratchStore::list_entries. All Some fields must match (AND semantics).
SearchDoc
A searchable chunk from a non-code file (markdown, config, manifest, etc.).
SearchDocsDb
FTS index for document/resource chunks (separate from symbol FTS).
SearchFtsDb
ServiceEndpoint
A detected service-boundary point owned by a local symbol.
ServiceManifest
A repo’s exported endpoints — the unit shared for cross-repo matching.
Situation
Context passed to every policy evaluation call. Keys are populated by the call site so selectors can key on symbol_id, agent_id, etc.
StaleWarning
AcmeFlow refinement (1.0.77): same as stale_warning but returns a struct so callers can distinguish a soft “index is old but results came back fine” hint from a hard “FTS is broken / empty” alert. The MCP response includes stale_severity as a machine-readable field so downstream UIs can render appropriately (Craig decision Q7: yes, future-proof rendering).
Symbol
SymbolMeta
Lightweight symbol metadata stored in the asd_symbols_meta SQLite table.
SyncSummary
Result of sync_to_dir. Counts what was written; the schema version is always stamped.
TransitiveEffect
TrustScore
Rolled-up state trust score for the current ASD workspace.
TrustSignals
Raw signal values gathered before scoring. Exposed for debugging and for truth-drift history snapshots.
UncertaintyReport
Machine-readable uncertainty rollup.
UnresolvedCall
Plan L t-006: one call site the static walker tried to resolve but couldn’t. May be stdlib (print, len), third-party (an unindexed dependency), or genuinely dynamic. Aggregated by the indexer to expose the static-resolution coverage gap so agents don’t assume missing edges are bugs.
Verification
WorkflowSummary
Rolled-up workflow summary emitted in task-close JSON and persisted to .asd/workflow-sessions.jsonl.
WorkspaceSymbols
Workspace-wide context passed to adapters when resolving call edges across module boundaries.

Enums§

AsdError
AuthorKind
ConclusionClass
The conclusion-class buckets that drive .asd/conclusions/*.jsonl export and the Plan B sidecar redesign. Each class corresponds to one JSONL file; LedgerKind variants are bucketed via conclusion_class().
DataFlowKind
How a value reaches its sink. Currently only argument→parameter; field-access chains are a planned addition.
Decision
Direction
Whether an endpoint exposes/handles a contract (inbound) or consumes/calls it (outbound).
DocKind
Broad category for a document chunk.
EffectCategory
Effect category — either a well-known built-in or a user-defined domain string (e.g. "midi.send", "audio.graph.connect").
Evidence
FeedbackVerdict
Verdict an agent or user assigns to a search result.
IssueSeverity
Severity level for a RepairIssue.
LedgerKind
OwnerSignalSource
The evidence source that identified an owner.
RoleTag
Plan C t-002: first-class role-tag vocabulary. The optional LedgerEntry.role field is free-form String (so unknown tags don’t break old data), but CLI / MCP / API layers validate against this enum at write time and warn on unknown values.
ScratchStatus
Status of a ScratchEntry. Transitions: Draft → Promoted or Discarded.
SidecarState
Observable lifecycle state of the on-disk sidecar.
StaleSeverity
SymbolKind
Transport
Transport a service endpoint communicates over.
UncertaintyReason
A single, machine-readable uncertainty signal.
VerificationSource
VerificationStatus

Constants§

AGENT_DEFAULT_BUDGET
Default token budget for --agent mode (8 000 tokens ≈ 32 000 chars).
ASD_PATH_PREFIX
ASD_SCHEMA_VERSION
CLIFF_RATIO_THRESHOLD
Cliff detection threshold (1.0.85, AcmeFlow refinement #2 deep half): when a consecutive score ratio drops below this, the lower score is treated as the start of a new “also-ran” cohort and the floor is raised to exclude it.
DEFAULT_FEEDBACK_HALF_LIFE_DAYS
Default half-life for feedback boost decay, in days.
FILE_SCORE_FLOOR_RATIO
Relative score floor for file inclusion in likely_edit_files.
HASH_PREFIX
Prefix for blake3-based event hashes. Versioned so we can change the algorithm later without ambiguity. Shared between OSS readers and Pro writers.
SOFT_STALE_THRESHOLD_SECS
AcmeFlow refinement: 24h soft-threshold for handlers that have a “did the query resolve” signal (prepare-change, context_for). Matches a typical dev day — index built this morning is fine all afternoon. Other commands (status, search, investigate) keep the 1h legacy threshold via stale_warning since they ARE the index-health signal.

Traits§

AuditSink
EffectStore
FeedbackStore
IndexStore
LanguageAdapter
Language-specific parsing + effect inference. Implementations live in sibling crates: agentstatedeveloper-python, -typescript, etc.
LedgerStore
PolicyGate
RatifyOps
The three ledger review operations. Implemented by RatifyOpsImpl in agentstatedeveloper-ratify (Team tier). Methods take an explicit repo: &Repository so the impl can be a zero-sized struct — no lifetime or clone needed when stored as Arc<dyn RatifyOps> in Engine.
ScratchStore
Scratch-entry CRUD operations.

Functions§

adapt_document
Detect the kind for a file path and, if recognised, parse it into chunks. Returns None when the file is not handled by any adapter.
aggregate_candidate_data
Main candidate-scan pass. Iterates the ranked candidate list once, populating all six parallel accumulators:
append_workflow_session
Append a compact workflow session record to .asd/workflow-sessions.jsonl. Silently skips on any I/O error so task-close never fails due to logging. Caps the file at 500 lines (drops the oldest when over limit).
apply_feedback_adjustments
apply_file_scope_feedback
Apply file-scoped feedback verdicts to scored.
architecture_overview
One-call “orient me” overview: languages, packages, layers, call-graph communities (clusters), inbound/outbound routes, and hotspots. This is the JSON body asd architecture --agent prints.
assemble_symbol_context
Assemble the per-symbol context object — the building block both CLI asd context-for and MCP context_for emit per requested qname.
build_feedback_state
Convenience wrapper that fetches feedback entries before calling build_feedback_state_from_entries. Use the _from_entries variant when you already hold a list_all() result.
build_feedback_state_from_entries
Build a FeedbackState for query from the feedback store.
build_id_map
id → Symbol map for the current ref. Fast path via the SQLite symbol cache, authoritative git fallback. Shared by the many commands that need to resolve call-graph node ids back to symbols.
canonical_symbol_id
Canonical stable id for a symbol. Survives content edits and path moves; changes only on rename (which triggers a rebind record).
classify_file_role
Plan J t-003: classify a file by its functional ROLE in the project — view / viewmodel / test / example / fixture / script / generated / reference / impl. Distinct from classify_layer, which buckets by architectural tier (presentation / domain / persistence / etc.).
classify_layer
Classify a source file into a workflow layer for asd investigate grouping.
classify_layer_sym
Like classify_layer but uses the symbol’s qualified name as a secondary hint when the file path alone yields "other". Catches common cases where a class named FooViewModel lives in a file named after the app rather than the ViewModel.
cliff_cutoff_index
Compute the precision floor for file scoring. Two-pass:
collect_source_files
compute_index_consistency
Plan J t-005: reconcile the two divergent symbol counts that asd status and asd health were each reporting in isolation.
compute_trust_score
Compute a TrustScore for the ASD workspace at db_path.
compute_uncertainty
Build a structured UncertaintyReport from the signals already computed by the search/investigate/prepare-change pipeline.
confidence_reason
One-line explanation of why a result has high or low confidence.
confidence_scores
Normalize raw scores to [0.1, 1.0] confidence within the result set. The highest-scoring result gets 1.0; the lowest gets 0.1.
contract_hash
Stable 16-hex-char hash of a contract key, for use as a filesystem-/path-safe segment (raw contract keys contain spaces, /, and :).
dead_code_report
Functions/methods with no inbound call edges — a candidate list. Excludes HTTP route handlers, test functions (unless include_tests), and main/dunder methods. This is the JSON body asd dead-code --agent prints.
decay_factor
Pure decay function. Returns a multiplier in [0.0, 1.0] for an observation of age_days against half_life_days. Uses the classical exponential decay: factor = 0.5 ^ (age / half_life).
decay_for_entry
Compute the decay multiplier for an entry whose created_at is known, given the current time. Used at feedback-boost application time to scale Useful verdicts by age.
declared_effect_blast_radius
Per-declarer transitive blast radius, derived entirely from the stored transitive data written by propagate_transitive — no call-graph reachability is recomputed here.
default_adapters
Return one instance of every built-in language adapter.
derive_cold_hints
Heuristically propose a parallel test file path for a given source file.
detect_ambiguous_tokens
Detect query tokens that match too many unrelated files (broad/ambiguous terms).
detect_communities
Detect communities over an undirected graph. nodes should be passed in a stable (e.g. sorted) order for reproducibility. edges are unordered pairs; self-loops and edges to unknown nodes are ignored, duplicates collapse. Returns a dense node → community_id map.
detect_confidence_warnings
Distinguish whether low result confidence comes from ambiguous terms or a sparse index. Returns a vec of typed warning objects with kind + message.
detect_orphaned_entries
Walk every ledger entry and tag those whose symbol_id is no longer present in the qname index as "orphaned" and "orphaned-at:<timestamp>"; clear those tags from entries whose symbol is back.
detect_possible_misses
Heuristic possible-miss warnings for a result set.
detect_workflow
Detect which workflow recipe was followed and which steps were skipped.
dirty_files_for_change
Convenience: hoist git_dirty_files() for callers that want to share the same set between finalize_file_scores and a downstream stale_symbols scan. Just re-exports the underlying helper for API discoverability.
discover_symbol_ownership
Discover the likely owner of a symbol from git blame + doc-comment annotations.
drop_empty_recursive
Recursive variant of drop_empty_top_level. Walks every nested object and drops null/[]/{} children. Arrays’ elements are recursed into (an object inside an array still gets cleaned) but the array itself is preserved at its length — position often matters in arrays.
drop_empty_top_level
Token economy: drop top-level fields whose value is null, [], or {}. The agent doesn’t need the absence-of-X echo when X has no signal — they can infer “no entries” / “no warning” / “fresh” from absence.
drop_orphaned_edge_refs
Drop orphaned callee and caller refs whose target symbol_id no longer exists in the live index, in one commit. Returns the total number of individual refs dropped. Called by [hydrate_from_dir] after a hydrate pass to clean up any stale edges the sidecar may have carried.
edges_from_tree
Flatten the on-disk data-flow registry (from_symbol_id → [DataFlowEdge]) into a flat list. Malformed entries are skipped.
effect_detail_reason
Return a one-line explanation of an effect declaration’s verification state.
emit_audit
Fire-and-forget audit emit. Logs sink failures to stderr but never propagates — audit issues must never block the user’s operation.
endpoints_from_tree
Flatten the on-disk endpoint registry tree (contract_hash → repo_id → symbol_id → ServiceEndpoint) into a flat list. Malformed entries are skipped.
endpoints_report
Cross-service endpoints detected in this repo plus the in-repo matched edges. This is the JSON body asd endpoints --agent prints.
estimate_tokens
Estimate token count from a JSON string (rough: 1 token ≈ 4 chars).
explain_conflict_risk
Detect conflict risk for a single file. Returns Some(reason) if the file has unresolved merge markers or git status modifications; None when the file is clean.
explain_feedback_impacts
For each qname in qnames, determine which feedback verdict (if any) affected it and return a map of qname → FeedbackImpact.
explain_match
Explain why a symbol was returned for a query.
extract_summary
federated_edges
Federated edges over a set of per-repo manifests: match_edges on the union of every manifest’s endpoints. Each edge carries cross_repo (consumer and producer in different repos). With cross_repo_only, in-repo edges are dropped — the federated view a Team-tier tool wants: “a client in repo A calls a route served by repo B” (Plan Q t-005).
fetch_all_test_file_paths
Pre-fetch all test-tier file paths in a single DB open. Pass the result to test_files_for_source for per-file stem matching, avoiding repeated DB opens when processing many source files in a loop.
file_score_floor
finalize_file_scores
Sort + cliff-cut + build the likely_edit_files JSON array.
find_candidates
Return the top-depth (score, qname) pairs for a query.
find_covering_tests
Find test symbols in the FTS index that are likely to cover impl_qname.
find_indexed_test_files
Look up real indexed test files that correspond to source_file.
format_age
Format a unix timestamp age as a human-readable string (“3h ago”, “just now”).
gather_recency
Run one git log pass covering up to scan_commits commits and return a map of relative file path → FileRecency.
git_dirty_files
Return source file paths that are modified (dirty) since the last commit.
glob_match
Match a file path against a glob pattern.
http_contract
Build a normalized HTTP contract key from a method and a path (or full URL). A client call and a server route for the same endpoint must produce the same string: the method is upper-cased, any scheme+host is stripped, path parameters ({id}, :id, <id>, <int:id>) collapse to {}, query and fragment are dropped, and trailing slashes are removed.
hybrid_boost
Rust-side score boost applied on top of BM25 after FTS returns hits.
hydrate_from_dir
Read a .asd/v1/ sidecar under dir and write its contents back into the ASG repo via the existing stores.
hydrate_from_dir_with_cache
hydrate_from_dir, also writing the ledger entries it loads into the ledger cache, which answers list_entries.
in_memory_score
Score a symbol against query tokens using simple substring matching. Used when the FTS index is not populated.
in_memory_score_with_text
Same scoring rules as in_memory_score, but takes the symbol’s lowercased ledger-summary text directly so bulk callers can supply it from one ledger-tree walk instead of a per-symbol list_entries read (Plan T scale finding).
in_memory_scored_symbols
Bulk in-memory scorer shared by every fallback-search caller (core find_candidates, MCP code_search, CLI asd search): ONE by-qname tree read — deserializing the Symbol values the tree already contains — plus ONE ledger-tree walk, instead of a per-qname symbol fetch and a per-symbol ledger read (~54ms each on a cold FTS cache — ~9 minutes at 10k symbols while holding the engine mutex; Plan T scale finding).
intent_focus
One-line agent guidance for each intent.
intent_layer_order
Return the preferred layer display order for an intent. The standard order is used for unlisted layers.
is_doc_file
Returns true if this path should be offered to document adapters. Used to quickly gate file walking before reading content.
is_stopword
Returns true if the token is a stopword.
kind_str
ledger_counts
Count ledger entries in the cache, ASG and (when sidecar_root is given and has one) the sidecar, and the gaps between them.
list_all_effect_decls
List every stored EffectDecl in the workspace as (symbol_id, decl) pairs by walking the /asd/v1/effects subtree. Read-only. Used by overview-style consumers (e.g. asd-serve’s /api/v1/effects/overview) that need the whole distribution rather than one symbol’s decl — the per-symbol path stays EffectStore::get_effects.
load_exclude_sets
Plan J t-011: load named exclude sets from .asd/scopes.toml.
load_layer_overrides
Load user-defined layer overrides from .asd/layers.toml next to db_path.
load_scope_aliases
Load named scope aliases from .asd/scopes.toml in the current directory.
mark_fresh_reset
Write the meta/fresh-reset sentinel so agents know a deliberate reset occurred. Call this when asd init --reset or an equivalent wipe operation runs.
match_edges
Pair outbound endpoints with inbound endpoints sharing a contract key, producing cross-service edges. Endpoints may come from any repo (local + imported manifests). Edge confidence is the weaker of the two detections; cross_repo is set when the ends live in different repos.
matches_any_path_glob
Return true if file matches any of the given glob patterns.
missing_ledger_entries
Cached ledger entries whose entry_id appears nowhere in the ASG ledger tree. Matching by id rather than path means an entry moved by ledger rebind (whose cache row follows it to the new symbol) is never mistaken for a lost one.
normalize_repo_id
Normalize a git remote URL into a stable repo_id. SCP-form and HTTPS-form URLs for the same repo collapse to one id:
outdated_hooks
A warning when the project under root runs git hooks from before Plan B, which reload the whole ledger from .asd/v1/ with asd hydrate on every checkout and merge. On a store that holds more than the sidecar — anything since the last asd sync — that rewrote every entry each time, and before v1.4.7 it re-filed moved entries under their old symbols. asd init installs the current hooks, which import committed conclusions instead.
parse_intent
Parse and validate an intent string. Returns a static str or None if the value is unrecognised.
parse_params
Extract positional parameter names from a function signature, e.g. "def get_user(id, name=None, *args)" → ["id", "name"]. Skips *args/**kwargs and the self/cls receiver. Language-agnostic enough for the common name(params) shape.
parse_query
Parse a query string into (positive_tokens, exclusion_terms).
propagate_caller_invariants
Plan J t-001 caller-invariant propagation.
propagate_transitive
Compute transitive effects for each symbol in symbol_ids and write them back via effects.put_effects(...). Returns the count of symbols whose EffectDecl.transitive actually changed.
propose_test_path
propose_test_stub
Plan J t-007: language-aware test stub body for an agent that needs to write a new test against source_file exercising symbol_name. Returns the recommended skeleton — function declaration, arrange/act/assert comments, and a NotImplementedError-equivalent marker so the test FAILS until the agent fills it in (failing-first matches the missing-test recipe item which says “fails before the edit, passes after”).
prune_sidecar
Remove orphaned .asd/v1/ sidecar files — files whose keys no longer exist in the live ASG index. Returns the number of files/dirs removed.
pubsub_contract
Build a normalized pub-sub contract key from a topic / queue / event name.
query_tokens
Tokenise a free-form query into lowercase, stopword-filtered terms.
read_jsonl
Read back events from a JSONL file. Shared by OSS read-only consumers (asd audit tail) and the Pro verify_chain code path.
rebind_ledger
Move the ledger entries filed under each from symbol id onto its target symbol, in one commit.
repair_asg
Scan the ASG for integrity issues and, when dry_run is false, apply all auto-fixable corrections.
repair_asg_with_cache
repair_asg, also pointing the ledger cache at the copy kept of each duplicated entry — the cache answers list_entries, and a row left on a removed copy would hide the entry from its symbol.
resolve_edge
Resolve a detected data-flow site into a DataFlowEdge, given a way to look up a qname’s symbol_id and a callee’s parameter list. Returns None when the caller or callee can’t be resolved, or the arg position has no corresponding parameter.
resolve_exclude_set
Resolve a --exclude-set name to negative path globs. Unknown names return an empty list rather than treating the name as a glob (avoids silently turning a typo into a path filter).
resolve_repo_id
Resolve this repo’s id: an explicit override wins; otherwise the normalized origin git remote; otherwise the working-directory name as a last resort.
resolve_scope
Resolve a --scope name to path globs. Falls back to treating the scope name itself as a path glob if not in the map.
restore_missing_ledger_entries
Write every cache-only ledger entry back into ASG, with its reverse-index record, exactly as the cache holds it. Each restore is its own commit so the audit trail says what was recovered and from where.
result_bucket
Classify a result into a semantic bucket.
run_index
Run the full index pipeline over path.
scan_asg
Read-only integrity scan. Returns every detected RepairIssue without modifying any ASG state.
scan_sidecar
Scan .asd/conclusions/ for files and directories that don’t match the Plan K sidecar inclusion rule:
score_evidence_quality
Score task-closure evidence quality from available signals.
sidecar_lifecycle_state
Inspect the on-disk sidecar under dir and return its lifecycle state.
stale_warning
Return a stale-index warning string if the index is older than threshold_secs (default: 3600 = 1 hour), or None if fresh.
stale_warning_classified
suggest_better_queries
Suggest more specific queries when the current query is too broad.
suggest_scoped_queries
Suggest refined, scoped queries when the current query contains ambiguous terms.
symbol_fingerprint
Content-addressed fingerprint of a symbol’s body. Changes on every edit.
symbol_tier
Classify a source file into a symbol tier.
sync_to_dir
Mirror live ASG state into the .asd/v1/ sidecar under dir.
test_files_for_source
Filter all_test_files (from fetch_all_test_file_paths) for those whose stem matches source_file’s stem. Same logic as find_indexed_test_files but avoids the per-call DB open.
trim_for_agent
Trim a JSON value for LLM consumption.

Type Aliases§

FileScoreTuple
Per-row file score tuple shape used by the prepare-change pipeline. (score, file, layer, last_touched_days, hot, top_symbol, why)
Result
SymbolTier
Symbol tier — controls default inclusion and scoring penalty.