Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

fix(agentic-ide): pick @files from the workspace tree, not five name hits

Haraldf9c287723b7f
diff --git a/jarvis/agentic_ide/file_index.py b/jarvis/agentic_ide/file_index.py
index 206aaa0662..1dc5175378 100644
--- a/jarvis/agentic_ide/file_index.py
+++ b/jarvis/agentic_ide/file_index.py
@@ -26,6 +26,7 @@ an exact stem hit beats a partial one, a hit in the file NAME beats one in a
parent directory, and tests rank below implementation unless the request is
about tests.
"""
+
from __future__ import annotations
import os
@@ -41,15 +42,61 @@ from .folders import _SKIP_DIRS
_MAX_FILES = 30_000
_MAX_DEPTH = 12
+# The tree handed to the 1 s writer. Enough directories to see where a
+# feature lives; small enough that Flash reads it instead of thinking about
+# it. Hot directories (query tokens hit the name or the files) list more.
+_MAP_CHARS = 4_000
+_MAP_DIRS = 40
+_MAP_FILES_HOT = 12
+_MAP_FILES_COLD = 3
+
# Extensions worth indexing: source, config, and docs. Binaries and media are
# never what someone points a coding agent at.
_INTERESTING_SUFFIXES = frozenset(
{
- ".py", ".pyi", ".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ".vue", ".svelte",
- ".rs", ".go", ".java", ".kt", ".swift", ".c", ".h", ".cc", ".cpp", ".hpp",
- ".cs", ".rb", ".php", ".sh", ".ps1", ".bat", ".sql", ".graphql", ".proto",
- ".toml", ".yaml", ".yml", ".json", ".ini", ".cfg", ".env.example",
- ".md", ".mdx", ".rst", ".txt", ".css", ".scss", ".html",
+ ".py",
+ ".pyi",
+ ".ts",
+ ".tsx",
+ ".js",
+ ".jsx",
+ ".mjs",
+ ".cjs",
+ ".vue",
+ ".svelte",
+ ".rs",
+ ".go",
+ ".java",
+ ".kt",
+ ".swift",
+ ".c",
+ ".h",
+ ".cc",
+ ".cpp",
+ ".hpp",
+ ".cs",
+ ".rb",
+ ".php",
+ ".sh",
+ ".ps1",
+ ".bat",
+ ".sql",
+ ".graphql",
+ ".proto",
+ ".toml",
+ ".yaml",
+ ".yml",
+ ".json",
+ ".ini",
+ ".cfg",
+ ".env.example",
+ ".md",
+ ".mdx",
+ ".rst",
+ ".txt",
+ ".css",
+ ".scss",
+ ".html",
}
)
@@ -77,32 +124,203 @@ _KEEP_HIDDEN = frozenset({".claude", ".agents", ".github"})
_STOPWORDS = frozenset(
{
# structural / generic
- "the", "a", "an", "and", "or", "of", "in", "on", "at", "to", "for", "with",
- "der", "die", "das", "den", "dem", "des", "und", "oder", "von", "im",
- "auf", "für", "fuer", "mit", "bei", "zum", "zur", "el", "la", "los", "las",
- "de", "del", "y", "o", "con", "para", "por",
+ "the",
+ "a",
+ "an",
+ "and",
+ "or",
+ "of",
+ "in",
+ "on",
+ "at",
+ "to",
+ "for",
+ "with",
+ "der",
+ "die",
+ "das",
+ "den",
+ "dem",
+ "des",
+ "und",
+ "oder",
+ "von",
+ "im",
+ "auf",
+ "für",
+ "fuer",
+ "mit",
+ "bei",
+ "zum",
+ "zur",
+ "el",
+ "la",
+ "los",
+ "las",
+ "de",
+ "del",
+ "y",
+ "o",
+ "con",
+ "para",
+ "por",
# question words / auxiliaries — pure conversational scaffolding
- "was", "wer", "wie", "wo", "wann", "warum", "welche", "welcher", "welches",
- "ist", "sind", "war", "waren", "hat", "haben", "wird", "werden", "kann",
- "soll", "sollte", "muss", "gibt", "gib", "dass", "wenn", "aber", "auch",
- "noch", "schon", "nur", "sich", "sein", "seine", "ihre", "einen", "eine",
- "einer", "eines", "etwas", "irgendwas", "irgendwie", "dann", "denn",
- "what", "who", "how", "where", "when", "why", "which", "is", "are",
- "were", "has", "have", "will", "would", "should", "must", "can", "does",
- "this", "that", "these", "those", "there", "here", "some", "any", "about",
- "qué", "que", "quien", "cómo", "como", "donde", "cuando", "cual", "está",
- "estan", "tiene", "puede", "debe", "esto", "eso", "aqui", "algo",
+ "was",
+ "wer",
+ "wie",
+ "wo",
+ "wann",
+ "warum",
+ "welche",
+ "welcher",
+ "welches",
+ "ist",
+ "sind",
+ "war",
+ "waren",
+ "hat",
+ "haben",
+ "wird",
+ "werden",
+ "kann",
+ "soll",
+ "sollte",
+ "muss",
+ "gibt",
+ "gib",
+ "dass",
+ "wenn",
+ "aber",
+ "auch",
+ "noch",
+ "schon",
+ "nur",
+ "sich",
+ "sein",
+ "seine",
+ "ihre",
+ "einen",
+ "eine",
+ "einer",
+ "eines",
+ "etwas",
+ "irgendwas",
+ "irgendwie",
+ "dann",
+ "denn",
+ "what",
+ "who",
+ "how",
+ "where",
+ "when",
+ "why",
+ "which",
+ "is",
+ "are",
+ "were",
+ "has",
+ "have",
+ "will",
+ "would",
+ "should",
+ "must",
+ "can",
+ "does",
+ "this",
+ "that",
+ "these",
+ "those",
+ "there",
+ "here",
+ "some",
+ "any",
+ "about",
+ "qué",
+ "que",
+ "quien",
+ "cómo",
+ "como",
+ "donde",
+ "cuando",
+ "cual",
+ "está",
+ "estan",
+ "tiene",
+ "puede",
+ "debe",
+ "esto",
+ "eso",
+ "aqui",
+ "algo",
# request verbs (they say what to DO, not which file)
- "mach", "mache", "machen", "bau", "baue", "schreib", "schreibe", "fix",
- "fixe", "behebe", "prüf", "pruef", "prüfe", "check", "checke", "teste",
- "test", "starte", "start", "build", "write", "make", "run", "change",
- "create", "add", "remove", "delete", "look", "read", "find", "search",
- "review", "analyse", "analyze", "analysiere", "untersuche", "schau",
- "haz", "escribe", "crea", "revisa", "arregla",
+ "mach",
+ "mache",
+ "machen",
+ "bau",
+ "baue",
+ "schreib",
+ "schreibe",
+ "fix",
+ "fixe",
+ "behebe",
+ "prüf",
+ "pruef",
+ "prüfe",
+ "check",
+ "checke",
+ "teste",
+ "test",
+ "starte",
+ "start",
+ "build",
+ "write",
+ "make",
+ "run",
+ "change",
+ "create",
+ "add",
+ "remove",
+ "delete",
+ "look",
+ "read",
+ "find",
+ "search",
+ "review",
+ "analyse",
+ "analyze",
+ "analysiere",
+ "untersuche",
+ "schau",
+ "haz",
+ "escribe",
+ "crea",
+ "revisa",
+ "arregla",
# meta words about the code itself
- "code", "datei", "dateien", "file", "files", "funktion", "function",
- "klasse", "class", "modul", "module", "bug", "fehler", "error", "problem",
- "sache", "thing", "stuff", "part", "teil", "mal", "bitte", "kurz", "nochmal",
+ "code",
+ "datei",
+ "dateien",
+ "file",
+ "files",
+ "funktion",
+ "function",
+ "klasse",
+ "class",
+ "modul",
+ "module",
+ "bug",
+ "fehler",
+ "error",
+ "problem",
+ "sache",
+ "thing",
+ "stuff",
+ "part",
+ "teil",
+ "mal",
+ "bitte",
+ "kurz",
+ "nochmal",
}
)
@@ -147,14 +365,23 @@ class FileIndex:
return []
wants_tests = bool(wanted & {"test", "tests", "spec", "specs"})
wants_docs = bool(
- wanted & {"doc", "docs", "documentation", "readme", "report", "spec",
- "dokumentation", "bericht", "documentacion", "informe"}
+ wanted
+ & {
+ "doc",
+ "docs",
+ "documentation",
+ "readme",
+ "report",
+ "spec",
+ "dokumentation",
+ "bericht",
+ "documentacion",
+ "informe",
+ }
)
scored: list[tuple[float, int, int, str]] = []
for entry in self.entries:
- score = _score(
- entry, wanted, wants_tests=wants_tests, wants_docs=wants_docs
- )
+ score = _score(entry, wanted, wants_tests=wants_tests, wants_docs=wants_docs)
if score > 0:
# Shorter paths win ties: the top-level `config.py` is far more
# likely meant than a same-named file nested six levels deep.
@@ -170,6 +397,68 @@ class FileIndex:
scored.sort(key=lambda item: (-item[0], -item[1], -item[2], item[3]))
return [rel for _s, _d, _sz, rel in scored[: max(1, limit)]]
+ def render_map(self, text: str = "", *, max_chars: int = _MAP_CHARS) -> str:
+ """A compact tree the prompt writer can actually pick files from.
+
+ Lexical ``suggest`` is a hint, not understanding: "when prompting a
+ terminal takes too long" never names ``prompt_composer.py``. The writer
+ needs to *see* the layout — directories and the files in the ones that
+ fit the request — and choose. Built from the cached walk, no extra
+ disk. Bounded so a 1 s Flash call can read it.
+ """
+ if not self.entries:
+ return ""
+ wanted = tokenize(text)
+ by_dir: dict[str, list[_Entry]] = {}
+ for entry in self.entries:
+ parent = entry.rel.rsplit("/", 1)[0] if "/" in entry.rel else ""
+ by_dir.setdefault(parent, []).append(entry)
+
+ def _dir_score(dirname: str, files: list[_Entry]) -> float:
+ name_hits = len(tokenize(dirname.replace("/", " ")) & wanted) if wanted else 0
+ file_hits = 0
+ if wanted:
+ for item in files:
+ if item.stem_tokens & wanted or item.path_tokens & wanted:
+ file_hits += 1
+ # Shallower packages first when the query does not name a dir:
+ # ``jarvis/`` is a better glance than a nested fixture folder.
+ depth = dirname.count("/") + (1 if dirname else 0)
+ return name_hits * 4.0 + file_hits * 1.5 - 0.15 * depth
+
+ ranked = sorted(
+ by_dir.items(),
+ key=lambda kv: (-_dir_score(kv[0], kv[1]), kv[0]),
+ )
+ lines: list[str] = []
+ used = 0
+ for index, (dirname, files) in enumerate(ranked):
+ if index >= _MAP_DIRS:
+ break
+ score = _dir_score(dirname, files)
+ hot = bool(wanted) and score >= 2.0
+ cap = _MAP_FILES_HOT if (hot or not wanted and index < 16) else _MAP_FILES_COLD
+ files_sorted = sorted(
+ files,
+ key=lambda item: (
+ -(len(item.stem_tokens & wanted) if wanted else 0),
+ -item.size,
+ item.rel,
+ ),
+ )
+ header = f"{dirname}/" if dirname else "./"
+ shown = files_sorted[:cap]
+ names = [item.rel.rsplit("/", 1)[-1] for item in shown]
+ extra = len(files) - len(shown)
+ line = f"{header} {' '.join(names)}"
+ if extra > 0:
+ line += f" (+{extra})"
+ if used + len(line) + 1 > max_chars:
+ break
+ lines.append(line)
+ used += len(line) + 1
+ return "\n".join(lines)
+
def _singular(token: str) -> str:
"""Fold a trailing plural ``s`` so speech matches file names.
@@ -212,9 +501,7 @@ def tokenize(text: str) -> set[str]:
return out
-def _score(
- entry: _Entry, wanted: set[str], *, wants_tests: bool, wants_docs: bool
-) -> float:
+def _score(entry: _Entry, wanted: set[str], *, wants_tests: bool, wants_docs: bool) -> float:
"""How strongly this file answers to the words the user used."""
stem_hits = entry.stem_tokens & wanted
path_hits = (entry.path_tokens - entry.stem_tokens) & wanted
@@ -343,9 +630,7 @@ def build_index(root: str | Path) -> FileIndex:
or stem.lower().endswith(("_test", ".test", ".spec"))
),
is_doc=_is_doc(rel, name),
- dir_names=frozenset(
- part.lower() for part in parent.split("/") if part
- ),
+ dir_names=frozenset(part.lower() for part in parent.split("/") if part),
size=_entry_size(item),
)
)
diff --git a/jarvis/agentic_ide/prompt_blueprint.py b/jarvis/agentic_ide/prompt_blueprint.py
index 326e6c004f..7b16edf03f 100644
--- a/jarvis/agentic_ide/prompt_blueprint.py
+++ b/jarvis/agentic_ide/prompt_blueprint.py
@@ -153,10 +153,11 @@ and discover the current code itself.
- Aim for {TARGET_MIN_CHARS}-{TARGET_MAX_CHARS} characters, never over \
{MAX_BODY_CHARS}. Length comes from a clean task and a concrete Key files \
list, never from restating the files' internals, hedging or dictated steps.
-- `@path` references only inside `## Key files`, only from the candidate list, \
-each with one short reason. Never end the prompt on an `@path` or `/command` \
-- a trailing reference holds the agent's completion popup open and the prompt \
-is never submitted.
+- `@path` references only inside `## Key files`, only paths that appear in the \
+workspace tree (join a directory header with the file name under it), each \
+with one short reason. Never invent a path. Never end the prompt on an \
+`@path` or `/command` - a trailing reference holds the agent's completion \
+popup open and the prompt is never submitted.
- ENGLISH, whatever language the user spoke.
- Preserve every constraint, file, symbol and intent expressed; drop speech \
artefacts and the clause addressing the agent by name.
@@ -307,6 +308,7 @@ def user_block(
house_rules: str,
attachments: list | None = None,
conversation: Sequence[tuple[str, str]] | None = None,
+ tree: str = "",
) -> str:
"""Everything the composer knows, laid out for one model call.
@@ -336,6 +338,13 @@ def user_block(
)
parts.append(_ATTACHMENT_RULES)
+ if tree:
+ parts.append(
+ "WORKSPACE TREE (repo-relative; a directory header plus the files "
+ "under it. Pick Key files from HERE - join header + name to form "
+ "@path. Do not invent paths, do not open files, the agent will)\n" + tree
+ )
+
if skeletons:
outlines = "\n\n".join(
f'<file path="{path}">\n{text}\n</file>' for path, text in skeletons.items()
@@ -345,14 +354,22 @@ def user_block(
"real symbols instead of describing code vaguely)\n" + outlines
)
- candidate_block = (
- "\n".join(f"- {c}" for c in candidates)
- if candidates
- else "(no candidate files matched - omit the Key files section)"
- )
- parts.append(
- "CANDIDATE FILES (repo-relative; use only these in @ references)\n" + candidate_block
- )
+ if tree:
+ if candidates:
+ parts.append(
+ "SPOKEN WORDS ALREADY POINTED AT (hints from the names, not a "
+ "limit - the tree above is the real map)\n"
+ + "\n".join(f"- {c}" for c in candidates)
+ )
+ else:
+ candidate_block = (
+ "\n".join(f"- {c}" for c in candidates)
+ if candidates
+ else "(no candidate files matched - omit the Key files section)"
+ )
+ parts.append(
+ "CANDIDATE FILES (repo-relative; use only these in @references)\n" + candidate_block
+ )
spoken = conversation_module.render(conversation or ())
if spoken:
diff --git a/jarvis/agentic_ide/prompt_composer.py b/jarvis/agentic_ide/prompt_composer.py
index d49f87c215..b8b35bc930 100644
--- a/jarvis/agentic_ide/prompt_composer.py
+++ b/jarvis/agentic_ide/prompt_composer.py
@@ -700,16 +700,20 @@ async def _llm_compose(
async def _read_context(
session, # noqa: ANN001 - Session, avoid an import cycle
- candidates: list[str],
-) -> tuple[dict[str, str], str]:
- """No file bodies. Candidate paths travel separately in the user block.
+ instruction: str,
+) -> tuple[str, dict[str, str]]:
+ """The workspace tree, from the cached walk. No file bodies.
Kept as an awaitable so cancellation still reaps a sibling task, and so
- tests can patch this hook. Production reads nothing: the tree index
- already picked the paths, and the agent opens them.
+ tests can patch this hook. The index was built when the folder opened;
+ rendering the map is in-memory.
"""
- del session, candidates
- return {}, ""
+ from .file_index import cached_index
+
+ index = cached_index(getattr(session, "folder", "") or "")
+ if index is None:
+ return "", {}
+ return index.render_map(instruction), {}
async def _compose_once(
@@ -722,7 +726,7 @@ async def _compose_once(
agent_display: str,
candidates: list[str],
kind: str,
- context, # noqa: ANN001 - Awaitable[tuple[dict[str, str], str]]
+ context, # noqa: ANN001 - Awaitable[tuple[str, dict[str, str]]]
notify: Callable[[str, str], None],
attachments: list,
conversation: Sequence[tuple[str, str]],
@@ -736,7 +740,10 @@ async def _compose_once(
"""
from . import prompt_blueprint as blueprint
- outlines, house_rules = await context
+ packed = await context
+ tree, outlines = packed if isinstance(packed[0], str) else ("", packed[0])
+ if not isinstance(outlines, dict):
+ outlines = {}
notify(
STAGE_THINKING,
@@ -759,9 +766,10 @@ async def _compose_once(
profile_lines=session.profile.summary_lines(),
candidates=candidates,
skeletons=outlines,
- house_rules=house_rules,
+ house_rules="",
attachments=attachments,
conversation=conversation,
+ tree=tree,
),
on_first_delta=lambda: notify(
STAGE_DRAFTING,
@@ -954,8 +962,8 @@ async def _compose_after_start(
notify(STAGE_FALLBACK, f"{terminal_name} gets the plain brief instead: {note}.")
return deterministic("fallback", note, candidates=candidates)
- # Candidate paths are enough; file bodies stay out (see `_read_context`).
- context_task = asyncio.create_task(_read_context(session, candidates))
+ # The tree is in-memory (the walk already ran when the folder opened).
+ context_task = asyncio.create_task(_read_context(session, subject))
try:
writer, writer_source = (
diff --git a/tests/unit/agentic_ide/test_composer_hedge.py b/tests/unit/agentic_ide/test_composer_hedge.py
index d9e4b639d5..ef1e318ee0 100644
--- a/tests/unit/agentic_ide/test_composer_hedge.py
+++ b/tests/unit/agentic_ide/test_composer_hedge.py
@@ -302,7 +302,7 @@ async def test_cancelling_compose_mid_resolution_reaps_the_context_read(
except asyncio.CancelledError:
ctx_reaped.set()
raise
- return {}, ""
+ return "", {}
def _slow_resolve() -> tuple[object, str]:
hold.wait(timeout=5.0)
diff --git a/tests/unit/agentic_ide/test_file_index.py b/tests/unit/agentic_ide/test_file_index.py
index 4d85055f7e..3344c2b9ab 100644
--- a/tests/unit/agentic_ide/test_file_index.py
+++ b/tests/unit/agentic_ide/test_file_index.py
@@ -6,6 +6,7 @@ repo first, a plural that never matches, or a walk that never terminates. Each
gets a test here because none of them would show up as an error — just as an
agent that starts by searching for the file you already named.
"""
+
from __future__ import annotations
from pathlib import Path
@@ -30,7 +31,9 @@ def repo(tmp_path: Path) -> Path:
(tmp_path / "node_modules" / "pkg").mkdir(parents=True)
(tmp_path / "node_modules" / "pkg" / "turn_language.py").write_text("x")
(tmp_path / ".claude" / "worktrees" / "old" / "jarvis" / "core").mkdir(parents=True)
- (tmp_path / ".claude" / "worktrees" / "old" / "jarvis" / "core" / "turn_language.py").write_text("x")
+ (
+ tmp_path / ".claude" / "worktrees" / "old" / "jarvis" / "core" / "turn_language.py"
+ ).write_text("x")
(tmp_path / "logo.png").write_bytes(b"\x89PNG")
return tmp_path
@@ -74,10 +77,34 @@ def test_implementation_outranks_its_test_unless_tests_are_asked_for(
def test_conversational_scaffolding_matches_nothing(repo: Path) -> None:
- """"was ist das" carries no addressing power and must not rank a file."""
+ """ "was ist das" carries no addressing power and must not rank a file."""
assert index_suggest(repo, "was ist das denn") == []
+def test_render_map_puts_the_named_file_in_its_directory(repo: Path) -> None:
+ mapped = file_index.build_index(repo).render_map("schau dir den vosk wake provider an")
+ assert "jarvis/plugins/wake/" in mapped
+ assert "vosk_kws_provider.py" in mapped
+
+
+def test_render_map_still_shows_the_tree_when_words_match_nothing(
+ repo: Path,
+) -> None:
+ """Lexical suggest is a hint. The writer has to see the layout even when
+ the spoken sentence names no file — otherwise attaching files is a guess
+ from five overlapping names."""
+ index = file_index.build_index(repo)
+ assert index.suggest("it takes too long after I speak") == []
+ mapped = index.render_map("it takes too long after I speak")
+ assert "jarvis/plugins/wake/" in mapped
+ assert "vosk_kws_provider.py" in mapped
+
+
+def test_render_map_stays_inside_its_character_budget(repo: Path) -> None:
+ mapped = file_index.build_index(repo).render_map("wake", max_chars=80)
+ assert len(mapped) <= 80
+
+
def index_suggest(root: Path, text: str) -> list[str]:
return file_index.build_index(root).suggest(text, limit=3)
@@ -106,7 +133,7 @@ def test_cache_is_per_folder_and_clearable(repo: Path) -> None:
# composed prompt then told the agent the code "needs to be discovered" — which
# is the job the file index exists to do.
def test_a_compound_product_name_finds_its_own_package(tmp_path: Path):
- """"UltraWiki" splits to ultra+wiki; the directory is one word, `ultrawiki`.
+ """ "UltraWiki" splits to ultra+wiki; the directory is one word, `ultrawiki`.
Those never met, so the package was unreachable by the name people write.
"""
@@ -145,7 +172,7 @@ def test_source_outranks_a_report_that_merely_shares_the_words(tmp_path: Path):
def test_naming_a_package_pulls_in_its_siblings(tmp_path: Path):
- """"Review the ultrawiki ranking" should reach the neighbouring modules,
+ """ "Review the ultrawiki ranking" should reach the neighbouring modules,
not only the one file whose stem happens to match."""
pkg = tmp_path / "jarvis" / "ultrawiki"
pkg.mkdir(parents=True)
@@ -161,9 +188,7 @@ def test_naming_a_package_pulls_in_its_siblings(tmp_path: Path):
# The same-named file in an unrelated package must not crowd them out —
# being absent entirely is the better outcome, so only its ORDER is pinned.
if "jarvis/speech/pipeline.py" in hits:
- assert hits.index("jarvis/ultrawiki/pipeline.py") < hits.index(
- "jarvis/speech/pipeline.py"
- )
+ assert hits.index("jarvis/ultrawiki/pipeline.py") < hits.index("jarvis/speech/pipeline.py")
def test_a_documentation_request_still_reaches_documentation(tmp_path: Path):
diff --git a/tests/unit/agentic_ide/test_prompt_blueprint.py b/tests/unit/agentic_ide/test_prompt_blueprint.py
index 067cb99ceb..3d74da2667 100644
--- a/tests/unit/agentic_ide/test_prompt_blueprint.py
+++ b/tests/unit/agentic_ide/test_prompt_blueprint.py
@@ -195,6 +195,27 @@ def test_user_block_puts_the_request_after_the_longform_data():
assert block.rstrip().endswith("Write the prompt now.")
+def test_user_block_carries_the_workspace_tree_as_the_file_map():
+ """The writer picks @files from the tree, not from five lexical hits."""
+ block = user_block(
+ utterance="the terminal prompt is too slow",
+ instruction="the terminal prompt is too slow",
+ terminal_name="T4",
+ agent_display="Claude Code",
+ profile_lines=["Folder: /repo"],
+ candidates=["jarvis/agentic_ide/prompt_history.py"],
+ skeletons={},
+ house_rules="",
+ tree="jarvis/agentic_ide/ prompt_composer.py file_index.py session.py",
+ )
+
+ assert "WORKSPACE TREE" in block
+ assert "prompt_composer.py" in block
+ assert "SPOKEN WORDS ALREADY POINTED AT" in block
+ assert "use only these in @references" not in block
+ assert block.index("WORKSPACE TREE") < block.index("WHAT THE USER SAID")
+
+
def test_user_block_survives_having_nothing_to_offer():
block = user_block(
utterance="do the thing",
diff --git a/tests/unit/agentic_ide/test_prompt_composer.py b/tests/unit/agentic_ide/test_prompt_composer.py
index 81ba7a70dc..ab6e4381f2 100644
--- a/tests/unit/agentic_ide/test_prompt_composer.py
+++ b/tests/unit/agentic_ide/test_prompt_composer.py
@@ -286,7 +286,9 @@ async def test_the_writer_gets_candidate_paths_not_file_bodies(
"review the vosk wake provider", session=workspace, terminal_name="Kai"
)
- assert "jarvis/plugins/wake/vosk_kws_provider.py" in seen["user"]
+ assert "WORKSPACE TREE" in seen["user"]
+ assert "jarvis/plugins/wake/" in seen["user"]
+ assert "vosk_kws_provider.py" in seen["user"]
assert "FILE OUTLINES" not in seen["user"]
assert "candidate_shape_ok" not in seen["user"]
# House rules stay out: the receiving agent already has them.