Skip to content

apomesh-vertical-coding-assistant

apomesh-vertical-coding-assistant is a substrate-coupled vertical: a use-case that sits beside the substrate and specializes it for coding workflows, rather than living inside it. It plugs coding-specific tools into the substrate’s tool registry behind the standard Tool port — a Language Server Protocol (LSP) client and four code-intelligence tools, a tree-sitter AST query tool, and a coding-typed view over the substrate’s generic procedural-memory sections. The substrate ships the mechanisms (tool registry, sandboxed CLI execution, procedural-memory storage); this crate composes them into coding surfaces so the substrate stays domain-neutral. It is compiled only into deployments that opt in via the coding-assistant Cargo feature — default builds never link its LSP or tree-sitter dependencies. Touch it when you change how a coding agent reads a codebase.

  • Layer: vertical (substrate-coupled use-case). See Agent configuration for how a vertical’s tools reach a session.
  • Depends on: apomesh-orchestrator (the tool registry + workspace path resolver it registers into), apomesh-substrate (the Tool port and the generic ProceduralSections it projects), and apomesh-protocol (the wire types). Plus the external lsp-server / lsp-types (the LSP JSON-RPC wire) and tree-sitter with the per-language grammar crates.
  • Consumed by: only apomesh-orchestrator-bin — an optional, feature-gated dependency. No other workspace crate links it; a default daemon build excludes it entirely.
  • The LSP tools — four read-only Tools sitting atop one LspClient per running server: lsp.find_definition, lsp.find_references, lsp.diagnostics, lsp.type_at. Registered together by register_lsp_tools.
  • The AST query toolast.query (AstQueryTool), a tree-sitter-backed structural query over a single file. Registered by register_ast_tools.
  • The LSP wire clientLspClient owns the vertical’s wire to a language server: JSON-RPC framing, request correlation, and capability negotiation. It does not own path safety — tools compose it with the substrate’s workspace path resolver.
  • The server lifecycleLspServerHandle resolves, spawns, and handshakes one language server per (workspace, language), shared across the four tools; detect_language picks the workspace’s language from marker files.
  • The AgentMd typed view — a coding-vocabulary projection over the substrate’s generic ProceduralSections (## Buildbuild_command, ## Testtest_command, ## Conventions, ## Do Not Touch), via From<&ProceduralSections>.

It does not own the sandbox policy, the Tool port, or procedural-memory storage — those are the substrate’s; this crate composes them.

Tool idTypeContract
ast.queryAstQueryTooltree-sitter structural query over one file — Rust, Python, TypeScript, JavaScript
lsp.find_definitionLspFindDefinitionToolgo-to-definition at a position
lsp.find_referencesLspFindReferencesToolfind-all-references for a symbol
lsp.diagnosticsLspDiagnosticsTooldiagnostics for a file
lsp.type_atLspTypeAtToolhover / type-at-position

The LSP tools cover Python, Rust, and TypeScript (the languages with a resolvable server); the AST tool additionally covers JavaScript.

Verified against HEAD. A curated map, not the full rustdoc.

  • register_ast_tools — registers ast.query into a ToolRegistry against a workspace path resolver.
  • register_lsp_tools — registers the four LSP tools against a shared LspServerHandle.
  • LspServerHandlenew_for_language(language, workspace_root) resolves the binary, spawns it, completes the handshake; returns Ok(None) when no server is installed.
  • detect_language — picks the workspace LspLanguage from marker files (pyproject.toml > Cargo.toml > tsconfig.json), or None.
  • LspLanguage — the closed enum of LSP-covered languages; carries the default binary name and the APOMESH_LSP_SERVER_<LANG> override name.
  • LspClient / LspError — the LSP JSON-RPC client and its typed error surface.
  • AgentMd — the coding-typed AGENT.md view, built From<&ProceduralSections>.

The tools are not called directly — the orchestrator daemon binary wires them in at boot when built with the feature. Enable it:

Terminal window
# Default build — coding-assistant deps are NOT linked
cargo build -p apomesh-orchestrator-bin
# Coding-assistant deployment
cargo build -p apomesh-orchestrator-bin --features coding-assistant

With the feature on, the binary registers ast.query, then detects the workspace language and — if a server is available — spawns it and registers the four LSP tools. Point a language at a specific server binary with the per-language override (otherwise the default name is searched on PATH):

Terminal window
# Default binaries: pylsp / rust-analyzer / typescript-language-server
export APOMESH_LSP_SERVER_RUST=/opt/rust-analyzer/bin/rust-analyzer

A missing server binary is not fatal: the binary logs and skips LSP-tool registration, so a non-coding deployment boots without any language server installed.