Skip to content

Custom Agent

Any agent that speaks MCP (stdio transport) can consume Trurlic’s decision graph. This guide covers the integration pattern for custom agents and frameworks.

Add Trurlic to your MCP client configuration:

{
"mcpServers": {
"trurlic": {
"command": "trurlic",
"args": ["serve"]
}
}
}

The server uses stdio transport — it reads JSON-RPC from stdin and writes to stdout.

Use when the task requires new architectural decisions: new component, new concern area, design change.

1. advance(component, task_type) → { step, action, requires_user_input }
2. Follow the action (get_step_prompt, add_component, etc.)
3. If requires_user_input: ask the user, wait, pass their response
4. advance again with step_evidence
5. Repeat until ready: true
6. get_context → implement constrained by the brief

Gated steps require evidence of at least 20 bytes — the agent must present the prompt to the user and collect a meaningful response.

Implementation mode — get_context directly

Section titled “Implementation mode — get_context directly”

Use when implementing within existing constraints. No advance loop, no gates, fully autonomous.

1. get_context(component) → brief with all decisions and constraints
2. Implement within the brief
3. If undecided pattern encountered:
check_pattern(description) → if uncovered:
record_decision(component, choice, reason, attribution="agent")
continue — the decision is flagged ⚠ for human review
4. get_context(component, depth="constraints") → verify compliance

If the task says “add a feature,” “fix a bug,” or “implement X” and the component has existing decisions that cover the work — use implementation mode.

If the task says “design,” “architect,” “add a new component,” or the existing decisions don’t cover what needs to be done — switch to design mode.

Trurlic implements the MCP JSON-RPC protocol over stdio:

  • tools/list — returns the twelve tool definitions with JSON Schema input specifications.
  • tools/call — dispatches to read or write tools based on tool name. Returns a content envelope with type: "text" containing the JSON payload.
  • Error responses include isError: true and an error message in the text field.

When an implementation touches multiple components, call get_context for each component. The briefs include related decisions from connected components, ensuring cross-cutting constraints are visible.

Decisions recorded by the agent during implementation carry attribution = "agent". These are flagged with ⚠ in context briefs and the interactive map, signaling that a human should review them.

For the full tool API, see MCP Tools Reference. For the advance loop and task types, see Workflow Engine.