Skip to Content
DocsTools & Backend Architecture

Tools & Backend Architecture

The CURD internal backend is built symmetrically around completely isolated functional logic domains via distinct “Engines”. These engines surface atomic behaviors uniformly to CLI, REPL, Python/Node bindings, and MCP frontends via a Unified Routing Layer.

This prevents “interface drift”:

  • The CLI is not a bypass.
  • MCP is not a privileged lane.
  • Every tool call flows through the same capability and policy gate.

Backend Architecture

  • GraphEngine: Builds a memory-mapped internal Directed Graph of Symbol Dependencies using purely semantic AST queries.
  • SearchEngine (New in v0.7.1): Now features BM25 / FTS-backed ranked search as part of the indexed path, returning results in ~10ms even on massive 200k+ file repos.
  • EditEngine: A state-machine managing a “Shadow Workspace”, caching edits virtually, injecting semantic diffs, and committing to disk explicitly per transaction.
  • ShellEngine: Acts as a strictly gated subprocess sandbox. It enforces foreground timeout, workspace-bound cwd validation, and background task count limits.

The Tooling Interface

When using CURD via MCP or .curd scripts, agents are exposed to high-fidelity functions natively designed to eliminate blind regex/text-mutation.

In v0.7.1, tools/list provides canonical operation types and structural metadata, nudging the LLM towards these optimized paths natively over standard OS fallbacks.

Tool CallCapability AtomDescription
searchlookupInstant BM25 / FTS-backed Semantic Graph search. Replaces grep and find.
graphtraverseQuery the Universal Semantic Linker for O(1) blast radius mapping.
readreadRead files, functions, or classes directly using exact AST boundaries. Replaces cat and head.
editchange.applyModify AST symbols directly. Operates within the Shadow Workspace. Requires an active session. Replaces sed and awk.
shellexec.commandExecute a shell command safely within the sandbox. Intercepts compiler diagnostics to propagate graph fault states automatically.
plugin_toolplugin.manageInstall and manage .curdt native tool extensions.
plugin_languageplugin.manageInstall and manage .curdl language grammar extensions.

The Auditing Flow (curd test)

v0.7.1 introduces the curd test command. This performs a Graph and Cohesion Audit. It scans the active workspace and triggers a fast scan of the indexed graph to verify semantic integrity and identify poisoned (failing) nodes before executing further plans.

Last updated on