claim:entry
Start with a precise question
Give nav query a repository, local branch or tag, language, compilation and search terms. An exact decision identifier and source output are optional.
The CLI dispatch selects nav_query. The handler adds the decision identifier to the terms if it is missing, then requests an analysis context.
Evidence boundaryThe diagram starts at CLI dispatch. Shell startup, argument-parser internals and the implementation of every language adapter are outside this slice.
Inspect supporting code
crates/clew/src/main.rs:1551–1553 ↗EXACT SNAPSHOT TEXT · RETRIEVED BY CODECLEW
Command::Nav {
command: NavCommand::Query(args),
} => nav_query(args),
Digests and evidence binding
Fragment: sha256:872c7b6e404525370100f5cf3cae6659d5d8c28e503e995f5d4ea02aaebe6b46
File: sha256:a3634c5ac8882782088273f131637e68d4e81a64ae9b7cb37aed411f515af498
Context: context:sha256:93674abcb006ca2817e0345aea681015ed813d22d7cf99378c668ef78040d210
Evidence: sha256:adfce75275522d171a3ed3811362645aea01a24617b353fcd5488d80ebf9fbb4
crates/clew/src/main.rs:2188–2210 ↗EXACT SNAPSHOT TEXT · RETRIEVED BY CODECLEW
fn nav_query(args: NavQueryArgs) -> Result<Value, ClewError> {
let include_top_source = args.source;
let follow_references = args.follow_references;
let follow_max_roots = args.max_roots.max(4);
let decision_identifier = args.decision_identifier;
let mut terms = args.terms;
if let Some(identifier) = decision_identifier.as_deref()
&& !terms.iter().any(|term| term == identifier)
{
terms.push(identifier.to_owned());
}
let intent = args
.intent
.unwrap_or_else(|| clew::navigation::NAV_QUERY_INTENT.to_string());
let opened = admit_and_open_context(
&args.session,
&args.profile,
DoctorOperationArg::Analysis,
intent,
terms,
args.max_roots,
args.committed,
)?;
Digests and evidence binding
Fragment: sha256:b9e8c92b0ff75f9b514835ae37c52c71bd9c99a3a0af57beb38e0a8c24f8ac83
File: sha256:a3634c5ac8882782088273f131637e68d4e81a64ae9b7cb37aed411f515af498
Context: context:sha256:8b278333b8e84f2e9e7e5fc154255af7951e6d68db0191b0b2eb876624f2ea77
Evidence: sha256:a0321ea7055f579f894d6b86a7542b81fde3f3b294c52d63117a2e2c0e151a08
claim:admit
Check that this task can run
Codeclew checks the selected runtime and repository scope before opening a session. A readiness failure stops the request.
admit_and_open_context calls doctor for the exact language, profile, operation and compilations. require_task_ready appears before the readiness digest, capabilities lookup and open_session.
Evidence boundaryThis is visible Rust source order. The Rust profile does not prove name resolution, macro expansion or runtime reachability.
Inspect supporting code
crates/clew/src/main.rs:2097–2118 ↗EXACT SNAPSHOT TEXT · RETRIEVED BY CODECLEW
let runtime = active_runtime()?;
let repository = absolute(&session_args.repo)?;
let readiness = doctor(
&runtime,
DoctorScope::Task,
Some(&repository),
Some(&session_args.target_ref),
Some(DoctorTask {
language: session_language(session_args.language),
profile_id: profile,
operation: match operation {
DoctorOperationArg::Analysis => DoctorOperation::Analysis,
DoctorOperationArg::Mutation => DoctorOperation::Mutation,
},
compilations: &session_args.compilation,
committed,
}),
)?;
require_task_ready(&readiness)?;
let readiness_digest = canonical::hash(&readiness).map_err(internal)?;
let product = capabilities(&runtime)?;
let session = open_session(session_args)?;
Digests and evidence binding
Fragment: sha256:ffac83ca7b65b034790314b08042ac5c1b5e7ec3d658b4f29323fae43ab58511
File: sha256:a3634c5ac8882782088273f131637e68d4e81a64ae9b7cb37aed411f515af498
Context: context:sha256:1578f752944dd292699875a65f185f5b96f3bb38672a55901c76f13b952d3442
Evidence: sha256:9a48b4378c852e6fcadf6923b4bdc54f4c846cc358eb87d8e270f7146b69c4bb
claim:context
Open a session and retain context
The session and its first bounded context become the common evidence for the rest of the request.
After opening the session, the helper calls create_context_object. Success returns the session, context and PASS admission together.
Evidence boundarySnapshot capture, adapter analysis, indexing and caching are delegated here; this page does not claim to trace those internals.
Inspect supporting code
crates/clew/src/main.rs:2119–2133 ↗EXACT SNAPSHOT TEXT · RETRIEVED BY CODECLEW
match create_context_object(&session, intent, terms, max_roots) {
Ok(context) => Ok(AdmittedContext {
admission: json!({
"agentContract":product["agentContract"],
"readinessDigest":readiness_digest,
"readinessSchema":readiness["schema"],
"runtimeMode":runtime.mode,
"runtimeKey":runtime.runtime_key,
"runtimeManifestDigest":runtime.manifest_digest,
"status":"PASS",
"taskAuthority":readiness["taskAuthority"],
}),
session,
context,
}),
Digests and evidence binding
Fragment: sha256:0411b7d060c2c11afa8dd33ad9ee4154ca737b14327bf3218f36981ac9209e2a
File: sha256:a3634c5ac8882782088273f131637e68d4e81a64ae9b7cb37aed411f515af498
Context: context:sha256:1578f752944dd292699875a65f185f5b96f3bb38672a55901c76f13b952d3442
Evidence: sha256:9a48b4378c852e6fcadf6923b4bdc54f4c846cc358eb87d8e270f7146b69c4bb
crates/clew/src/navigation.rs:38–57 ↗EXACT SNAPSHOT TEXT · RETRIEVED BY CODECLEW
pub fn query_with_decision_identifier(
context: &ContextObject,
facets: &[NavigationFacet],
decision_identifier: Option<&str>,
) -> Result<Value, ClewError> {
let retained = retained_context(context)?;
let result = assemble_with_decision_identifier(
&context.session_id,
&context.context_id,
&context.evidence_digest,
&context.intent,
&context.terms,
retained,
retained_query_truncated(context),
facets,
decision_identifier,
)?;
validate_stdout(&result)?;
Ok(result)
}
Digests and evidence binding
Fragment: sha256:33235eda234c1ed87041fec032cc1be41f79a73cac7c8b668d2741d99640af1b
File: sha256:1921f672c70e14d9aa1d8ded4eb910dcf05d7cc7bb50aa6e000662f2a650eb95
Context: context:sha256:1578f752944dd292699875a65f185f5b96f3bb38672a55901c76f13b952d3442
Evidence: sha256:9a48b4378c852e6fcadf6923b4bdc54f4c846cc358eb87d8e270f7146b69c4bb
claim:failure
Return an error; attempt cleanup
Readiness errors stop before a session is opened. If context creation fails after opening, the handler attempts to abort and garbage-collect that session.
The create-context error arm invokes change_open_failure with session.abort() and session.gc(false). Later navigation failures are mapped through compensate_opened_context.
Evidence boundaryThis page proves the visible cleanup request. It does not prove that every cleanup succeeds, or document the helper’s recovery behavior.
Inspect supporting code
crates/clew/src/main.rs:2134–2140 ↗EXACT SNAPSHOT TEXT · RETRIEVED BY CODECLEW
Err(error) => Err(change_open_failure(error, &session.session_id, || {
session.abort()?;
session.gc(false)?;
Ok(())
})),
}
}
Digests and evidence binding
Fragment: sha256:a77a83da0cb6e9954876ec2ccc6ad055e526580687ef0b0652c6547f77d173f1
File: sha256:a3634c5ac8882782088273f131637e68d4e81a64ae9b7cb37aed411f515af498
Context: context:sha256:1578f752944dd292699875a65f185f5b96f3bb38672a55901c76f13b952d3442
Evidence: sha256:9a48b4378c852e6fcadf6923b4bdc54f4c846cc358eb87d8e270f7146b69c4bb
crates/clew/src/main.rs:2211–2216 ↗EXACT SNAPSHOT TEXT · RETRIEVED BY CODECLEW
let mut navigation = clew::navigation::query_with_decision_identifier(
&opened.context,
&[],
decision_identifier.as_deref(),
)
.map_err(|error| compensate_opened_context(error, &opened))?;
Digests and evidence binding
Fragment: sha256:418ae35237e104e3f439b09cfe80e66f44b4eccaa0bfb21e7f4b9fc3a37c6e1b
File: sha256:a3634c5ac8882782088273f131637e68d4e81a64ae9b7cb37aed411f515af498
Context: context:sha256:8b278333b8e84f2e9e7e5fc154255af7951e6d68db0191b0b2eb876624f2ea77
Evidence: sha256:a0321ea7055f579f894d6b86a7542b81fde3f3b294c52d63117a2e2c0e151a08
claim:decision
Separate ranking from a supported decision
A useful search result is not automatically the declaration you meant. Codeclew ranks retained declarations, then checks whether one exact identifier covers the query.
Only declaration payloads enter the ranking. Exact identifier matches are ranked first, followed by source-window and term/name relevance. Counts are computed before the returned-card limit. The decision check receives query truncation separately from card-list truncation.
Evidence boundaryCoverage here is bounded lexical coverage of retained evidence. It is not semantic correctness or proof that the entire repository was searched.
Inspect supporting code
crates/clew/src/navigation.rs:1680–1712 ↗EXACT SNAPSHOT TEXT · RETRIEVED BY CODECLEW
if !is_declaration(payload) {
continue;
}
let fact_key = required_string(matched, "factKey")?;
let compilation = required_string(matched, "compilation")?;
let candidate_id = candidate_handle(compilation, fact_key)?;
if handles
.insert(candidate_id.clone(), (compilation, fact_key))
.is_some()
{
return Err(invalid("navigation candidate handle collision"));
}
let covered_terms = candidate_authority_term_hits(payload, sources, &normalized_terms);
let decision_identifier_match = decision_identifier
.is_some_and(|identifier| candidate_matches_declared_identifier(payload, identifier));
let (term_coverage, name_coverage, occurrences) =
candidate_relevance(payload, sources, &normalized_terms);
let (window_coverage, window_occurrences) =
source_window_relevance(sources, payload, &normalized_terms);
ranked_candidates.push((
usize::from(decision_identifier_match),
window_coverage,
term_coverage,
name_coverage,
occurrences,
window_occurrences,
ordinal,
candidate_id,
matched,
payload,
covered_terms,
decision_identifier_match,
));
Digests and evidence binding
Fragment: sha256:fe70364fc4b5f0f19e2aa0653b4e5c46bae02a83bda9a18d372e6e4674b545b8
File: sha256:1921f672c70e14d9aa1d8ded4eb910dcf05d7cc7bb50aa6e000662f2a650eb95
Context: context:sha256:b548496cf632e97b73b43f7ee5a222646b3bbf4489654adf0cf95ca1b684133b
Evidence: sha256:f71ad78a78eef2cc016ec3a374bf135af15fd3553c994554f34645a65bbb4fd0
crates/clew/src/navigation.rs:1714–1737 ↗EXACT SNAPSHOT TEXT · RETRIEVED BY CODECLEW
ranked_candidates.sort_by(|left, right| {
right
.0
.cmp(&left.0)
.then_with(|| right.1.cmp(&left.1))
.then_with(|| right.2.cmp(&left.2))
.then_with(|| right.3.cmp(&left.3))
.then_with(|| right.4.cmp(&left.4))
.then_with(|| right.5.cmp(&left.5))
.then_with(|| left.6.cmp(&right.6))
});
let total_candidates = ranked_candidates.len();
let full_coverage_candidate_count = if normalized_terms.is_empty() {
0
} else {
ranked_candidates
.iter()
.filter(|candidate| candidate.10.len() == normalized_terms.len())
.count()
};
let exact_identifier_candidate_count = ranked_candidates
.iter()
.filter(|candidate| candidate.0 > 0)
.count();
Digests and evidence binding
Fragment: sha256:771fd40cdbcc09b02f5a68e97e8f36a4800e2da6b7ba275b03b528a45bd8d79c
File: sha256:1921f672c70e14d9aa1d8ded4eb910dcf05d7cc7bb50aa6e000662f2a650eb95
Context: context:sha256:b548496cf632e97b73b43f7ee5a222646b3bbf4489654adf0cf95ca1b684133b
Evidence: sha256:f71ad78a78eef2cc016ec3a374bf135af15fd3553c994554f34645a65bbb4fd0
crates/clew/src/navigation.rs:1741–1758 ↗EXACT SNAPSHOT TEXT · RETRIEVED BY CODECLEW
let mut candidate_identities = BTreeSet::new();
for (
_,
_,
_,
_,
_,
_,
_,
candidate_id,
matched,
payload,
covered_terms,
decision_identifier_match,
) in ranked_candidates.into_iter().take(MAX_NAV_CANDIDATES)
{
let fact_key = required_string(matched, "factKey")?;
let compilation = required_string(matched, "compilation")?;
Digests and evidence binding
Fragment: sha256:61bdc4bf8d5c46189e22acaa4bde21be7f6be2279221e04b97db8fc0646c9b25
File: sha256:1921f672c70e14d9aa1d8ded4eb910dcf05d7cc7bb50aa6e000662f2a650eb95
Context: context:sha256:b548496cf632e97b73b43f7ee5a222646b3bbf4489654adf0cf95ca1b684133b
Evidence: sha256:f71ad78a78eef2cc016ec3a374bf135af15fd3553c994554f34645a65bbb4fd0
crates/clew/src/navigation.rs:1815–1828 ↗EXACT SNAPSHOT TEXT · RETRIEVED BY CODECLEW
let decision_authority = navigation_decision_authority(NavigationDecisionAuthorityInput {
session_id,
context_id,
required_terms: &normalized_terms,
candidates: &candidates,
returned_candidate_coverage: &returned_candidate_coverage,
returned_candidate_exact_identifiers: &returned_candidate_exact_identifiers,
full_coverage_candidate_count,
exact_identifier_candidate_count,
decision_identifier_declared: decision_identifier.is_some(),
query_truncated,
candidate_list_truncated: total_candidates > candidates.len(),
completeness: retained.get("completeness"),
})?;
Digests and evidence binding
Fragment: sha256:0e71e0a79baa0e09b8e0a5cc2bf5338a1c6a1296767ee23c99b9a0246a2e0c7f
File: sha256:1921f672c70e14d9aa1d8ded4eb910dcf05d7cc7bb50aa6e000662f2a650eb95
Context: context:sha256:b548496cf632e97b73b43f7ee5a222646b3bbf4489654adf0cf95ca1b684133b
Evidence: sha256:f71ad78a78eef2cc016ec3a374bf135af15fd3553c994554f34645a65bbb4fd0
claim:supported
One exact, fully covered identifier
The decision is SUPPORTED when there are nonempty required terms, no unmatched terms, no query truncation, and exactly one exact-identifier candidate with complete coverage.
The successful branch returns UNIQUE_EXACT_IDENTIFIER_FULL_COVERAGE and the selected candidate ID. With --source, nav_query requests its retained source envelope.
Evidence boundarySUPPORTED identifies the declaration. It does not upgrade Rust syntax evidence to compiler proof or prove the caller’s whole task.
Inspect supporting code
crates/clew/src/navigation.rs:1963–1989 ↗EXACT SNAPSHOT TEXT · RETRIEVED BY CODECLEW
if !required_terms.is_empty()
&& unmatched_terms.is_empty()
&& !query_truncated
&& exact_identifier_candidate_count == 1
&& exact_identifier_candidate
.and_then(|candidate| candidate.get("complete"))
.and_then(Value::as_bool)
== Some(true)
{
let candidate = exact_identifier_candidate.ok_or_else(|| {
internal("unique exact-identifier navigation candidate was not returned")
})?;
return Ok(json!({
"schema":NAV_DECISION_AUTHORITY_SCHEMA,
"status":"SUPPORTED",
"classification":"UNIQUE_EXACT_IDENTIFIER_FULL_COVERAGE",
"basis":"EXACT_DECLARATION_NAME_AND_BOUNDARY_SAFE_LEXICAL_COVERAGE",
"candidateId":required_value_string(candidate, "candidateId")?,
"requiredTermCount":required_terms.len(),
"coveredTermCount":required_terms.len(),
"returnedCandidateCoverage":returned_coverage,
"observedFullCoverageCandidateCount":full_coverage_candidate_count,
"observedExactIdentifierCandidateCount":exact_identifier_candidate_count,
"queryCoverageTruncated":query_truncated,
"candidateListTruncated":candidate_list_truncated,
}));
}
Digests and evidence binding
Fragment: sha256:613bdc196d0505dd90116b10e1f366297c410f821e8aa767e1a1e71a01f0e820
File: sha256:1921f672c70e14d9aa1d8ded4eb910dcf05d7cc7bb50aa6e000662f2a650eb95
Context: context:sha256:7e51fe3ab0b09a7d44e9bd88b190a5d312e5a0f90ee943d8a5fe9aebc6db9229
Evidence: sha256:fd52200db4eaa30829e8b59a29d02ee9cba063906f41d020697c335cbd409791
crates/clew/src/main.rs:2217–2232 ↗EXACT SNAPSHOT TEXT · RETRIEVED BY CODECLEW
if include_top_source {
let decision_candidate_id =
navigation_decision_candidate_id(&navigation).map(str::to_owned);
let no_decision_reason = navigation_no_decision_reason(&navigation);
let decision_source = decision_candidate_id
.as_deref()
.map(|candidate_id| {
clew::navigation::source_envelope_by_candidate(&opened.context, candidate_id)
})
.transpose()
.map_err(|error| compensate_opened_context(error, &opened))?
.unwrap_or_else(|| json!({"status":"UNAVAILABLE","reason":no_decision_reason}));
navigation
.as_object_mut()
.ok_or_else(|| ClewError::new(ErrorCode::Internal, "navigation result is invalid"))?
.insert("decisionSource".into(), decision_source);
Digests and evidence binding
Fragment: sha256:2cd788dd49ebbfe86701a35f165e304958d749eb55d8187cdc808dcd8a7bae81
File: sha256:a3634c5ac8882782088273f131637e68d4e81a64ae9b7cb37aed411f515af498
Context: context:sha256:8b278333b8e84f2e9e7e5fc154255af7951e6d68db0191b0b2eb876624f2ea77
Evidence: sha256:a0321ea7055f579f894d6b86a7542b81fde3f3b294c52d63117a2e2c0e151a08
claim:abstain
Keep candidates; explain what is missing
If the decision conditions are not met, Codeclew returns ABSTAIN with the reason. The first candidate remains a search result.
Reasons include missing terms, unmatched terms, truncated query coverage, no declared identifier, ambiguous or absent identifiers, an unreturned exact candidate, or partial exact coverage. Without a supported decision, requested source is UNAVAILABLE.
Evidence boundaryA stopped request must not be repeated unchanged or resolved by copying a ranked card name into a decision identifier. The returned refinement specifies the next allowed action.
Inspect supporting code
crates/clew/src/navigation.rs:2003–2028 ↗EXACT SNAPSHOT TEXT · RETRIEVED BY CODECLEW
let (classification, next_missing_term) = if required_terms.is_empty() {
("NO_EXPLICIT_TERMS", None)
} else if !unmatched_terms.is_empty() {
(
"UNMATCHED_EXPLICIT_TERMS",
unmatched_terms.iter().next().cloned(),
)
} else if query_truncated {
(
"TRUNCATED_QUERY_COVERAGE",
best_missing_terms.iter().next().cloned(),
)
} else if !decision_identifier_declared {
("NO_DECLARED_DECISION_IDENTIFIER", None)
} else if exact_identifier_candidate_count > 1 {
("AMBIGUOUS_EXACT_IDENTIFIER", None)
} else if exact_identifier_candidate_count == 0 {
("NO_EXACT_IDENTIFIER", None)
} else if exact_identifier_candidate.is_none() {
("EXACT_IDENTIFIER_NOT_RETURNED", None)
} else {
(
"PARTIAL_EXACT_IDENTIFIER_COVERAGE",
best_missing_terms.iter().next().cloned(),
)
};
Digests and evidence binding
Fragment: sha256:2911c6a61c7dc29392c2236096a7a835b2f571973c3f337189c518fc6bf96f14
File: sha256:1921f672c70e14d9aa1d8ded4eb910dcf05d7cc7bb50aa6e000662f2a650eb95
Context: context:sha256:7e51fe3ab0b09a7d44e9bd88b190a5d312e5a0f90ee943d8a5fe9aebc6db9229
Evidence: sha256:fd52200db4eaa30829e8b59a29d02ee9cba063906f41d020697c335cbd409791
crates/clew/src/navigation.rs:2029–2066 ↗EXACT SNAPSHOT TEXT · RETRIEVED BY CODECLEW
let refinement = if decision_identifier_declared {
json!({
"kind":"STOP_UNRESOLVED",
"reason":"DECLARED_IDENTIFIER_DID_NOT_ESTABLISH_UNIQUE_FULL_COVERAGE",
"repeatSameRequest":false,
"instruction":"The declared identifier did not establish one complete decision. Do not repeat it or select an analogue. Continue only after the task or an exact retained source supplies a different identifier or a known file; otherwise keep the task unresolved.",
})
} else {
json!({
"kind":"ADD_TASK_DISCRIMINANT",
"command":format!(
"nav expand --session {session_id} --from {context_id} --term <new-task-derived-exact-identifier> --decision-identifier <same-new-task-derived-exact-identifier>"
),
"precondition":"NEW_TASK_SUPPLIED_EXACT_IDENTIFIER_NOT_ALREADY_IN_CONTEXT",
"repeatSameRequest":false,
"onUnsatisfied":"STOP_UNRESOLVED",
"requiredCoverage":next_missing_term.iter().collect::<Vec<_>>(),
"instruction":"Use this refinement once only when the task supplies a new exact identifier that is absent from the current query. Never copy a returned card name into this field. If no such identifier is available, keep the task unresolved.",
})
};
let authority = json!({
"schema":NAV_DECISION_AUTHORITY_SCHEMA,
"status":"ABSTAIN",
"classification":classification,
"basis":"EXACT_DECLARATION_NAME_AND_BOUNDARY_SAFE_LEXICAL_COVERAGE",
"requiredTermCount":required_terms.len(),
"unmatchedTermCount":unmatched_terms.len(),
"bestCandidateCoveredTermCount":best_covered_terms.len(),
"bestCandidateMissingTermCount":best_missing_terms.len(),
"returnedCandidateCoverage":returned_coverage,
"observedFullCoverageCandidateCount":full_coverage_candidate_count,
"observedExactIdentifierCandidateCount":exact_identifier_candidate_count,
"queryCoverageTruncated":query_truncated,
"candidateListTruncated":candidate_list_truncated,
"refinement":refinement,
});
Ok(authority)
}
Digests and evidence binding
Fragment: sha256:630610e2ce15d3cf132fb26951eda99929768fd7567734842e78811c4672da74
File: sha256:1921f672c70e14d9aa1d8ded4eb910dcf05d7cc7bb50aa6e000662f2a650eb95
Context: context:sha256:7e51fe3ab0b09a7d44e9bd88b190a5d312e5a0f90ee943d8a5fe9aebc6db9229
Evidence: sha256:fd52200db4eaa30829e8b59a29d02ee9cba063906f41d020697c335cbd409791
crates/clew/src/main.rs:2217–2228 ↗EXACT SNAPSHOT TEXT · RETRIEVED BY CODECLEW
if include_top_source {
let decision_candidate_id =
navigation_decision_candidate_id(&navigation).map(str::to_owned);
let no_decision_reason = navigation_no_decision_reason(&navigation);
let decision_source = decision_candidate_id
.as_deref()
.map(|candidate_id| {
clew::navigation::source_envelope_by_candidate(&opened.context, candidate_id)
})
.transpose()
.map_err(|error| compensate_opened_context(error, &opened))?
.unwrap_or_else(|| json!({"status":"UNAVAILABLE","reason":no_decision_reason}));
Digests and evidence binding
Fragment: sha256:db42ab40f69e729beb3988205c831342074a875525ffc78fa03c51742b4727de
File: sha256:a3634c5ac8882782088273f131637e68d4e81a64ae9b7cb37aed411f515af498
Context: context:sha256:8b278333b8e84f2e9e7e5fc154255af7951e6d68db0191b0b2eb876624f2ea77
Evidence: sha256:a0321ea7055f579f894d6b86a7542b81fde3f3b294c52d63117a2e2c0e151a08
claim:result
Return a bounded result you can continue
The response keeps the session, context and evidence binding. Reuse the returned handles to expand only the evidence you still need.
With --source, agent_card validates the decision contract and compacts candidates and source. The outer response includes admission and session metadata, then validates its stdout before returning. Without --source, that agent-card conversion is skipped.
Evidence boundaryAn OPEN session is not a published code change. This example performs read-only analysis; it does not run the analyzed command’s downstream behavior.
Inspect supporting code
crates/clew/src/navigation.rs:59–84 ↗EXACT SNAPSHOT TEXT · RETRIEVED BY CODECLEW
pub fn agent_card(result: &Value) -> Result<Value, ClewError> {
if result.get("schema").and_then(Value::as_str) != Some(NAV_RESULT_SCHEMA) {
return Err(invalid("agent card input is not a navigation result"));
}
let candidates = result
.get("candidates")
.and_then(Value::as_array)
.ok_or_else(|| invalid("navigation result has no candidate array"))?
.iter()
.map(compact_agent_candidate)
.collect::<Result<Vec<_>, _>>()?;
let decision_source = result
.get("decisionSource")
.ok_or_else(|| invalid("navigation result has no decision source"))?;
let decision_authority = result
.get("decisionAuthority")
.ok_or_else(|| invalid("navigation result has no decision authority"))?;
validate_agent_card_decision_contract(result, decision_authority, decision_source)?;
let compact_source = compact_decision_source(decision_source)?;
let supporting_anchors = result
.get("termAnchors")
.and_then(Value::as_array)
.ok_or_else(|| invalid("navigation result has no term anchors"))?
.iter()
.filter(|anchor| !anchor_is_in_decision_source(anchor, decision_source))
.cloned()
Digests and evidence binding
Fragment: sha256:2367e6fcb4861cca23988ee0535b2ae8c2f4a6c55dc53bc5683bd37cf7c9823b
File: sha256:1921f672c70e14d9aa1d8ded4eb910dcf05d7cc7bb50aa6e000662f2a650eb95
Context: context:sha256:1578f752944dd292699875a65f185f5b96f3bb38672a55901c76f13b952d3442
Evidence: sha256:9a48b4378c852e6fcadf6923b4bdc54f4c846cc358eb87d8e270f7146b69c4bb
crates/clew/src/navigation.rs:113–128 ↗EXACT SNAPSHOT TEXT · RETRIEVED BY CODECLEW
.ok_or_else(|| invalid("navigation result has no next action"))?;
let mut card = json!({
"schema":NAV_AGENT_CARD_SCHEMA,
"sessionId":required_value_string(result, "sessionId")?,
"contextId":required_value_string(result, "contextId")?,
"evidenceDigest":required_value_string(result, "evidenceDigest")?,
"terms":terms,
"candidates":candidates,
"candidateCount":candidate_count,
"decisionAuthority":decision_authority,
"decisionSource":compact_source,
"supportingAnchors":supporting_anchors,
"completeness":completeness,
"queryCoverageTruncated":query_coverage_truncated,
"candidateListTruncated":candidate_list_truncated,
"truncated":truncated,
Digests and evidence binding
Fragment: sha256:1161a895287056bd27a38ae42f4911e5247cd3d0ba7946f809a66ab950f94836
File: sha256:1921f672c70e14d9aa1d8ded4eb910dcf05d7cc7bb50aa6e000662f2a650eb95
Context: context:sha256:1578f752944dd292699875a65f185f5b96f3bb38672a55901c76f13b952d3442
Evidence: sha256:9a48b4378c852e6fcadf6923b4bdc54f4c846cc358eb87d8e270f7146b69c4bb
crates/clew/src/main.rs:2297–2318 ↗EXACT SNAPSHOT TEXT · RETRIEVED BY CODECLEW
let admission = navigation_admission(&opened.admission, include_top_source);
if include_top_source {
navigation = clew::navigation::agent_card(&navigation)
.map_err(|error| compensate_opened_context(error, &opened))?;
}
let mut result = json!({
"schema":clew::navigation::NAV_QUERY_SCHEMA,
"status":"OPEN",
"admission":admission,
"session":{
"sessionId":opened.session.session_id,
"baseRevision":opened.session.base_revision,
"targetRef":opened.session.target_ref,
"language":opened.session.language,
"compilations":opened.session.compilations,
},
"navigation":navigation,
});
validate_nav_query_stdout(&mut result, follow_references)
.map_err(|error| compensate_opened_context(error, &opened))?;
Ok(result)
}
Digests and evidence binding
Fragment: sha256:6edc11f5b2c0e871fd4c5b4bfd9651495c94f715691e4ed56148453574af319c
File: sha256:a3634c5ac8882782088273f131637e68d4e81a64ae9b7cb37aed411f515af498
Context: context:sha256:8b278333b8e84f2e9e7e5fc154255af7951e6d68db0191b0b2eb876624f2ea77
Evidence: sha256:a0321ea7055f579f894d6b86a7542b81fde3f3b294c52d63117a2e2c0e151a08
claim:references
Optional: follow retained names
--follow-references adds bounded exploration only with --source. It is not part of the default route shown in the graph.
Without a decision, referenceFollow is UNAVAILABLE. With a decision but no eligible references, it is also UNAVAILABLE. Otherwise the handler expands context using the selected terminal names and returns direct_reference_detail with its parent binding.
Evidence boundaryThe returned authority explicitly remains lexical, targetResolution=UNRESOLVED and semanticRelation=UNKNOWN. These are not compiler-resolved call edges.
Inspect supporting code
crates/clew/src/main.rs:2233–2254 ↗EXACT SNAPSHOT TEXT · RETRIEVED BY CODECLEW
if follow_references {
let reference_follow = match decision_candidate_id.as_deref() {
None => json!({
"status":"UNAVAILABLE",
"reason":no_decision_reason,
"selectionAuthority":"LEXICAL_QUERY_TERM_OVERLAP",
"targetResolution":"UNRESOLVED",
"semanticRelation":"UNKNOWN",
}),
Some(candidate_id) => {
let (selections, source_references_truncated, eligible_count) =
clew::navigation::select_direct_references(&opened.context, candidate_id)
.map_err(|error| compensate_opened_context(error, &opened))?;
if selections.is_empty() {
json!({
"status":"UNAVAILABLE",
"reason":"NO_LEXICALLY_RELATED_RETAINED_DIRECT_REFERENCE",
"selectionAuthority":"LEXICAL_QUERY_TERM_OVERLAP",
"targetResolution":"UNRESOLVED",
"semanticRelation":"UNKNOWN",
"sourceReferencesTruncated":source_references_truncated,
"truncated":source_references_truncated,
Digests and evidence binding
Fragment: sha256:de327f5f21d420ad2a8e485276c295f45a202e56f49df6d5510bbcef638a0da5
File: sha256:a3634c5ac8882782088273f131637e68d4e81a64ae9b7cb37aed411f515af498
Context: context:sha256:8b278333b8e84f2e9e7e5fc154255af7951e6d68db0191b0b2eb876624f2ea77
Evidence: sha256:a0321ea7055f579f894d6b86a7542b81fde3f3b294c52d63117a2e2c0e151a08
crates/clew/src/main.rs:2255–2288 ↗EXACT SNAPSHOT TEXT · RETRIEVED BY CODECLEW
})
} else {
let terms = selections
.iter()
.map(|selection| selection.terminal_name().to_owned())
.collect::<Vec<_>>();
let child = expand_context_object(
&opened.session,
opened.context.context_id.clone(),
None,
terms,
follow_max_roots,
)
.map_err(|error| compensate_opened_context(error, &opened))?;
let mut detail = clew::navigation::direct_reference_detail(
&child,
&selections,
eligible_count,
)
.map_err(|error| compensate_opened_context(error, &opened))?;
detail
.as_object_mut()
.ok_or_else(|| {
ClewError::new(
ErrorCode::Internal,
"direct reference detail is invalid",
)
})?
.insert(
"parentContextId".into(),
Value::String(opened.context.context_id.clone()),
);
detail
}
Digests and evidence binding
Fragment: sha256:119a41798a2c4be85b728969a6a8008ce7ae345b0451eb33ba84bcd54b4f033d
File: sha256:a3634c5ac8882782088273f131637e68d4e81a64ae9b7cb37aed411f515af498
Context: context:sha256:8b278333b8e84f2e9e7e5fc154255af7951e6d68db0191b0b2eb876624f2ea77
Evidence: sha256:a0321ea7055f579f894d6b86a7542b81fde3f3b294c52d63117a2e2c0e151a08