Skip to content

ollama_integration test suite has ~17 failing tests due to empty tool-call responses from mistral:7b - #1635

Merged
malibio merged 3 commits into
mainfrom
worktree-issue-1632-ollama-flaky-tests
Jul 12, 2026
Merged

malibio merged 3 commits into
mainfrom
worktree-issue-1632-ollama-flaky-tests

Conversation

@malibio

@malibio malibio commented Jul 11, 2026

Copy link
Copy Markdown
Collaborator

Closes #1632

…stral:7b tool-count ceiling (closes #1632)

Root-caused the ~17 failing tests via direct Ollama API testing bypassing
all NodeSpace code: mistral:7b deterministically fails to emit structured
tool_calls once ~6+ tools are offered in one turn, narrating the call as
prose instead. Confirmed via model-size comparison (ministral-3:3b fails
worse, ornith:9b/mistral-nemo:12b succeed) that this scales with model
size, not prompt content. Also fixed resolve_engine()'s reliance on
first_ollama_model() (non-deterministic across machines) by pinning to
mistral:7b explicitly, and corrected one assertion in
test_skill_pipeline_organization_real_model that was stricter than the
real Organization skill's tool_whitelist.

Tests hitting the verified ceiling are #[ignore]d with detailed reasons
rather than deleted or silently passing — they document real expected
behavior and will re-activate if the model/architecture changes.

Co-Authored-By: Claude <[email protected]>
@malibio

malibio commented Jul 11, 2026

Copy link
Copy Markdown
Collaborator Author

Code Review Summary

Review type: Initial review (no prior reviews/comments on PR #1635).

This is a well-executed triage of a flaky/failing integration test suite. The implementer did real root-cause work — verified via raw Ollama API calls bypassing NodeSpace code, cross-checked with model-size comparisons (3B/7B fail, 9B/12B succeed) — rather than reflexively slapping #[ignore] on red tests. All four of issue #1632's acceptance criteria are met. One correctness issue in the diff is worth flagging before merge (a stray #[ignore] reason string typo), plus one pre-existing convention violation this PR's own new doc comment perpetuates.

Requirements Check (issue #1632)

  • Root cause identified — mistral:7b narrates tool calls as prose once ~6+ tools are offered in a single turn; verified independently of NodeSpace code and confirmed via model-size comparison.
  • Failing tests triaged — all 17 originally-listed failures are accounted for: 13 marked #[ignore] with specific reasons, 1 (test_skill_pipeline_organization_real_model) had its assertion corrected, others pass now that the model is pinned deterministically.
  • Suite passes reliably — confirmed by the main agent across two consecutive full runs (16 passed / 0 failed / 13 ignored).
  • No regression elsewhere — cargo test -p nodespace-agent (291 passed) and full bun run test:all both green; this is the only file touched.

Findings

Critical Issues

None.

Important

  • packages/agent/tests/ollama_integration.rs:721 — test_skill_pipeline_research_real_model's #[ignore] reason claims the failure occurs "even with only 3 tools offered," but tools_for_skill("Research & Search", ...) scopes to whatever seed_skill_nodes() whitelists for that skill, and the module doc comment's stated ceiling is "~6+ tools." If the Research skill's whitelist is genuinely 3 tools, this is a second, distinct model-capability failure mode (ambiguous-phrasing narration failure, not a tool-count ceiling) and deserves to be called out as such rather than folded into the "6+ tools" framing implied by the rest of the file — right now a maintainer skimming reasons will assume all 13 ignores share one root cause when this one doesn't. Worth a quick check that "3 tools" is accurate and, if so, a one-clause disambiguation (e.g., "distinct from the 6+-tool ceiling — fails even at low tool count on ambiguous phrasing").

  • Doc-comment issue-number references (pre-existing, not newly introduced, but touching this territory) — documentation.md's "no issue refs" rule explicitly states "the same rule applies to source-code comments." Lines 333 (issue #1443) and 463 (Issue #1057) already violated this before the PR and are untouched by the diff, so this isn't a blocking issue for this PR. However, the new module doc comment this PR adds sits directly above/beside that pattern and includes "see the linked follow-up issue for tracking" (line 40) — a live instance of exactly the anti-pattern the convention exists to prevent (a doc comment pointing at a ticket instead of describing the constraint directly). Since this PR is already touching this doc block extensively, it's a reasonable time to either inline the actual constraint (why ornith:9b can't reuse KV-cache across ReAct iterations) or drop the "see issue" pointer — leaving a dangling forward-reference to an issue number not present anywhere in this codebase is the kind of stale-link risk the convention is trying to avoid.

Suggested Improvements

  • PINNED_OLLAMA_MODEL vs. first_ollama_model() coexistence — confirmed correct, not an oversight: resolve_engine() (used by all 13 ignored tests + the 6 non-ignored skill-pipeline tests, i.e. everything that depends on tool-calling behavior) always pins to mistral:7b. first_ollama_model() is retained only for 5 earlier tests (test_ollama_inference_generate, test_ollama_inference_with_tools, test_ollama_inference_with_production_prompt, test_ollama_model_info_context_window_detection, test_ollama_model_info) that assert on generic inference/metadata behavior, not tool-call structure — those genuinely don't care which model runs. No action needed, but a one-line note in the module doc comment ("first_ollama_model() remains in use for tests that don't depend on tool-calling structure") would save the next reader from re-deriving this distinction, since the PR description anticipated this exact question.

  • Coverage erosion via #[ignore] — 15 of 29 tests in the file are now #[ignore]d (52%, using grep -c '#\[ignore'; note the issue description's own "~17 failing" estimate and any "45%" framing undercounts slightly). Since this suite isn't part of any CI gate, #[ignore]d tests here don't rot in the sense of silently failing in CI (they were never run there) — but they can rot in the sense of nobody manually re-running them, so an actual future model upgrade or tool-scoping fix that resolves the underlying ceiling would go undetected indefinitely. Given the issue's explicit non-goal ("not proposing to add this suite to any CI gate"), this is an accepted trade-off rather than a defect, but it's worth a lightweight follow-up habit (e.g., re-run --ignored when the default Ollama model changes) rather than leaving these as permanently-ignored dead weight.

Nitpicks

  • Nit: The 13 #[ignore] reason strings use two templated variants verbatim (the "unscoped 10-tool StubToolExecutor set" ceiling and the "multi-field structured create_schema args" ceiling), each restating "Verified deterministic (not flaky) via raw Ollama API calls bypassing all NodeSpace code" nearly word-for-word 13 times. This is intentional redundancy for cargo test -- --ignored --list scannability (each reason is self-contained without needing the module doc comment open), which is a defensible choice for CI-adjacent tooling, but a maintainer reading the file top-to-bottom will find it repetitive. Not worth churning now — flagging only because it's the kind of thing that invites a "let's DRY this up" drive-by refactor later; a shared const string fragment interpolated per-test would preserve scannability while cutting duplication if that ever becomes annoying.

  • Nit: packages/agent/tests/ollama_integration.rs:32-44 — the "Evidence gathered" paragraph mixes investigation findings (model-size comparison) with unrelated production-model-picker rationale (ornith:9b KV-cache exclusion) and a memory-pressure OOM tangent. Consider splitting into "why mistral:7b specifically" vs. "why not the alternatives" for skimmability, though this is a judgment call and the current version is not hard to follow.

Recommendation: APPROVE

Net positive and well above the bar for a test-triage change: genuine root-cause investigation (not just silencing red tests), an assertion fix verified against the actual tool_whitelist in seed_skill_nodes() (confirmed correct by reading packages/agent/src/skill_pipeline.rs:305 directly — the Organization skill's real whitelist is ["create_relationship", "get_node", "search_semantic", "search_nodes"], matching the widened assertion exactly), and no regressions. The two Important items above are not blockers — one is a pre-existing minor accuracy nit in a single ignore-reason string, the other is a pre-existing doc-comment convention gap this PR doesn't worsen in kind (only in surface area). Both are fine to leave as-is or address in this PR at the author's discretion.

…ing issue pointer

- test_skill_pipeline_research_real_model's ignore reason now explicitly
  distinguishes its low-tool-count phrasing-ambiguity failure from the
  6+-tool-count ceiling the other 12 ignored tests share, so a reader
  skimming reasons doesn't assume they're all the same root cause.
- Module doc comment no longer points at "the linked follow-up issue" for
  the ornith:9b KV-cache constraint — inlines the actual constraint
  instead, per this repo's no-issue-refs-in-doc-comments convention.
  Split the doc comment into "why mistral:7b" / "why not the larger
  alternatives" sections for skimmability, and added a one-line note on
  why first_ollama_model() still coexists with the new pinned-model
  constant.

Addresses reviewer recommendations from PR #1635 review.

Co-Authored-By: Claude <[email protected]>
@malibio

malibio commented Jul 11, 2026

Copy link
Copy Markdown
Collaborator Author

Addressed Review Feedback

Both Important findings from the review addressed:

  1. test_skill_pipeline_research_real_model ignore-reason ambiguity — confirmed the "3 tools offered" figure is accurate for what this test actually sends (the seed's real tool_whitelist for Research & Search is 4 tools including execute_query, but the test harness's hand-written all_skill_tools() stub doesn't define execute_query, so only 3 make it through tools_for_skill). Reworded the reason string to explicitly flag this as a distinct low-tool-count phrasing-ambiguity failure, separate from the 6+-tool-count ceiling the other 12 ignored tests share, so a reader skimming --ignored --list output doesn't conflate the two root causes.

  2. Dangling issue-ref pointer in the new doc comment — removed "see the linked follow-up issue for tracking" and inlined the actual constraint (ornith:9b's recurrent/SSM layers can't reuse KV-cache across ReAct iterations, so multi-step turns re-decode the full prompt from scratch) directly, per this repo's no-issue-refs-in-doc-comments convention. Also split the doc comment into "why mistral:7b" / "why not the larger alternatives" subsections per the reviewer's skimmability suggestion, and added a one-line note explaining why first_ollama_model() still coexists with the new PINNED_OLLAMA_MODEL constant (used only by the 5 tests that assert on generic inference/metadata behavior where model identity doesn't matter).

Skipped (Suggestions/Nits, at my discretion per the reviewer's own framing as non-blocking):

  • Deduplicating the 13 near-identical ignore-reason strings into a shared const fragment — intentional redundancy for --ignored --list scannability, reviewer explicitly called this defensible.
  • Coverage-erosion tracking habit (re-run --ignored on future model changes) — process suggestion, not a code change; noted for future reference rather than actioned in this PR.

Re-ran the full suite after changes: still 16 passed, 0 failed, 13 ignored. bun run quality:fix clean. Pushed as d1843b10.

Re-Review Decision

NO RE-REVIEW NEEDED. Both changes are doc-comment/string wording only — no logic, assertions, or test behavior changed. Verified via a full re-run of cargo test -p nodespace-agent --test ollama_integration --features testing (same 16/0/13 result as before the edit) that nothing regressed.

…uests

Investigated a real bug surfaced while root-causing #1632: "list all my
invoices" (and similar no-filter listing requests) was routed to
execute_query, which either malforms its nested filter JSON or omits
required fields — because TOOL_STRATEGY_RULES's search_nodes/execute_query
split never covered the "type only, no property condition" case,
leaving the model to guess. Traced via NODESPACE_PROMPT_DUMP against the
real production prompt (not a synthetic reconstruction) — confirmed the
governing text lives in agent_guidance.rs, not skill_pipeline.rs.

Verified fix: aichat-matrix.ts against gemma-4-e4b-q4km went from 10/12
to 11/12, stable across two independent clean runs (isolated per-run
database, no shared state).

Also strengthened the search_nodes query-construction guidance for the
update-by-search case (mark X as paid) with an explicit one-word-only
rule and worked example — confirmed present verbatim in the actual
prompt sent to the model, but did not change model behavior on the one
remaining matrix failure (E4B still passes a full paraphrase as the
search query despite the explicit counter-example). Kept because it's
objectively more correct guidance even though this specific model
doesn't yet comply with it; documented as a known model limitation
rather than a prompt gap in issue #1637, which proposes a decomposition
step as the real fix.

Co-Authored-By: Claude <[email protected]>
@malibio

malibio commented Jul 11, 2026

Copy link
Copy Markdown
Collaborator Author

Re-Review: commit 7e85ffb (search_nodes/execute_query guidance fix)

Scope note: This is a re-review of the single new commit 7e85ffb2 ("Fix search_nodes-vs-execute_query guidance for unfiltered listing requests"), added after the prior review (recommend: APPROVE, findings addressed) which covered the packages/agent/tests/ollama_integration.rs triage work. This commit touches only packages/agent/src/agent_guidance.rs (2 lines changed) and is production prompt-guidance code, not test code. The prior review's scope and conclusion stand unchanged; this covers only the delta.

Summary

Clean, minimal, well-targeted change to two lines of TOOL_STRATEGY_RULES. Both edits are evidence-driven: change #1 (unfiltered-listing → search_nodes) is verified to fix a real routing bug via a real end-to-end eval harness (10/12 → 11/12, stable across two isolated runs). Change #2 (one-word-only query instruction) is verified present verbatim in the real production prompt via NODESPACE_PROMPT_DUMP, but honestly documented as not yet changing this model's behavior, with a real tracked follow-up issue (#1637) proposing the actual fix (query decomposition). This is a net positive change. No blocking issues found.

Findings

Critical Issues

None.

Verification of the five requested checks

  1. Wording clarity/consistency — Both additions match the file's established style: imperative, ALL-CAPS emphasis markers for hard constraints (LISTING ALL OF A TYPE WITH NO FILTER, ONE WORD ONLY), a worked example (consistent with e.g. the DATABASE\" = SCHEMA and ENUM FIELDS rules elsewhere in the same file), and inline parenthetical examples matching the surrounding bullets' density. Line 48 and line 52 are now visually long (~450 and ~640 chars) compared to neighboring bullets, but every bullet in this constant is already a single long line by convention (it's a \n\-continued string, not prose meant to be read as source) — consistent with existing style, not a new problem.

  2. Existing unit tests asserting on content — Checked agent_guidance.rs's own #[cfg(test)] module (lines 66-113). None of the four tests assert on the specific substrings that changed (they check "ALWAYS search_nodes first", "META QUESTIONS", "SCHEMA CLAIMS WITHOUT VERIFICATION", "IDENTICAL TOOL CALLS" — all untouched by this commit). Ran cargo test -p nodespace-agent agent_guidance — 4/4 pass, no update needed.

  3. Other consumers of TOOL_STRATEGY_RULES — Two: prompt_assembler.rs (local Ollama agent's seeded prompt nodes) and acp/context_assembly.rs (external-agent CLAUDE.md/AGENTS.md generation, gated by a 50,000-token DEFAULT_TOKEN_BUDGET). Checked both:

    • prompt_assembler.rs::seed_prompt_bodies_match_expected_bytes (line 415) does an exact-bytes comparison, but derives its expected value via format!("{}\n\n{}", SCHEMA_CREATION_RULES, TOOL_STRATEGY_RULES) from the live constants rather than a hardcoded literal — it self-updates and cannot drift. Ran it directly: passes.
    • prompt_assembler.rs::assembled_prompt_contains_full_tool_strategy_body (line 516) only asserts on unrelated needles ("TOOL STRATEGY:", "CLARIFICATION CONTRACT", etc.), none touched by this diff. Ran it: passes.
    • acp/context_assembly.rs (line 539) also builds guidance via live format!(), not a snapshot — no test there hardcodes the string either.
    • Token budget: the diff adds ~220 characters (~50-60 tokens) against a 50,000-token budget — negligible, and guidance_tokens is reserved off the top of the budget before other sections consume it (context_assembly.rs:546-547), so this can't cause guidance truncation.
    • cargo fmt -p nodespace-agent --check passes cleanly on the changed file.
  4. Is keeping change Create design system foundation #2 defensible despite not measurably helping? Yes. The commit message is explicit and honest about the outcome (verified present in the real prompt via NODESPACE_PROMPT_DUMP, but did not change behavior on the one remaining failing scenario), and files the actual fix as a separate tracked issue (resolve_query must return a resolved node, not query fragments #1637 — confirmed open, and its description matches: query decomposition for requests that bundle multiple implicit semantic decisions). This is the right call, not scope creep or wishful-thinking dead weight:

    • The instruction is objectively correct guidance regardless of whether this model complies with it — other/future models in the Ollama slot may well benefit.
    • It cost two sentences in an already-large prompt constant against a 50k-token budget — not a meaningful tax.
    • The alternative (reverting) would mean discarding verified-correct guidance because one specific quantized small model doesn't yet follow it — that's optimizing the source of truth for a single model's current limitation rather than fixing the actual gap (decomposition), which is exactly what resolve_query must return a resolved node, not query fragments #1637 targets.
    • The one risk worth naming: if resolve_query must return a resolved node, not query fragments #1637 lands and makes this line's guidance obsolete or redundant (e.g. decomposition removes the need for search_nodes to receive a raw user query at all), this line should be revisited then — not a blocker now, just a note for whoever picks up resolve_query must return a resolved node, not query fragments #1637.
  5. General diff quality — Clean and minimal: 2 lines changed, no unrelated edits, no test files touched because none needed touching, commit message documents the verification methodology (real harness, real prompt dump, real isolated DB runs) rather than asserting success by fiat. This is exactly the kind of evidence trail that should accompany a change to a prompt string that has no compile-time contract — the actual behavior only shows up at inference time.

Suggested Improvements

None blocking. Optional for a future pass: consider whether execute_query's own docstring/tool-schema description (not reviewed here — out of scope for this file) should also mention the "no filter → don't use me" guidance redundantly, in case a future model reads tool schemas more carefully than system-prompt bullets. Not required for this PR.

Nitpicks

  • Nit: packages/agent/src/agent_guidance.rs:48,52 — the two changed bullets are now among the longest in the file (~450/~640 chars). Not a real problem given the file's existing convention of single-line bullets, but if this constant keeps growing, it may be worth revisiting whether TOOL_STRATEGY_RULES should be decomposed into named sub-constants (search-tool-selection, mutation-flow, etc.) for easier targeted review in future diffs. Not blocking here.

Recommendation

APPROVE. This commit is a well-evidenced, narrowly-scoped fix to production prompt guidance. Both changes are verified through real end-to-end mechanisms (harness pass-rate delta, prompt-dump inspection) rather than asserted by inspection alone, no existing tests needed updates (confirmed by running them), no other consumer of the changed constant is put at risk (confirmed via token-budget and exact-bytes-test analysis), and the one change that didn't measurably help is transparently documented with a real tracked follow-up rather than silently left in or silently dropped.

@malibio malibio left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review of commit 7e85ffb (agent_guidance.rs prompt fix) — recommendation: APPROVE (GitHub blocks self-approval since I'm the PR author's account; posting as a review comment instead). Full analysis in the PR comment above. Ran the relevant Rust tests directly (agent_guidance, seed_prompt_bodies_match_expected_bytes, assembled_prompt_contains_full_tool_strategy_body — all pass, no updates needed), verified no other consumer of TOOL_STRATEGY_RULES is at risk (both prompt_assembler.rs and context_assembly.rs derive expected content live via format!(), not hardcoded snapshots), confirmed the token-budget headroom is trivially sufficient, and confirmed issue #1637 (cited as the tracked follow-up for the guidance that didn't measurably change model behavior) is real, open, and on-topic. No blocking issues.

@malibio
malibio merged commit 4c18e58 into main Jul 12, 2026
@malibio
malibio deleted the worktree-issue-1632-ollama-flaky-tests branch July 12, 2026 00:09
malibio added a commit that referenced this pull request Jul 12, 2026
## Completed in This Session

Section 3 (propagation tooling) is fully done, reviewed, and address-reviewed.

- 2476e8a — built the drift-prevention mechanism between seed_skill_nodes()
  (packages/agent/src/skill_pipeline.rs) and packages/skill/SKILL.md for the
  ~16 rules they share in substance (schema-authoring conventions +
  interaction habits), despite being different products for different
  audiences (in-app instance-aware local agent vs. static instance-blind
  CLI reference shipped in @nodespaceai/skill). New
  packages/agent/src/skill_rules.rs holds SchemaRule (9) and InteractionRule
  (7) constants, each rendered two ways (imperative LLM-prompt style, prose
  SKILL.md style). New packages/agent/src/bin/gen_skill_md.rs regenerates
  SKILL.md's schema-rules block (--write) and fails CI if it's stale
  (--check) — real generation, not just a parity test, since SKILL.md is
  meant to reflect current core capabilities at build time. The 7
  interaction rules get a lighter presence-check test instead (full
  generation would fragment hand-written CLI prose they're woven into).
  package.json's rust:test now also runs nodespace-agent's test suite —
  previously neither the new nor the preexisting skill_pipeline.rs tests
  were part of test:all/pre-push at all.
- 52ae5f6 — addressed /pragmatic-code-review (scoped to 2476e8a only,
  posted at github.com//pull/1633#issuecomment-4949281475).
  One real bug found and fixed: gen_skill_md.rs's "Editing" paragraph was
  hardcoded instead of interpolating EDIT_DONT_RECREATE.prose, so --check
  couldn't catch drift in that one rule — verified fixed using the
  reviewer's own repro. Two smaller improvements also fixed (restored
  verb-specific detail lost in one interpolation; added duplicate-marker
  guards to the generator's splice logic). No re-review needed — posted at
  github.com//pull/1633#issuecomment-4949295748.

## Current State

- Branch worktree-issue-1529-cli-skill-parity, PR #1633, up to date with
  origin, working tree clean, nothing uncommitted.
- Tests status: bun run rust:test green (979 nodespace-core + 295
  nodespace-agent lib + 3 gen_skill_md bin tests). cargo clippy -p
  nodespace-agent --lib --bins clean. cargo check --workspace clean. Both
  Section 3 commits went through the full pre-push gate successfully.
- Known issues: #1636 (ministral-3b-q4km stall) and #1632 (ollama_integration
  failures, being addressed separately per PR #1635 on main) remain open,
  unrelated to #1529, untouched this session.
- Dependencies: none blocking Section 4.

## Context for Next Session

Section 4 — PTY wiring — is the only remaining scope item for #1529. Not
started, not investigated at all yet: no design decisions made on how the
in-app PTY chat (Claude Code/Codex/Gemini CLI/OpenCode running inside
NodeSpace) actually consumes SKILL.md, whether that's the packages/skill
install flow (packages/skill/src/installer.ts copies shims but not SKILL.md
itself today — confirmed during Section 3 scoping) or a different
mechanism, and what "wiring" concretely means here. Start by reading the
open issue's Section 4 scope text plus packages/skill/src/installer.ts and
the shims/ directory, then evaluate approaches before implementing — same
pattern as Section 3's start.

## Acceptance Criteria Status

From #1529 Scope section 3 (propagation tooling): complete — see 2476e8a
and 52ae5f6 for the itemized implementation and review-fix list, not
repeated here.

Section 4 (PTY wiring): not started.

Co-Authored-By: Claude <[email protected]>
malibio added a commit that referenced this pull request Jul 12, 2026
… — Phase 1: CLI capability gap (#1633)

* WIP: #1529 Phase 1 — CLI capability gap (schema/query/relationship/task-status verbs)

## Completed in This Session
- [x] Phase 1: CLI capability gap — closes the "capability gap" half of #1529's
  scope section 1 (all 6 checklist items).

New/extended proto RPCs on NodeService (packages/proto/proto/node_service.proto):
  - CreateSchema / UpdateSchema (SchemaParamsRequest/SchemaResultResponse —
    JSON passthrough to handle_create_schema/handle_update_schema, same
    shape the local-agent tool call already uses; avoids duplicating the
    nested SchemaField/SchemaRelationship/FieldRename Rust structs as proto)
  - ExecuteQuery (ExecuteQueryRequest -> NodeListResponse — filters/sorting
    are JSON-encoded AgentFilterItem[]/AgentSortItem[] for the same reason)
  - CreateRelationship / GetRelatedNodes (typed relationships, distinct from
    mentions — CreateRelationshipRequest/Response, GetRelatedNodesRequest/Response)

Daemon handlers (packages/daemon/src/services/node_service.rs): thin wrappers
following the existing route()/ops_error_to_status pattern, delegating to
nodespace_core::schema::{handle_create_schema,handle_update_schema},
ops::query_ops::execute_query_nodes (new: query_ops::execute_query was split
into execute_query_nodes returning Vec<Node> + a thin execute_query wrapper
returning typed JSON, so the gRPC handler can reuse node_to_proto without
duplicating validation), and ops::rel_ops::{create_relationship,get_related_nodes}.
Added markdown_error_to_status for MarkdownError -> Status mapping.

CLI verbs (packages/cli/src/commands/):
  - schema.rs: `nodespace schema create/update --params <json>|--params-file <path>`
  - query.rs (new): `nodespace query --type <t> --filters <json> --sorting <json> --limit N`
    — distinct from the existing `nodespace node query` (exact-match only)
  - node.rs: `nodespace node update` now accepts `--property key=value` (repeatable,
    JSON-value-parsed, deep-merged server-side) alongside `--content` (now optional);
    added `nodespace node set-status <id> <status>` as a dedicated verb (goes through
    UpdateNode with properties={"status":...}, version=None auto-fetch — mirrors
    exec_update_task_status in local_agent/tools.rs exactly, NOT the separate
    UpdateTaskNode RPC, which has different required-version/richer-field semantics
    with no local-agent-tool equivalent)
  - relationship.rs (new): `nodespace relationship create --from --type --to [--edge-data]`
    and `nodespace relationship get <id> --type --direction`
  - search.rs: wired collection/collection_id/filters/threshold through to the
    already-existing SearchRequest proto fields (previously hardcoded to
    empty/None). Documented (in-file) that this is NOT full search_semantic
    parity — SearchSemanticInput's graph_boost/scope/exclude_collections/
    include_edges/include_markdown have no proto/RPC surface on NodeService
    today; that's EmbeddingsService.SearchSemantic, a separate RPC entirely.
    Decision recorded per the issue's "add flags or document the CLI subset"
    option — chose documentation over expanding proto surface in this phase.

Tests: 10 new integration tests in packages/cli/tests/cli_integration.rs
(schema create/update round trip + malformed-params rejection, execute_query
property filter, relationship create/get + invalid-direction rejection, node
update property-merge + empty-args rejection, node set-status + invalid-status
rejection), plus fixed 2 pre-existing tests broken by the UpdateArgs/SearchArgs
struct shape changes (content: String -> Option<String>, new fields).

## Remaining Work (per #1529 scope, NOT started this session)
- [ ] Section 2: Guidance alignment — rewrite SKILL.md's Tool Decision Guide in
  the new CLI verbs (remove execute_query/search_semantic daemon-tool naming
  the CLI can't invoke); port seed-node guidance (schema creation rules,
  title_template, enum conventions, find-then-edit, task status via dedicated
  verb) into SKILL.md against these new verbs.
- [ ] Section 3: Propagation tooling — staleness/parity check or generation
  step so seed-node refinements don't leave SKILL.md stale.
- [ ] Section 4: PTY wiring — wire in-app PTY chat to consume SKILL.md.
- [ ] Not done in this phase: full search_semantic parity (graph_boost, scope,
  exclude_collections, include_edges, include_markdown) — would need either a
  new CLI-reachable RPC on EmbeddingsService or extending SearchRequest.

## Current State
- Files modified: see file list above (proto, daemon, core/ops/query_ops.rs,
  cli commands + 2 new command files, cli integration tests)
- Tests status: All passing.
  - `bun run test`: 159 files / 4031 tests passed (frontend baseline, unchanged)
  - `cargo test -p nodespace-cli --test cli_integration`: 24/24 passed
  - `cargo test -p nodespace-core --lib query_ops`: 10/10 passed
  - `cargo test -p nodespace-daemon --lib node_service`: 27/27 passed
  - `cargo test --workspace --exclude nodespace-app --exclude nodespace-nlp-engine
    --exclude nodespace-agent`: all passed (0 failed)
  - `cargo test -p nodespace-agent --lib`: 291/291 passed
  - `bun run quality:fix`: clean (0 eslint/tsc/clippy/fmt issues)
- Known issues:
  - packages/agent/tests/ollama_integration.rs (requires `--features testing`
    + a live Ollama server) has ~17 pre-existing failures unrelated to this
    diff (zero files changed under packages/agent/). Verified identically
    reproducing on main at 4962856 before this session's changes — model
    (mistral:7b) intermittently returns empty tool-call responses. Not a
    regression; not investigated further as out of scope for this phase.
  - Found and worked around (not fixed — out of scope): explicit schema
    fields passed to create_schema/update_schema do NOT accept `custom:`
    namespace-prefixed names (behaviors::mod.rs validate_schema_field only
    allows alphanumeric+underscore, rejecting `:`), even though CLAUDE.md and
    the issue body both document `custom:propertyName` as the required
    namespace-prefix convention for explicit fields. The `custom:` prefix IS
    applied automatically, but only on the natural-language description-
    parsing path (normalize_and_namespace_fields), not for explicit `fields`
    arrays. This is a pre-existing packages/core discrepancy, not something
    introduced or fixed here — worth a follow-up issue since it directly
    affects the Section 2 guidance-alignment phase (SKILL.md would otherwise
    document a namespace convention explicit-field callers can't actually use).
- Dependencies: none blocking; #1496 (SchemaTableManager DDL removal),
  referenced by #1529 as a coordination point, is already closed.

## Context for Next Session
Proto/daemon/CLI capability gap (#1529 scope section 1) is fully closed — every
row in the issue's "Capability parity matrix" that was ❌/⚠️ is now ✅ except
the explicitly-deferred search_semantic full parity and the intentionally-out-
of-scope search_skills verb. Next session should start Section 2 (guidance
alignment): read packages/skill/SKILL.md and packages/agent/src/skill_pipeline.rs
seed_skill_nodes() side by side, rewrite SKILL.md's Tool Decision Guide against
the verbs added here (`nodespace schema create/update`, `nodespace query`,
`nodespace node update --property`, `nodespace node set-status`, `nodespace
relationship create/get`), and port the seed guidance substance (one-schema-
per-request, title_template rules, enum value/label convention, find-then-edit,
success-semantics/no-re-verify). Flag the custom: namespace-prefix discrepancy
noted above early in that session since it affects what guidance can honestly
be written.

## Acceptance Criteria Status
From #1529 Scope section 1 (Close the CLI capability gap):
- [x] `nodespace schema create` / `nodespace schema update`
- [x] `nodespace query` (execute_query parity)
- [x] `nodespace node update` extended to set properties
- [x] task-status verb (`nodespace node set-status`)
- [x] typed relationships (`nodespace relationship create/get`)
- [x] search_semantic param parity decided (documented CLI subset; full parity deferred)

Section 2 (guidance), Section 3 (propagation tooling), Section 4 (PTY wiring):
not started.

Co-Authored-By: Claude <[email protected]>

* Address review: bound execute_query limit, typed relationship direction, sharper tests

Addresses /pragmatic-code-review findings on PR #1633 (posted as a GitHub
review comment). Recommendation was APPROVE with these items as suggested
improvements/nitpicks, not blockers.

## Addressed

- packages/daemon/.../node_service.rs: ExecuteQuery's client-supplied `limit`
  is now capped at 500 server-side (was passed through unbounded as `usize`).
- packages/cli/.../relationship.rs: `nodespace relationship get --direction`
  is now a clap ValueEnum (Direction::Out/In) instead of a bare String —
  invalid values are rejected by clap at parse time with a proper --help
  listing, rather than round-tripping to the daemon first.
- packages/cli/.../schema.rs: dropped print_schema_result's unused `json`
  parameter (create/update results are structured data in both output modes,
  so there was nothing to branch on).
- Tests (cli_integration.rs):
  - schema_create_rejects_malformed_params: replaced the permissive
    contains("params_json") || contains("rpc failed") OR-assertion with a
    precise tonic::Status::InvalidArgument check + message content check.
  - relationship_get_rejects_invalid_direction -> renamed
    get_related_nodes_rpc_rejects_invalid_direction and now drives
    GetRelatedNodesRequest directly against the raw gRPC client, since an
    invalid direction can no longer reach the CLI's GetArgs at all (clap
    rejects it before the command handler runs). The daemon-side validation
    is still real for any other gRPC client, so kept as a direct-RPC test.
  - New: relationship_create_rejects_relationship_undefined_on_source_schema
    — verifies create_relationship on a plain "text" node (no schema-defined
    relationships) with a non-built-in relationship name surfaces a status
    naming the undefined relationship, per the review's note that this
    matters for Phase 2's find-then-edit guidance.

## Skipped (with reasoning)

- parse_property's silent JSON-parse-failure fallback to plain string: this
  is intentional, not a bug — `--property name=Alice` must work without
  requiring `--property name=\"Alice\"`. Tightening it would break the common
  case to guard against a typo case that's already recoverable (re-run with
  quotes).
- VALID_STATUSES duplicated across node.rs and local_agent/tools.rs (which
  itself already duplicates it twice): real but pre-existing duplication
  predating this PR; consolidating is a cross-package refactor (agent <-> cli
  <-> core) out of scope for a review-address pass on a capability-gap PR.
- No daemon-layer unit tests for the 5 new RPCs: the existing pattern in this
  codebase (see schema_list_and_get, mention_create_query_delete, etc.) is
  CLI-integration-test coverage against the real gRPC handlers, not
  daemon-only unit tests with a mocked service. Matching the established
  pattern rather than introducing a new coverage shape.

## Test plan
- cargo test -p nodespace-cli --test cli_integration: 25/25 passed
- cargo test --workspace --exclude nodespace-app --exclude nodespace-nlp-engine
  --exclude nodespace-agent: all passed
- bun run test: 159 files / 4031 tests passed (unchanged baseline)
- bun run quality:fix: clean

Co-Authored-By: Claude <[email protected]>

* WIP: #1529 Phase 2 — guidance alignment (SKILL.md rewritten against CLI verbs)

## Completed in This Session

Rewrote packages/skill/SKILL.md so its instructional content matches the
seed skill nodes (packages/agent/src/skill_pipeline.rs::seed_skill_nodes()),
same substance ported to CLI verbs instead of daemon tool-call names.

- Tool Decision Guide: removed execute_query/search_semantic daemon-tool
  naming the CLI can't invoke as-is. Split into "Finding things" (search vs.
  node query vs. query) mapped to `nodespace search`, `nodespace node query`,
  `nodespace query --filters`, with the same worked examples the seed nodes
  use (open tasks, due tomorrow, due this week, high priority).
- Schema inspection and management: expanded from list/get-only to cover
  `schema create`/`update --params`, porting the seed guidance verbatim in
  substance — one-schema-per-request, targetType must pre-exist, field
  naming rules (no name/title field except the {name}-placeholder
  exception), enum value/label convention, relationships vs. fields,
  title_template placeholder rule.
- Typed relationships: new section for `relationship create`/`get` —
  relationship name must be schema-defined (not arbitrary), find-before-link,
  don't re-verify with `get` after a successful `create`.
- node update / set-status: documented `--property` deep-merge semantics,
  find-then-update + one-clarifying-question-on-ambiguity guidance, and that
  set-status (not update --property) is the dedicated task-status verb.
- node delete: find-then-delete, confirm title match, no post-delete
  re-search.
- Common Agent Tasks: added worked end-to-end examples — define a schema
  then create an instance, link two nodes via relationship, organize into a
  collection via relationship --type member_of, bulk import via
  `nodespace import file/dir`.

## custom: namespace decision (flagged in Phase 1 handoff)

Confirmed via packages/core/src/behaviors/mod.rs::validate_schema_field:
explicit fields arrays reject any field name containing `:` (alphanumeric +
underscore only) — the `custom:` prefix is only auto-applied on the
natural-language description-parsing path, never for explicit `fields`.
Documented this directly in the new "Schema fields" subsection: explicit
`schema create`/`update --params` field names must be unprefixed; the
CLAUDE.md `custom:` convention applies to natural-language schema authoring
in the local agent, not to this CLI path. Did not attempt a product fix here
(pre-existing packages/core behavior, out of scope for a guidance-only
phase) — still worth a follow-up issue since it's a real discrepancy between
documented convention and explicit-fields behavior.

## Verification

- Cross-checked every documented flag against actual `--help` output
  (`nodespace query --help`, `relationship get --help`, `node set-status
  --help`) — all match exactly, including the 500-cap note on `query
  --limit` and the `out`/`in` ValueEnum on `relationship get --direction`
  from the address-review commit.
- Confirmed `nodespace import file/dir --auto-collection-routing` flags
  exist as documented (packages/cli/src/commands/import.rs).
- bun run quality:fix: clean, 0 findings, no unrelated files touched.
- bun run test: 159 files / 4031 tests passed (unchanged baseline).
- cargo build -p nodespace-cli: clean.

## Remaining Work (per #1529 scope, NOT started this session)

- [ ] Section 3: Propagation tooling — staleness/parity check or generation
  step so seed-node refinements don't leave SKILL.md stale.
- [ ] Section 4: PTY wiring — wire in-app PTY chat to consume SKILL.md.

## Current State

- Files modified: packages/skill/SKILL.md only (docs-only change, no code).
- Tests status: passing, unchanged baseline (frontend); no Rust changes in
  this commit so no new Rust test runs needed beyond the build check above.
- Known issues: none new. #1632 (pre-existing ollama_integration flakiness)
  and the search_semantic full-parity deferral remain as tracked in Phase 1.
- Dependencies: none blocking.

## Context for Next Session

Next: run /pragmatic-code-review scoped to this Phase 2 diff only (Phase 1
already reviewed/approved separately — don't re-review it), then
/address-review, iterate until clean. Do NOT open a new PR — same PR #1633,
same branch. Do NOT merge — merge is the user's call. After that, Section 3
(propagation tooling) and Section 4 (PTY wiring) remain.

## Acceptance Criteria Status

From #1529 Scope section 2 (Align the guidance):
- [x] Tool Decision Guide rewritten in CLI verbs
- [x] Seed-node guidance substance ported: schema creation rules,
  title_template, enum convention, find-then-edit, task status via
  dedicated verb, success semantics (no re-verify)
- [x] custom: namespace discrepancy resolved (documented, not silently
  worked around)

Co-Authored-By: Claude <[email protected]>

* Fix pre-push gate: swap ai_chat_send_to_idle_test's model from 3B to 8B

The ADR-048 Tauri-seam e2e AI-chat test was hardcoded to ministral-3b-q4km
as "the fastest available real model." That model reproducibly stalls to 0
tokens generated within the test's 300s timeout, independent of machine
load (confirmed with a quiet load average of ~1.7-2.0 on a 10-core
machine) — a different failure class from the load-sensitive flakiness
already addressed for this suite.

Isolated by temporarily swapping the test to ministral-8b-q4km (already on
disk) and re-running directly: passed cleanly in 31-44s across two runs.
ministral-8b-q4km is also the model ADR-046 already locks as the sole
native llama.cpp model (the only one passing NodeSpace's full agent
tool-call matrix), so this swap aligns the test with that decision rather
than diverging from it.

Filed a follow-up issue for the underlying 3B stall (GGUF corruption vs.
catalog/chat-template discrepancy vs. inference-path bug) — out of scope
here; this commit only unblocks the gate for unrelated work.

Verified: cargo test -p nodespace-app --test ai_chat_send_to_idle_test
passes; bun run quality:fix clean.

Co-Authored-By: Claude <[email protected]>

* Address review: use CLI verb names, not daemon tool names, in relationship note

/pragmatic-code-review on the Phase 2 diff (scoped to d192d95/fbeda515,
Phase 1 already reviewed/approved separately) found one leftover instance
of old daemon-tool vocabulary (create_schema/update_schema) in the new
"Relationships are distinct from hierarchy and mentions" paragraph — the
one line in the rewritten file that didn't get converted to the CLI verbs
(nodespace schema create/update) used consistently everywhere else.

Two nitpicks from the same review were assessed and left as-is:
- The execute_query mention in the query section is an intentional,
  contextual reference explaining CLI/daemon lineage, not a missed
  conversion.
- The "namespace prefixing... is a schema-authoring concern" phrasing is
  already resolved by a forward pointer to the Schema fields subsection.

Co-Authored-By: Claude <[email protected]>

* WIP: #1529 Phase 2 — complete, reviewed, addressed; ready for Section 3

## Completed in This Session

Phase 2 (guidance alignment) is fully done, reviewed, and address-reviewed —
this is the up-to-date handoff superseding d192d95's mid-phase snapshot.

- [x] d192d95 — rewrote packages/skill/SKILL.md against the CLI verbs added
  in Phase 1. Tool Decision Guide split into a "Finding things" section
  (nodespace search / node query / query --filters) with the same worked
  examples as the seed skill nodes. Ported seed-node guidance substance
  (packages/agent/src/skill_pipeline.rs::seed_skill_nodes()) into CLI-verb
  form: one-schema-per-request, targetType-must-preexist, field-naming rules
  (no name/title field except the {name}-placeholder exception), enum
  value/label convention, title_template placeholder rule, find-then-edit +
  one-clarifying-question-on-ambiguity, task status via the dedicated verb,
  find-then-delete, success-semantics (confirm and stop, no re-verify fetch).
  Resolved the custom: namespace discrepancy flagged in the Phase 1 handoff:
  confirmed via packages/core/src/behaviors/mod.rs::validate_schema_field
  that explicit `fields` arrays reject any `:` in field names, so documented
  explicit schema create/update field names as unprefixed — the custom:
  convention applies only to natural-language schema authoring in the local
  agent, not to this CLI path.
- [x] fbeda51 — incidental fix, discovered while trying to push d192d95:
  the pre-push gate's ai_chat_send_to_idle_test was hardcoded to
  ministral-3b-q4km, which reproducibly stalls to 0 tokens generated within
  its 300s timeout, independent of machine load (confirmed at load average
  ~1.7-2.0 on a quiet 10-core machine, and by isolating via a temporary
  swap to ministral-8b-q4km, which passed cleanly in 31-44s across two
  runs). Swapped the test to ministral-8b-q4km — which is also the model
  ADR-046 already locks as the sole native llama.cpp model, so this aligns
  the test with that decision rather than diverging from it. Filed #1636 to
  track the underlying 3B stall (root cause not yet identified: corrupted
  GGUF vs. catalog/chat-template discrepancy vs. inference-path bug).
  #1636 is unrelated to #1632 (pre-existing ollama_integration failures,
  different suite, different inference backend — Ollama, not llama.cpp).
- [x] 91cec6e — addressed the one finding from /pragmatic-code-review
  (scoped to just this phase's diff, git diff 39b5882..d192d95+fbeda515;
  Phase 1 was reviewed/approved separately and not re-reviewed): the new
  "Relationships are distinct from hierarchy and mentions" paragraph in
  SKILL.md had one leftover instance of old daemon-tool vocabulary
  (create_schema/update_schema) instead of the CLI verbs (nodespace schema
  create/update) used consistently everywhere else in the rewrite. Two
  other nitpicks from the same review were assessed and left as-is with
  reasoning (an intentional execute_query lineage reference; an already-
  resolved forward-pointer ambiguity) — see the review's full findings if
  needed, not repeated here.

## Current State

- Files modified this phase: packages/skill/SKILL.md (docs-only rewrite),
  packages/desktop-app/src-tauri/tests/ai_chat_send_to_idle_test.rs (model
  swap + comment update).
- Tests status: all passing. Confirmed via the full pre-push gate on the
  final push (fbeda51 and 91cec6e both went through cargo test -p
  nodespace-app including ai_chat_send_to_idle_test, plus test:all) —
  no bypass was used at any point this session.
- Known issues: #1636 (ministral-3b-q4km stall, root cause open) and #1632
  (pre-existing ollama_integration failures) remain open and unrelated to
  #1529 — do not touch either unless separately asked.
- Dependencies: none blocking.
- PR: still #1633, still open, still the same branch
  (worktree-issue-1529-cli-skill-parity). No new PR was opened. No merge
  has happened — merge remains the user's call.

## Context for Next Session

Section 2 (guidance alignment) of #1529 is done. Next up per #1529's scope:
- Section 3 — propagation tooling: a staleness/parity check or generation
  step so future edits to seed_skill_nodes() don't leave SKILL.md silently
  out of sync. No design decisions made yet on approach (e.g. a test that
  diffs key rules between the two sources, vs. a script that regenerates
  SKILL.md sections from the seed nodes, vs. something else) — start there.
- Section 4 — PTY wiring: wire in-app PTY chat (Claude Code/Codex/Gemini
  CLI/OpenCode running in-app) to actually consume SKILL.md. Not started,
  not investigated yet this session.
Not in scope for either: full search_semantic parity (deferred in Phase 1),
#1636's root cause, #1632's ollama_integration failures.

## Acceptance Criteria Status

From #1529 Scope section 2 (Align the guidance): all items complete (see
d192d95's own acceptance-criteria section for the itemized list — still
accurate, not repeated here).

Section 3 (propagation tooling) and Section 4 (PTY wiring): not started.

Co-Authored-By: Claude <[email protected]>

* WIP: #1529 Section 3 — propagation tooling, ready for review

## Completed in This Session

Section 3 (propagation tooling) for #1529: prevents seed_skill_nodes()
(packages/agent/src/skill_pipeline.rs) and packages/skill/SKILL.md from
silently drifting apart on the core-type rules both encode in different
vocabulary (daemon tool names vs. CLI verbs).

Design, reached after discussion: SKILL.md is a static, instance-blind
artifact (installable independently, ships in the @nodespaceai/skill npm
package) covering only core built-in types; seed_skill_nodes() guides the
in-app, instance-aware local agent. They're not one document in two forms —
they're different products that happen to share ~16 substantive rules
(schema-authoring conventions, interaction habits like find-then-act and
success-means-stop). Drift on that shared subset is the actual risk;
everything else is intentionally distinct and untouched.

- packages/agent/src/skill_rules.rs (new): SchemaRule and InteractionRule
  structs, one constant per shared rule, each with an `imperative` rendering
  (terse ALL-CAPS-header style used by the LLM prompt) and a `prose`
  rendering (flowing markdown used by SKILL.md). 9 SchemaRules (one-schema-
  per-request, enum format, title_template placeholder rule, etc.) + 7
  InteractionRules (find-then-act, ambiguity-clarify, success-no-reverify,
  task-status-dedicated-verb, single-item-per-call, org-needs-existing-
  collection, bulk-import-no-followup-search).
- skill_pipeline.rs: seed_skill_nodes()'s Schema Creation, Graph Editing,
  Relationship Management, Node Deletion, Bulk Import, and Organization
  skill nodes now interpolate their guidance from skill_rules constants
  instead of hardcoding prose inline. Worked EXAMPLE blocks and skill-
  specific structure are untouched.
- packages/agent/src/bin/gen_skill_md.rs (new): regenerates the schema-rules
  block of SKILL.md (between `<!-- BEGIN/END GENERATED: schema-rules -->`
  markers) from SchemaRule::prose. `--write` regenerates and overwrites;
  `--check` exits nonzero if the checked-in file is stale — this is real
  generation, not just a parity test, since SKILL.md is meant to reflect
  "latest core capabilities" at build/release time going forward. Verified
  end-to-end: simulated drift by hand-editing SKILL.md, confirmed --check
  catches it (exit 1) and --write repairs it.
- SKILL.md: inserted the generation markers around the existing Schema
  inspection and management rules paragraphs; split the "One schema per
  request" / "schema already exists" rules into two paragraphs to match
  skill_rules.rs's granularity; moved the description-field/custom:-
  namespace notes (no seed-node analog) outside the generated block.
- The 7 InteractionRules are woven mid-sentence into hand-written SKILL.md
  prose across 5 sections — full generation would fragment that prose, so
  these get a lighter skill_md_still_mentions_every_interaction_rule test
  instead: each rule carries a skill_md_key_phrase, and the test asserts
  it's still present in SKILL.md. Catches outright removal, not rewording.
- package.json: rust:test now also runs `cargo test --lib --bins -p
  nodespace-agent` — previously this package's tests (including preexisting
  skill_pipeline.rs tests, not just the new ones) weren't run by test:all or
  the pre-push gate at all. --lib --bins excludes tests/ontegration binaries
  (ollama_integration.rs, gated behind `testing` feature; search_skills_
  latency.rs, self-skips without an inference backend) so this stays fast
  (~6s added).

## Current State

- Files modified: package.json, packages/agent/src/lib.rs,
  packages/agent/src/skill_pipeline.rs, packages/skill/SKILL.md.
- Files added: packages/agent/src/skill_rules.rs,
  packages/agent/src/bin/gen_skill_md.rs.
- Tests status: all passing. `bun run rust:test` (295 nodespace-agent lib
  tests + 3 gen_skill_md bin tests, plus nodespace-core as before) green.
  `cargo check --workspace` and `cargo clippy -p nodespace-agent --lib
  --bins` clean. Formatted with `cargo fmt -p nodespace-agent` (package-
  scoped, not workspace-wide quality:fix, to avoid reformatting unrelated
  files).
- Known issues: none new. #1636 (ministral-3b stall) and #1632 (ollama
  integration failures) remain open, unrelated, untouched.
- Not yet run this session: /pragmatic-code-review (next step), full
  test:all (frontend unaffected by this change but not yet re-verified),
  pre-push gate.

## Context for Next Session

Next: run /pragmatic-code-review scoped to this commit's diff only (Phases
1/2 already reviewed/approved, don't re-review). Then /address-review,
iterate until clean. Then report back and STOP — do not merge, do not open
a new PR (multi-phase epic landing in one PR, #1633).

After Section 3 is reviewed/addressed, Section 4 (PTY wiring — in-app PTY
chat consuming SKILL.md) is the last remaining scope item for #1529. Not
started, not investigated this session.

## Acceptance Criteria Status

From #1529 Scope section 3 (propagation tooling): implemented — a real
generator (not just a test) for the 9 schema rules, plus presence-checking
for the 7 interaction rules that can't be cleanly generated without
fragmenting hand-written SKILL.md prose. Pending: code review.

Section 4 (PTY wiring): not started.

Co-Authored-By: Claude <[email protected]>

* Address review: fix gen_skill_md drift-detection gap, restore verb detail, guard duplicate markers

Addresses /pragmatic-code-review findings on commit 2476e8a (PR #1633,
comment #1633 (comment)),
scoped to #1529 Section 3 only.

- CRITICAL: render_schema_rules_block() hardcoded the "Editing" paragraph
  instead of interpolating EDIT_DONT_RECREATE.prose, so `gen_skill_md --check`
  could not detect drift in that rule — reviewer proved this by editing the
  rule's prose and showing --check still reported "up to date". Fixed by
  importing and interpolating EDIT_DONT_RECREATE. Reproduced the reviewer's
  probe post-fix: same edit now makes --check exit 1 as expected; restored
  and reconfirmed --check passes on the unmodified rule.
- Improvement: graph_editing_guidance()'s "FIND THEN UPDATE" line lost the
  verb-specific tail ("Then call update_node with the ID...") when the
  sentence was replaced by the generic FIND_THEN_ACT interpolation. Restored
  the tail after the interpolated rule text.
- Improvement: splice_generated_block() had no guard against duplicate
  marker occurrences. Added two assertions so a future duplicate marker
  (accidental copy-paste, merge artifact) fails loudly instead of splicing
  into the wrong occurrence.

Skipped (as suggestions, not requiring code changes): the tautological
skill_rules.rs self-tests and the "Schema fields" grouping comment nit —
both are low-value/moot once the Critical fix landed.

Verified: bun run rust:test (979 nodespace-core + 295 nodespace-agent lib +
3 gen_skill_md bin tests, all passing), cargo clippy -p nodespace-agent
--lib --bins clean, cargo fmt -p nodespace-agent applied, cargo check
--workspace clean.

Co-Authored-By: Claude <[email protected]>

* WIP: #1529 Section 3 — done, reviewed, addressed; ready for Section 4

## Completed in This Session

Section 3 (propagation tooling) is fully done, reviewed, and address-reviewed.

- 2476e8a — built the drift-prevention mechanism between seed_skill_nodes()
  (packages/agent/src/skill_pipeline.rs) and packages/skill/SKILL.md for the
  ~16 rules they share in substance (schema-authoring conventions +
  interaction habits), despite being different products for different
  audiences (in-app instance-aware local agent vs. static instance-blind
  CLI reference shipped in @nodespaceai/skill). New
  packages/agent/src/skill_rules.rs holds SchemaRule (9) and InteractionRule
  (7) constants, each rendered two ways (imperative LLM-prompt style, prose
  SKILL.md style). New packages/agent/src/bin/gen_skill_md.rs regenerates
  SKILL.md's schema-rules block (--write) and fails CI if it's stale
  (--check) — real generation, not just a parity test, since SKILL.md is
  meant to reflect current core capabilities at build time. The 7
  interaction rules get a lighter presence-check test instead (full
  generation would fragment hand-written CLI prose they're woven into).
  package.json's rust:test now also runs nodespace-agent's test suite —
  previously neither the new nor the preexisting skill_pipeline.rs tests
  were part of test:all/pre-push at all.
- 52ae5f6 — addressed /pragmatic-code-review (scoped to 2476e8a only,
  posted at github.com//pull/1633#issuecomment-4949281475).
  One real bug found and fixed: gen_skill_md.rs's "Editing" paragraph was
  hardcoded instead of interpolating EDIT_DONT_RECREATE.prose, so --check
  couldn't catch drift in that one rule — verified fixed using the
  reviewer's own repro. Two smaller improvements also fixed (restored
  verb-specific detail lost in one interpolation; added duplicate-marker
  guards to the generator's splice logic). No re-review needed — posted at
  github.com//pull/1633#issuecomment-4949295748.

## Current State

- Branch worktree-issue-1529-cli-skill-parity, PR #1633, up to date with
  origin, working tree clean, nothing uncommitted.
- Tests status: bun run rust:test green (979 nodespace-core + 295
  nodespace-agent lib + 3 gen_skill_md bin tests). cargo clippy -p
  nodespace-agent --lib --bins clean. cargo check --workspace clean. Both
  Section 3 commits went through the full pre-push gate successfully.
- Known issues: #1636 (ministral-3b-q4km stall) and #1632 (ollama_integration
  failures, being addressed separately per PR #1635 on main) remain open,
  unrelated to #1529, untouched this session.
- Dependencies: none blocking Section 4.

## Context for Next Session

Section 4 — PTY wiring — is the only remaining scope item for #1529. Not
started, not investigated at all yet: no design decisions made on how the
in-app PTY chat (Claude Code/Codex/Gemini CLI/OpenCode running inside
NodeSpace) actually consumes SKILL.md, whether that's the packages/skill
install flow (packages/skill/src/installer.ts copies shims but not SKILL.md
itself today — confirmed during Section 3 scoping) or a different
mechanism, and what "wiring" concretely means here. Start by reading the
open issue's Section 4 scope text plus packages/skill/src/installer.ts and
the shims/ directory, then evaluate approaches before implementing — same
pattern as Section 3's start.

## Acceptance Criteria Status

From #1529 Scope section 3 (propagation tooling): complete — see 2476e8a
and 52ae5f6 for the itemized implementation and review-fix list, not
repeated here.

Section 4 (PTY wiring): not started.

Co-Authored-By: Claude <[email protected]>

* Wire PTY chat to SKILL.md (closes #1529 Section 4)

Investigation found the PTY-spawned in-app chat (Claude Code/Codex/
Gemini/OpenCode running inside NodeSpace) was never actually wired to
consume SKILL.md, despite ADR-032 building GraphContextAssembler with
a with_shim_dir() hook for exactly this purpose. That hook was never
called from production code (packages/daemon/src/services/assembly.rs
constructs GraphContextAssembler::new() with no shim dir configured),
so PTY sessions got: a generated CLAUDE.md/AGENTS.md whose "Guidance"
section referenced daemon tool names unreachable from a PTY agent
(execute_query, create_schema, search_skills, ...), and a dead
5-tool shim mechanism (SHIM_TOOLS: search_semantic/get_node/
create_node/update_node/get_children) that was never invoked to
copy anything. Zero real NodeSpace tool access.

Fix: GraphContextAssembler::write_context_file now unconditionally
copies SKILL.md (embedded at compile time via include_str!, so the
PTY session always gets exactly the doc that shipped with this
daemon build, dev or packaged) into the session directory alongside
the generated context file. SKILL.md — CLI-vocabulary, parity-complete
after Sections 1-3 — is now the sole tool/capability guidance surface
for PTY sessions; the knowledge-graph context file carries only graph
content (seed nodes, semantic neighbors, relationships).

Removed as dead code superseded by this: ShimTool/SHIM_TOOLS/
tools_section/tools_list, shim_files_for/shim_subdir_for,
write_shim_files, with_shim_dir/shim_source_dir, and the
SCHEMA_CREATION_RULES/TOOL_STRATEGY_RULES/NODE_REFERENCE_FORMAT
injection into the PTY context file (those constants remain in
agent_guidance.rs, still used by prompt_assembler.rs for the local
in-app agent — only their PTY-path consumer was removed).

Unrelated to and untouched by this change: packages/skill's npm
installer (external-harness path — already installs SKILL.md into
~/.claude/skills/nodespace etc., confirmed during scoping) and
packages/skill/shims/*.ts (still used by that installer).

Co-Authored-By: Claude <[email protected]>

---------

Co-authored-by: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ollama_integration test suite has ~17 failing tests due to empty tool-call responses from mistral:7b

1 participant