Repository navigation
Refine local agent system prompt for better tool usage and response quality - #1052
Merged
Merged
Conversation
…1040) Extract AI agent business logic from desktop-app into a dedicated nodespace-agent crate. Desktop-app now contains only thin Tauri command bindings. - Create packages/agent/ with agent_types, local_agent/, acp/ modules - Decouple GraphToolExecutor from AppServices (accepts Arc<NodeService> directly) - Extract Tauri event constants to desktop-app/agent_events.rs - Update all desktop-app imports to use nodespace_agent:: - Achieve target DAG: nlp-engine ← core ← agent ← desktop-app - Update CLAUDE.md repository structure Co-Authored-By: Claude <[email protected]>
…#1040) - Create core::ops module with typed operations layer: - node_ops: create, get, update, delete, query with collection/OCC/lifecycle - search_ops: semantic search with collection/scope/lifecycle filtering - rel_ops: relationship CRUD - context_ops: workspace context assembly (schemas, collections, playbooks) - Refactor MCP handlers to delegate to ops/ (handlers become thin JSON adapters) - Rewrite local agent system prompt with dynamic workspace context - Add response post-processing normalizer (URI fixing, status casing, JSON stripping) - Refactor MCP initialize handler to use context_ops Co-Authored-By: Claude <[email protected]>
…malizer (#1040) - Replace direct NodeService calls in GraphToolExecutor with core::ops calls (create_node, update_node, search_nodes, search_semantic, relationships) - Local agent now gets full orchestration: collection resolution, OCC auto-fetch, lifecycle management, search post-filtering (previously MCP-only) - Integrate normalize_response() at all AgentTurnResult return points in agent_loop - Remove unused node_summary function (ops layer handles formatting) Co-Authored-By: Claude <[email protected]>
- Route exec_get_node JSON format through node_ops::get_node (single source of truth) - Wire dynamic_context population in local_agent_new_session via context_ops - Add set_session_context() to LocalAgentService - Use OnceLock for regex compilation in response normalizer (avoid per-call recompilation) - Fix similarity score field name mismatch (score → similarity) - Remove unused node_full/node_summary functions - Add Default derive to WorkspaceContext Co-Authored-By: Claude <[email protected]>
…ons (#1040) - Add CapturingMockEngine that records InferenceRequests for assertion - Test: dynamic context appears in system prompt when set on session - Test: response normalizer fixes URIs and status casing end-to-end - Test: tool definitions are included in inference requests - Test: full tool call → response → normalization round-trip Co-Authored-By: Claude <[email protected]>
…1040) - Add RecordingToolExecutor that captures tool calls with args for assertion - Test: structured query ("what are my tasks?") calls search_nodes with node_type=task - Test: semantic query ("anything about machine learning?") calls search_semantic - Test: multi-turn session uses different tools per turn (search_nodes then search_semantic) - Verifies tool selection, arg passing, result handling, and response normalization Co-Authored-By: Claude <[email protected]>
…tent (#1040) - Rename "Prompt & tool quality tests" to "Pipeline integration tests" with explanation that mock engine drives tool selection, not the model - Add doc comment to RecordingToolExecutor explaining intentional schema duplication for test isolation Co-Authored-By: Claude <[email protected]>
malibio
added a commit
that referenced
this pull request
Jun 22, 2026
…uality (#1052) * refactor: Create packages/agent/ crate and relocate local agent code (#1040) Extract AI agent business logic from desktop-app into a dedicated nodespace-agent crate. Desktop-app now contains only thin Tauri command bindings. - Create packages/agent/ with agent_types, local_agent/, acp/ modules - Decouple GraphToolExecutor from AppServices (accepts Arc<NodeService> directly) - Extract Tauri event constants to desktop-app/agent_events.rs - Update all desktop-app imports to use nodespace_agent:: - Achieve target DAG: nlp-engine ← core ← agent ← desktop-app - Update CLAUDE.md repository structure Co-Authored-By: Claude <[email protected]> * feat: Add shared ops/ layer, dynamic context, and response normalizer (#1040) - Create core::ops module with typed operations layer: - node_ops: create, get, update, delete, query with collection/OCC/lifecycle - search_ops: semantic search with collection/scope/lifecycle filtering - rel_ops: relationship CRUD - context_ops: workspace context assembly (schemas, collections, playbooks) - Refactor MCP handlers to delegate to ops/ (handlers become thin JSON adapters) - Rewrite local agent system prompt with dynamic workspace context - Add response post-processing normalizer (URI fixing, status casing, JSON stripping) - Refactor MCP initialize handler to use context_ops Co-Authored-By: Claude <[email protected]> * feat: Wire local agent tools to ops/ layer and integrate response normalizer (#1040) - Replace direct NodeService calls in GraphToolExecutor with core::ops calls (create_node, update_node, search_nodes, search_semantic, relationships) - Local agent now gets full orchestration: collection resolution, OCC auto-fetch, lifecycle management, search post-filtering (previously MCP-only) - Integrate normalize_response() at all AgentTurnResult return points in agent_loop - Remove unused node_summary function (ops layer handles formatting) Co-Authored-By: Claude <[email protected]> * fix: Address PR review findings (#1040) - Route exec_get_node JSON format through node_ops::get_node (single source of truth) - Wire dynamic_context population in local_agent_new_session via context_ops - Add set_session_context() to LocalAgentService - Use OnceLock for regex compilation in response normalizer (avoid per-call recompilation) - Fix similarity score field name mismatch (score → similarity) - Remove unused node_full/node_summary functions - Add Default derive to WorkspaceContext Co-Authored-By: Claude <[email protected]> * test: Add e2e tests for prompt quality, normalizer, and tool definitions (#1040) - Add CapturingMockEngine that records InferenceRequests for assertion - Test: dynamic context appears in system prompt when set on session - Test: response normalizer fixes URIs and status casing end-to-end - Test: tool definitions are included in inference requests - Test: full tool call → response → normalization round-trip Co-Authored-By: Claude <[email protected]> * test: Add structured, semantic, and multi-turn tool call e2e tests (#1040) - Add RecordingToolExecutor that captures tool calls with args for assertion - Test: structured query ("what are my tasks?") calls search_nodes with node_type=task - Test: semantic query ("anything about machine learning?") calls search_semantic - Test: multi-turn session uses different tools per turn (search_nodes then search_semantic) - Verifies tool selection, arg passing, result handling, and response normalization Co-Authored-By: Claude <[email protected]> * chore: Address re-review nits — rename test section, document mock intent (#1040) - Rename "Prompt & tool quality tests" to "Pipeline integration tests" with explanation that mock engine drives tool selection, not the model - Add doc comment to RecordingToolExecutor explaining intentional schema duplication for test isolation Co-Authored-By: Claude <[email protected]> --------- Co-authored-by: Claude <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1040