myco_sense
Search the substrate's markdown and yaml for a literal substring to verify facts before assertion. Returns ranked hits with file path, line number, and snippet.
Instructions
Perform a keyword substring search across the substrate's markdown + yaml surface and return ranked hits with file path, line number, and snippet. This is the R3 SENSE-BEFORE-ASSERT mechanism: before asserting a substrate fact from training memory, the agent calls this to check ground truth from the substrate itself (R3 of the Hard Contract).
Use this before making any claim about what the substrate contains — e.g. "the substrate says X" should always be preceded by a sense call that returned a hit for X. Fast (no embedding, no LLM, no network) — this is a literal substring scan over notes/, docs/, _canon.yaml, and MYCO.md. For broader semantic search, compose multiple sense calls with different keyword synonyms rather than expanding the query.
Side effects: none. Pure read. Does not touch .myco/state/ or any cache.
Returns: { exit_code, query, scope, hits: [ { path, line,
snippet } ] }. hits is ordered by path then line number;
snippet is the full matching line trimmed to reasonable width.
Empty hits is a successful call with no matches — agent
should treat "absence of hit" as "fact not in substrate" per R3.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Literal substring to search for. Case-insensitive. No regex, no glob — pass 'error' not 'err.*' (regex-in-query is treated as literal). For multi-term search, call sense multiple times and union results. Whitespace-only queries return empty hits. | |
| project_dir | No | Absolute path of the workspace / project whose Myco substrate this call targets. Overrides auto-discovery. When omitted, Myco resolves via MCP roots/list, then MYCO_PROJECT_DIR, then cwd — the substrate_pulse field in every response echoes which source answered. |