<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Terraphim AI - Medium]]></title>
        <description><![CDATA[Terraphim — Privacy Preserving AI assistant Privacy Preserving AI assistant, works for you under your full control - Medium]]></description>
        <link>https://medium.com/terraphim-ai?source=rss----663bc011fa12---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Terraphim AI - Medium</title>
            <link>https://medium.com/terraphim-ai?source=rss----663bc011fa12---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 23:19:01 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/terraphim-ai" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Context Engineering: the book is out]]></title>
            <link>https://medium.com/terraphim-ai/context-engineering-the-book-is-out-beebe2b67469?source=rss----663bc011fa12---4</link>
            <guid isPermaLink="false">https://medium.com/p/beebe2b67469</guid>
            <category><![CDATA[books]]></category>
            <category><![CDATA[context-engineering]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[knowledge-graph]]></category>
            <dc:creator><![CDATA[Alex Mikhalev]]></dc:creator>
            <pubDate>Mon, 19 Oct 2026 10:59:13 GMT</pubDate>
            <atom:updated>2026-10-19T11:25:06.635Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/625/1*76eIazFFo9AY1MvdeE56Ng.jpeg" /></figure><p>Most AI systems don’t fail because the model is wrong.</p><p>They fail because the context is.</p><p>But here’s the uncomfortable part: context engineering isn’t a new activity. We’ve been doing it for decades under different names:</p><ul><li>Configuration management gave us baselines and change control. Systems engineering gave us decision gates and requirements traceability.</li><li>Domain-driven design gave us the ubiquitous language and bounded contexts. The systems-thinking tradition gave us a method for building explanations rather than narratives.</li><li>Then LLMs arrived, and a lot of that discipline was set aside. Context became “the prompt” — something to tweak, not something to version, validate and govern.</li></ul><p>That’s the argument in my book, <em>Context Engineering: Designing AI That Understands, Remembers, Acts, and Learns</em>.</p><p>It isn’t a new invention. It’s an old discipline applied to a new kind of system — one where the “software” is partly prompts, partly knowledge, partly retrieval, partly policy, and partly the model’s emergent behaviour.</p><p>Inside, 25 chapters cover:</p><ul><li>why AI software fails differently — context drift, not crashes</li><li>knowledge graphs as context infrastructure, and when deterministic search beats vector embeddings</li><li>token budgets, compression and skill architecture</li><li>judge harnesses, typed decision models and evidence lineage — how to make an AI’s decisions inspectable</li><li>validation gates, multi-agent context and enterprise governance</li><li>building a context engineering practice</li></ul><p>It’s written for senior developers, engineering managers and architects who need AI to be dependable in production, not just impressive in a demo.</p><p>The book is out now on Kindle: <a href="https://www.amazon.com/dp/B0HMZBWH5Q">amazon.com</a> and <a href="https://www.amazon.co.uk/dp/B0HMZBWH5Q">amazon.co.uk</a>.</p><p>Which older discipline do you think AI teams have forgotten most?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=beebe2b67469" width="1" height="1" alt=""><hr><p><a href="https://medium.com/terraphim-ai/context-engineering-the-book-is-out-beebe2b67469">Context Engineering: the book is out</a> was originally published in <a href="https://medium.com/terraphim-ai">Terraphim AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[3 Ways to Save Money on Tokens for Your AI Agents]]></title>
            <link>https://medium.com/terraphim-ai/3-ways-to-save-money-on-tokens-for-your-ai-agents-aae18ac75bfe?source=rss----663bc011fa12---4</link>
            <guid isPermaLink="false">https://medium.com/p/aae18ac75bfe</guid>
            <category><![CDATA[agents]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[engineering]]></category>
            <dc:creator><![CDATA[Alex Mikhalev]]></dc:creator>
            <pubDate>Mon, 19 Oct 2026 09:26:57 GMT</pubDate>
            <atom:updated>2026-10-19T15:37:10.208Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Three levers we run in production: let a cheap model summarise the evidence, put expensive reasoning only where it earns its keep, and route every request through a proxy that knows the price of each lane.</em></p><p>Your agent bill is mostly input tokens. Not the clever parts: the re-reading.</p><p>Every turn, a coding agent replays its entire transcript to the provider. Add a repository to explore and a handful of tool outputs, and a single session can carry a hundred thousand tokens of context that the model reads over and over at full price. The frontier model you are paying for spends most of its expensive attention budget on text it has already seen, or text a much cheaper model could have filtered first.</p><p>We run a fleet of overnight coding agents on a single machine, so we feel this directly. Over the past few months we have landed on three levers that cut token spend without cutting output quality. Each one is running in production today, and each one comes with a caveat we will not hide: we have measured the mechanisms, not the end-to-end savings. The arithmetic below uses published prices and our own logs; treat it as illustrative, not invoiced.</p><h4>1. Search first, let a cheap model summarise</h4><p>The most expensive way to give a frontier model context is to hand it raw search results. The cheapest way is to let a small model read them first.</p><p>The pattern looks like this. A local search tool retrieves candidate chunks from your codebase or knowledge base. Before those chunks reach your GPT-6 or Fable-class session, a lower-cost model synthesises them into a compact answer, with deterministic references back to the source. The expensive model receives the synthesis and the few references it may need to reopen, not ten near-duplicate excerpts.</p><p>We do this with terraphim-grep (part of the open-source <a href="https://github.com/terraphim/terraphim-clients">terraphim-clients</a> repository), which resolves query terms through a curated knowledge-graph thesaurus before ranking local matches:</p><pre>export OPENROUTER_MODEL=&#39;deepseek/deepseek-v4-flash-0731&#39;<br><br>terraphim-grep provider \<br>  --thesaurus docs/src/thesaurus.json \<br>  --haystack code --paths crates -n 10 \<br>  --answer --force-rlm --json</pre><p>--answer requests an answer when the sufficiency check calls for one; --force-rlm forces the synthesis path. Only the selected excerpts leave the machine, through OpenRouter to a DeepSeek-flash-class model. There is also --search-only, which hard-disables synthesis and skips building the LLM client entirely, so a stray API key in the environment cannot cost a single network call.</p><p>In our verified run, the raw chunk contents measured 505 characters, the evidence with source locations 1,108 characters, and the synthesised answer text 440 characters: the frontier model received about 40% of the context it would otherwise have been fed, with references it could reopen on demand.</p><p>Two honest caveats. First, we measured characters, not tokens: the CLI does not expose token usage, so treat the ratio as directional. Second, the win is conditional on the handoff shape. The full answer object with all ten references measured 1,918 characters; forward that wholesale and the saving evaporates. Pass the synthesis plus the references needed for verification, nothing more.</p><h4>2. Put expensive reasoning at the edges of the V, not in the middle</h4><p>The second lever is not a tool but a lifecycle decision: match the model’s price to the phase of work.</p><p>We structure agent work as a V-model. The left side asks “what should we build” (research, design, specification); the right side asks “did we build it correctly” (review, validation, judge panels). The long middle (implementation, test-writing, mechanical verification loops) is where most of the tokens burn, and it is precisely the part that needs the least reasoning depth.</p><p>So we split the model placement:</p><ul><li><strong>Edges get the expensive models.</strong> Research synthesis, architecture decisions, and final review stay on high-reasoning lanes, because a bad plan or a rubber-stamped review costs more than the tokens save.</li><li><strong>The middle runs on fast delivery models.</strong> Implementation and test loops run on grok, MiniMax, or Kimi highspeed lanes over flat-rate subscriptions. Our overnight agents execute on opencode-go subscription models; our judge panels run on Kimi K2.5, which reaches 90% verdict agreement with human reviewers at around nine seconds per review.</li></ul><p>The arithmetic is worth doing once. At published API prices, an illustrative workload of 100 million input and 20 million output tokens costs $800 if everything runs on a frontier model. Route 80% of it to a mid-tier model and the same token volume costs $480: 40% less, with the model count unchanged. That is a counterfactual at published prices, not a measured bill, but the shape of the saving is real: you are not paying for fewer tokens, you are paying less per token for the phases that do not need frontier reasoning.</p><p>The catch is discipline. Left to itself, an agent uses whatever model it started on for everything. The phases have to be explicit, which is why this lever only works inside a structured lifecycle rather than a free-running session.</p><h4>3. Put a proxy in front of the providers</h4><p>The third lever makes the cheap route the default: an LLM proxy between the agent and every provider, routing each request by what it contains or how fast each lane currently is.</p><p>Ours is terraphim-llm-proxy, shared with our <a href="https://github.com/sponsors/terraphim">GitHub Sponsors</a> supporters. It sits on localhost, exposes OpenAI and Anthropic compatible endpoints, and decides where each request goes:</p><ul><li><strong>Keyword routing.</strong> The proxy matches prompt content against a markdown taxonomy using Aho-Corasick string matching (microsecond overhead, the same crate our knowledge graph uses). A prompt that says “think step by step about this architecture” routes to the think chain regardless of the model ID the client requested. In our logs, three consecutive requests landed on three different providers under three different scenarios, transparently to the client.</li><li><strong>Speed and price routing.</strong> Eligible candidates can be ranked by time to first token, or by cost class: free lanes first, then subscription, then metered. Per scenario you choose whether latency or price wins. Agent idle time waiting on a rate limit is a real cost, just billed in hours rather than tokens.</li><li><strong>Fallback chains make the cheap lanes safe.</strong> Cheap providers have real reliability gaps: silent API format changes, undocumented capacity errors, higher latency from Europe. Pipe-delimited fallback chains mean a dead provider just moves the request to the next target. We verify this with deliberate failure injection (pointing the primary provider’s domain at localhost in /etc/hosts) rather than trusting the config.</li></ul><p>One caveat that took us by surprise: <strong>prompt caches are per model, not per session</strong>. Measured across real coding sessions, 82% of mid-session model switches collapsed the cache read below 10% of its previous value: a warm 107,000-token prefix became 110,000 tokens of uncached input, roughly ten times the cached price for the same text. The saving pattern is therefore to route the session or the scenario, not each turn at random. Pick a lane for the job and stay on it.</p><h4>What we do not claim</h4><p>Token savings are not measured end-to-end. The synthesis example is measured in characters, not tokens; the model-mix example is arithmetic at published prices, not an invoice; the 82% cache-collapse figure comes from one operator’s session logs, not a fleet benchmark. The honest metric is quality-adjusted cost per accepted task, and we are still building the instrumentation to report it.</p><p>What we can claim is mechanism: retrieval that filters before the expensive model reads, a lifecycle that spends reasoning budget where judgement lives, and a proxy that prices the lanes before it forwards the request. None of these require trusting a benchmark. All three are running today.</p><p>The underlying pieces have full write-ups: <a href="https://terraphim.ai/posts/skill-spotlight-terraphim-grep/">terraphim-grep and role-aware search</a> and <a href="https://terraphim.ai/posts/disciplined-engineering-ai-systems/">the V-model for AI agents</a>. The grep tooling is in <a href="https://github.com/terraphim/terraphim-clients">terraphim-clients</a>. The routing proxy from section 3 is terraphim-llm-proxy, shared with <a href="https://github.com/sponsors/terraphim">GitHub Sponsors</a> supporters. If you want this running inside your team rather than as homework, we do it as part of our consulting work at <a href="https://zestic.ai/">zestic.ai</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aae18ac75bfe" width="1" height="1" alt=""><hr><p><a href="https://medium.com/terraphim-ai/3-ways-to-save-money-on-tokens-for-your-ai-agents-aae18ac75bfe">3 Ways to Save Money on Tokens for Your AI Agents</a> was originally published in <a href="https://medium.com/terraphim-ai">Terraphim AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A failed command, a saved correction, and the next run]]></title>
            <link>https://medium.com/terraphim-ai/a-failed-command-a-saved-correction-and-the-next-run-c4cdc9a4fbf2?source=rss----663bc011fa12---4</link>
            <guid isPermaLink="false">https://medium.com/p/c4cdc9a4fbf2</guid>
            <dc:creator><![CDATA[Alex Mikhalev]]></dc:creator>
            <pubDate>Tue, 13 Oct 2026 09:39:05 GMT</pubDate>
            <atom:updated>2026-10-14T07:59:01.759Z</atom:updated>
            <content:encoded><![CDATA[<h3>Update: what the model requested, and what actually ran</h3><p>The hook rewrites the command; OpenCode executes it. I extended the included adapter so one execution record now links the original request, matching compiled rule ID and graph hash, final executed command, tool result and saved output file. The result file carries the same execution ID and its SHA-256 is checked.</p><p>The new 66-second demo uses actual saved outputs and synthetic British narration. All 22 regression tests pass, and the downloadable ZIP was extracted and run again with released terraphim-agent 1.21.19 and OpenCode 2.0.20. The adapter source is version 2.0.0; this covers the public example’s sequential whole-command mapping.</p><p><a href="https://terraphim.ai/how-tos/command-rewriting-howto/">Watch the new demo</a> · <a href="https://terraphim.ai/demos/hooks-execution-evidence/terraphim-hooks-execution-evidence-v2.zip">Download the source, tests and saved evidence</a> · <a href="https://terraphim.ai/demos/hooks-execution-evidence/execution-receipt.json">Inspect the execution receipt</a></p><p>The original walkthrough below retains its original recorded outputs.</p><p>Follow one command from a real failure to a reviewed correction and successful execution. The Harbour hooks example includes a released Terraphim agent, an OpenCode adapter, disabled/enabled rewrite comparisons, host traces and the resulting validation file.</p><p>A coding agent uses the wrong flag. You explain the correction, and the command works. The useful question is what happens when another session makes the same mistake.</p><p>This walkthrough follows one harmless error from failure to saved correction to actual execution. It uses the Harbour project brief from the <a href="https://terraphim.ai/posts/cold-start-tax-agentic-memory/">memory walkthrough</a>, a released Terraphim agent, and an OpenCode adapter included in the download.</p><p>Watch the narrated demonstration: <a href="https://terraphim.ai/how-tos/command-rewriting-howto/">https://terraphim.ai/how-tos/command-rewriting-howto/</a></p><p><a href="https://terraphim.ai/demos/agent-hooks/harbour-hooks-example.zip">Download the Harbour hooks example</a> · <a href="https://terraphim.ai/demos/agent-hooks/transcript.txt">Read the transcript</a></p><h3>Start with the command that fails</h3><p>Harbour’s validator checks that its brief contains a decision, a risk and an owner. The correct command ends with --check. In the baseline run, OpenCode actually attempts:</p><pre>python3 validate-brief.py --chek</pre><p>The argument is misspelled. Python’s argument parser reports that --check is required and exits with status 2. No validation.json is created. The downloadable trace contains the host&#39;s actual tool result, including that output and exit status.</p><p>That distinction matters: the coding host itself can finish normally after reporting a failed tool. Its overall process exit code is not evidence that the validator succeeded. Here we inspect the shell tool’s result and the expected output file.</p><h3>Capture the failure that really happened</h3><p>The included project-local adapter receives OpenCode’s after-tool event. It translates the real command, combined output and exit status into Terraphim’s learning-hook schema, then calls the released agent.</p><p>The saved Markdown learning contains the command, exit code 2 and the parser’s actual error. A new CLI process can list it again. This gives the correction a concrete source: an observed failure, with a saved record that can be inspected.</p><p>The adapter is part of this example. In the tested release, passing a native OpenCode event directly with --format opencode does not by itself establish that a learning was captured. The script checks the resulting file and later readback.</p><h3>Review and promote the correction</h3><p>We add the intended command to the failure record with learn correct. That records a proposed correction. It does not automatically make it a replacement rule: compiling the failure record alone produces zero correction entries in this release.</p><p>The next step is explicit human review and promotion to a tool preference. The reproduction script runs this command inside its isolated store:</p><pre>terraphim-agent learn correction add \<br>  --correction-type tool-preference \<br>  --original &#39;python3 validate-brief.py --chek&#39; \<br>  --corrected &#39;python3 validate-brief.py --check&#39; \<br>  --context &#39;Manually reviewed correction from the captured failure&#39;<br>terraphim-agent learn compile --output compiled-corrections.json<br>terraphim-agent learn export-kg --output kg</pre><p>Compilation now reports one correction. The selected <strong>Harbour Validator</strong> role loads that compiled JSON. The exported Markdown makes the relationship readable:</p><pre># python3 validate-brief.py --check<br>synonyms:: python3 validate-brief.py --chek</pre><p>This uses the same explicit synonyms:: idea as the <a href="https://terraphim.ai/how-tos/synonym-search/">editor-to-search flow</a>. The correction says which command this project prefers. In this walkthrough the hook reads the compiled JSON; exporting a Markdown file alone is not the activation step.</p><h3>Inspect the hook before involving execution</h3><p>First we call the pre-tool hook on a saved input. Without --rewrite, the returned command keeps --chek and includes a warning about a replaceable match. With --rewrite, the returned JSON contains:</p><pre>{<br>  &quot;tool_input&quot;: {&quot;command&quot;: &quot;python3 validate-brief.py --check&quot;},<br>  &quot;tool_name&quot;: &quot;Bash&quot;<br>}</pre><p>That is a hook result. It has not executed Python. The example retains both results so you can compare the disabled and enabled behavior. An unrelated command and a role without this correction remain unchanged.</p><p><a href="https://terraphim.ai/demos/agent-hooks/screenshots/hook-output.jpg">The actual hook outputs preserve the typo with rewriting disabled and return the corrected command with rewriting enabled</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bCnUUZhR4CfxGZPz4zQqvw.jpeg" /></figure><h3>Verify what the coding host actually runs</h3><p>Now start a fresh OpenCode process and ask it to try the same misspelled command. Its before-tool event reaches the adapter. The adapter calls Terraphim with rewriting enabled, then applies the returned command through OpenCode V2’s mutable tool input.</p><p>The after-tool event records python3 validate-brief.py --check. Its exit status is 0. The validator prints a valid Harbour result and writes this file:</p><pre>{<br>  &quot;project&quot;: &quot;Harbour&quot;,<br>  &quot;status&quot;: &quot;valid&quot;,<br>  &quot;fields&quot;: [&quot;Decision&quot;, &quot;Risk&quot;, &quot;Owner&quot;]<br>}</pre><p>The host transcript can still display the model’s original attempted input. That is why the download includes adapter events, the actual tool result and validation.json, as well as the transcript. Together they show the attempted command, the applied correction and the resulting execution.</p><p><a href="https://terraphim.ai/demos/agent-hooks/screenshots/executed-result.jpg">The real after-tool event and saved validation JSON confirm exit zero and the expected Harbour fields</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GLbZ3b8xm9vOk0sXSs6bBQ.jpeg" /></figure><h3>Reproduce it in a new folder</h3><p>The example was verified with <a href="https://github.com/terraphim/terraphim-clients/releases/tag/v1.21.19">terraphim-agent v1.21.19</a> and OpenCode 2.0.20. Follow the ZIP’s README to check the release archive, choose your already authenticated coding model and run:</p><pre>python3 reproduce.py \<br>  --agent /absolute/path/to/terraphim-agent \<br>  --model kimi-code-plan-global/k3 \<br>  --output /absolute/path/to/a-new-harbour-run</pre><p>Use your configured model identifier if it differs. The script uses a new folder for the fixture, settings, learning store and project-local adapter. It does not install global hooks or select a paid fallback. The recorded run used the existing Kimi coding-plan route.</p><p>Read evidence/verification.json, the host events and validation.json. The script fails if the host does not perform the expected command or the saved outputs do not match. You can inspect the source before running it; only the two local validator commands are permitted by the fixture&#39;s host configuration.</p><h3>Keep the scope of the example visible</h3><p>This demonstrates one reviewed correction with one tested host adapter. It does not prove every coding host applies the same JSON, or that failure capture should automatically approve arbitrary substitutions. The earlier memory example and this learning store also remain separate; neither silently copies into the other.</p><p>Use public sample data for this release’s learning capture. Tests with deliberately fake secret-shaped values found redaction gaps in saved command and working-directory fields, and in some hook passthrough values. The example makes no blanket secret-redaction claim. The coding host uses its configured online model; Terraphim’s demonstrated correction lookup uses the local compiled graph.</p><p><a href="https://terraphim.ai/demos/agent-hooks/harbour-hooks-example.zip">Download the example and saved outputs</a> to follow the whole chain: a failure that happened, a correction someone reviewed, and a later command whose result can be checked.</p><p>*Updated 13 October 2026. The video uses synthetic British female narration and readable excerpts from actual released-binary and host outputs. The Harbour project is fictional public sample data.*</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c4cdc9a4fbf2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/terraphim-ai/a-failed-command-a-saved-correction-and-the-next-run-c4cdc9a4fbf2">A failed command, a saved correction, and the next run</a> was originally published in <a href="https://medium.com/terraphim-ai">Terraphim AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A project lesson your coding agent can find next time]]></title>
            <link>https://medium.com/terraphim-ai/a-project-lesson-your-coding-agent-can-find-next-time-7c627a925253?source=rss----663bc011fa12---4</link>
            <guid isPermaLink="false">https://medium.com/p/7c627a925253</guid>
            <dc:creator><![CDATA[Alex Mikhalev]]></dc:creator>
            <pubDate>Tue, 13 Oct 2026 08:21:22 GMT</pubDate>
            <atom:updated>2026-10-13T08:38:49.227Z</atom:updated>
            <content:encoded><![CDATA[<p>Save an authored project instruction, then retrieve the same text through explicit project terminology. The Harbour example includes a released Terraphim agent, a small Markdown knowledge graph, positive and negative checks, and a reproducible download.</p><p>You explain the project’s validation command. The session ends. Next time, the agent needs the same explanation. Keeping the instruction somewhere is useful only if the next run can find the right instruction again.</p><p>This walkthrough saves one lesson from a fictional project, opens it in a new process, and retrieves it through a small knowledge graph. You can inspect the exact saved text and repeat the same checks with the downloadable example.</p><p>Watch the narrated demonstration: <a href="https://terraphim.ai/posts/cold-start-tax-agentic-memory/">https://terraphim.ai/posts/cold-start-tax-agentic-memory/</a></p><p><a href="https://terraphim.ai/demos/agent-memory/harbour-memory-example.zip">Download the Harbour example</a> · <a href="https://terraphim.ai/demos/agent-memory/transcript.txt">Read the transcript</a></p><h3>Start with an instruction worth keeping</h3><p>Harbour is a small public project brief. It records a decision, a risk and an owner. Before publication, its validator checks that all three fields are present. The instruction we want the next session to remember is deliberately specific:</p><pre>Validate the Harbour project brief with python3 validate-brief.py --check.<br>Keep the source decisions in brief.md intact.</pre><p>That gives a future agent an action and a boundary. “Remember to be careful” would be much harder to use. The example also includes the brief and validator, so the instruction has something concrete to refer to.</p><p>The first step is to save this actual text. Download and extract the example, then install <a href="https://github.com/terraphim/terraphim-clients/releases/tag/v1.21.20">terraphim-agent v1.21.20</a>. From the example folder, prepare a new, isolated run before entering the manual commands below:</p><pre>python3 reproduce.py --agent /path/to/terraphim-agent \<br>  --output ./harbour-run --prepare-only<br>cd harbour-run/fixture<br>export TERRAPHIM_DEFAULT_DATA_PATH=&quot;$(cd .. &amp;&amp; pwd)/data&quot;<br>export TERRAPHIM_SETTINGS_PATH=&quot;$(cd .. &amp;&amp; pwd)/settings&quot;</pre><p>Use your actual binary path in the first command and put that same verified binary on your PATH for the remaining commands. Preparation creates the role configuration, settings and lesson.md; it has not captured anything yet. To run all checks automatically instead, omit --prepare-only and choose a fresh output folder.</p><pre>terraphim-agent --format json memory capture \<br>  --file lesson.md \<br>  --provenance-tag harbour-public-brief-v1</pre><p>Capture returns a memory identifier. We use that identifier to inspect the saved item, rather than treating a successful exit code as the whole result. The saved content is the lesson itself, and the provenance tag identifies which public example supplied it.</p><p>--content accepts a short instruction directly. --file is convenient for a multiline note. Both preserve the supplied text. Missing, blank, unreadable or conflicting inputs fail without creating a substitute placeholder.</p><h3>End the process, then open the memory</h3><p>Each command in the demonstration starts a new process. After capture exits, memory show opens the saved identifier. memory list finds the item, and memory export includes the same instruction in JSON.</p><pre>terraphim-agent --format json memory show MEMORY_ID<br>terraphim-agent --format json memory list<br>terraphim-agent memory export --format json --output memories.json</pre><p>Replace MEMORY_ID with the identifier returned by capture. The reproduction script does this automatically and checks that the reopened and exported text exactly matches lesson.md.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mOc4Whi_XUe3aGe00eOkOw.jpeg" /></figure><p>The store has an explicit location. The example sets TERRAPHIM_DEFAULT_DATA_PATH to a new folder for that run; the evolution file lives beneath terraphim/evolution/cli-agent.json. A second empty folder supplies the independent-store check. This keeps the demonstration separate from your existing memory files.</p><p>Without an explicit data root, the agent retains its usual platform configuration-directory location. Changing the root selects another store; it does not silently migrate or merge your previous one.</p><h3>Teach the role the words used by the project</h3><p>Knowing an identifier is useful for inspection. Day to day, you are more likely to ask a question such as “validate brief”. The <strong>Brief Reviewer</strong> role supplies the terminology for that question.</p><p>Its small graph has a <strong>Brief validation</strong> concept:</p><pre># Brief validation<br>synonyms:: validate brief, brief validation, --check</pre><p>A second concept describes the <strong>Project brief</strong>, including brief.md. Both definitions are ordinary Markdown in the download. The saved instruction mentions these concepts, connecting an action with the document it applies to.</p><p>The synonyms:: property makes the relationship visible: “validate brief” and --check are labels for the same concept in this project. You can review or change that relationship. Saving a memory does not invent new terminology or update every other role automatically.</p><p>This is the same explicit-knowledge principle used in the <a href="https://terraphim.ai/how-tos/synonym-search/">editor-to-search example</a>: record the relationship, then use the configured graph to find relevant work. Here the searched material is an authored memory item.</p><h3>Retrieve the instruction, then check the empty cases</h3><p>With the example’s role configuration loaded, this query retrieves the stored lesson:</p><pre>terraphim-agent --config ../config.json memory retrieve &#39;validate brief&#39; \<br>  --role &#39;Brief Reviewer&#39; --format json</pre><p>The result includes the original text, its memory identifier, the provenance tag and a matched concept. It is a retrieved instruction, not a generated paraphrase. The viewer can compare it directly with the file that was captured.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uMvfyIt-ZurEuvkyokei0g.jpeg" /></figure><p>The accompanying controls matter just as much. “Volcanic eruption” returns no memory. The <strong>Finance Reviewer</strong> role, which has budget and grant concepts, does not match the validation query. The same useful query against a separate empty store also returns nothing.</p><p>Those observations distinguish useful retrieval from a command that always prints the latest note. Roles shape which concepts are recognised. They are not an access-control system: use separate stores and ordinary filesystem permissions where separation is required.</p><h3>What happens inside the CLI</h3><p>The agent stores the lesson using Terraphim’s existing evolution types. During retrieval, the role’s thesaurus matches terms, and the role graph ranks memory items by their concept relationships. There is no lexical fallback when a question matches none of the configured concepts.</p><p>This graph uses co-occurrence edges, so the example intentionally connects validation with the project brief. A single isolated concept is not enough to assume the same retrieval behavior. Keep the graph and the note inspectable, and test the questions people will actually ask.</p><p>memory apply can preview proposed context for a prompt. That preview does not execute a command or prove a coding host consumed it. The separate hooks walkthrough will follow the instruction into actual execution. Captured memories and reviewed learning corrections also use different stores; neither is an automatic copy of the other.</p><h3>Try the next run yourself</h3><p>The ZIP contains the public brief, validator, lesson, Markdown concepts, reproduction script and saved outputs. Follow its README to verify the released binary, create an isolated run and compare the positive and negative results. The script checks the saved content, rather than relying on expected screenshots.</p><p><a href="https://terraphim.ai/demos/agent-memory/harbour-memory-example.zip">Download and reproduce the memory example</a>. You can also inspect the <a href="https://terraphim.ai/demos/agent-memory/manifest.json">saved outputs and verification manifest</a>.</p><p>The useful result here is modest and concrete: an instruction survives the process that captured it, and the intended project terminology can find it again. Measuring whether that saves tokens or improves later decisions needs a separate experiment.</p><p>*Updated 13 October 2026 with a reproducible walkthrough. The broader memory-lifecycle vocabulary was inspired by <a href="https://www.memco.ai/field-guide">memco.ai’s field guide</a>. The video uses synthetic British female narration and readable views of actual CLI outputs. The Harbour fixture is public sample data.*</p><p>Originally published at https://terraphim.ai/posts/cold-start-tax-agentic-memory/</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7c627a925253" width="1" height="1" alt=""><hr><p><a href="https://medium.com/terraphim-ai/a-project-lesson-your-coding-agent-can-find-next-time-7c627a925253">A project lesson your coding agent can find next time</a> was originally published in <a href="https://medium.com/terraphim-ai">Terraphim AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Turn a wording alternative into better search]]></title>
            <link>https://medium.com/terraphim-ai/turn-a-wording-alternative-into-better-search-b01e7435eee1?source=rss----663bc011fa12---4</link>
            <guid isPermaLink="false">https://medium.com/p/b01e7435eee1</guid>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[knowledge-graph]]></category>
            <dc:creator><![CDATA[Alex Mikhalev]]></dc:creator>
            <pubDate>Mon, 12 Oct 2026 10:00:07 GMT</pubDate>
            <atom:updated>2026-10-12T18:03:14.523Z</atom:updated>
            <content:encoded><![CDATA[<h3>Turn a wording alternative into a better search</h3><p>The inspiration came from <a href="https://x.com/jasonfried/status/2105403067793584590">Jason Fried’s original Write_On video</a> and its idea of “alternative control”. It prompted me to return to Terraphim Editor, a Rust/WebAssembly project he had abandoned two years earlier, with a clear purpose: connect wording alternatives to a reusable knowledge graph and carry that meaning into search.</p><p>Your project brief says <strong>risk</strong>. Later, you search for <strong>concern</strong>. Terraphim connects the two, so a change in wording doesn&#39;t hide the decisions you need.</p><p><a href="https://terraphim.ai/how-tos/synonym-search/">Watch the 80-second walkthrough</a></p><figure><img alt="Risk and Concern: choose your words, keep the meaning searchable" src="https://cdn-images-1.medium.com/max/1024/0*UJLkTo-HNeDXVj_0.jpg" /></figure><p><a href="https://terraphim.ai/editor/">Try Terraphim Editor</a> · <a href="https://terraphim.ai/demos/synonym-search/transcript.txt">Read the narration</a></p><h4>Choose the words that fit</h4><p>In our community garden brief, timber might arrive late. The team has decided to keep a backup supplier. Add <strong>Concern</strong> as an alternative to <strong>Risk</strong>, then swap between them. The other wording stays attached to the document.</p><h4>Share what those words mean</h4><p>Open <strong>Knowledge graph</strong> from the Markdown export menu. The editor shows <strong>Risk ↔ Concern</strong> and its actual definition:</p><pre>synonyms:: Risk, Concern</pre><p>Download the graph and the clean text. This explicitly shares the document’s authored synonym groups as a Terraphim thesaurus; it does not silently change your active role. The saved example contains <strong>Risk</strong>, with no literal occurrence of <strong>Concern</strong>.</p><h4>Find the decisions using either word</h4><p>Use the graph downloaded from that editing session:</p><pre>terraphim-grep concern --thesaurus knowledge-graph.json --paths corpus -C 2 --search-only --json</pre><p>The actual result contains three risk passages and their related decisions, with file and line locations. No generated answer is requested.</p><p>Replace --search-only with --answer for synthesis:</p><pre>terraphim-grep concern --thesaurus knowledge-graph.json --paths corpus -C 2 --json --answer</pre><p>The video shows the generated summary and its references to the same three passages. Decisions remain decisions: the source doesn&#39;t establish whether they were carried out.</p><p>Editing and local search use your local data. Optional synthesis sends the retrieved passages to your configured model provider.</p><h4>Try the exact files</h4><ul><li><a href="https://terraphim.ai/demos/synonym-search/knowledge-graph.json">The graph downloaded in the recording</a></li><li><a href="https://terraphim.ai/demos/synonym-search/project-brief.md">The clean project brief</a> — place it in a corpus directory</li><li><a href="https://terraphim.ai/demos/synonym-search/annotated.md">Saved Markdown with alternatives</a></li><li><a href="https://terraphim.ai/demos/synonym-search/without-synthesis.json">Actual result without synthesis</a></li><li><a href="https://terraphim.ai/demos/synonym-search/with-synthesis.json">Actual result with synthesis</a></li><li><a href="https://terraphim.ai/demos/synonym-search/synonym-search-example.zip">Download the complete example ZIP</a>, including a step-by-step README</li><li><a href="https://terraphim.ai/demos/synonym-search/captions.srt">English subtitles (SRT)</a></li></ul><p>The community garden brief is authored public sample input. The alternatives, downloaded graph, retrieved passages and generated answer are actual outputs. The command-line section displays those JSON fields in a readable presentation; it is not a separate Terraphim interface. The voice is synthetic British English (Emma). Setup is omitted, and the recorded interaction runs at its original speed. <a href="https://terraphim.ai/demos/synonym-search/manifest.json">Recording details and file identities</a>.</p><h4>Reproduce it with released builds</h4><p><a href="https://terraphim.ai/demos/synonym-search/released-before-sharing.json">before sharing the synonym graph</a>, <a href="https://terraphim.ai/demos/synonym-search/released-without-synthesis.json">without synthesis</a>, and <a href="https://terraphim.ai/demos/synonym-search/released-with-synthesis.json">with synthesis</a>. The baseline used the editor’s default role, which lacks the authored synonym: zero passages became three when the exported graph was supplied. The paired modes retrieved the same passages. <a href="https://terraphim.ai/demos/synonym-search/reproduction.json">Released-build identities, commands and file checksums</a> distinguish this verification from the original recording. A fresh synthesis run may produce different wording.</p><p><a href="https://terraphim.ai/how-tos/knowledge-work-editor/">Earlier browser and Zed host walkthroughs</a> retain their own recorded versions and limitations. This focused story does not qualify all 41 source-video requirements. The Zed fork remains separate.</p><h3>Try it in Obsidian or Logseq</h3><p>Download the <a href="https://terraphim.ai/demos/obsidian-synonym-search/obsidian-synonym-search-example.zip">Obsidian vault</a> or <a href="https://terraphim.ai/demos/logseq-synonym-search/logseq-synonym-search-example.zip">Logseq graph</a>. Both contain a small community-garden project, the concept note, the supplied synonym graph and saved search outputs.</p><p>The Risk concept note owns synonyms:: Risk, Concern. Project notes hold the source passages; the results note holds only saved CLI output. Logseq also uses alias:: Concern for its native page alias.</p><p>Released terraphim-grep 1.21.19 was run against both downloaded ZIPs: each returned zero baseline passages, then three exact project passages with the supplied graph. Search runs in the CLI. Logseq imports a copy of the Markdown; the command reads the extracted folder.</p><p>See the actual <a href="https://terraphim.ai/demos/obsidian-synonym-search/screenshots/03-synonyms-in-knowledge-note.jpg">Obsidian window</a> and <a href="https://terraphim.ai/demos/logseq-synonym-search/screenshots/logseq-graph-view.jpg">Logseq graph view</a>. The graph-view arrows are native Logseq page links, shown beside saved CLI results. Follow the included README to reproduce the search.</p><p>Published by the Terraphim team. Originally published at <a href="https://terraphim.ai/how-tos/synonym-search/">https://terraphim.ai/how-tos/synonym-search/.</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b01e7435eee1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/terraphim-ai/turn-a-wording-alternative-into-better-search-b01e7435eee1">Turn a wording alternative into better search</a> was originally published in <a href="https://medium.com/terraphim-ai">Terraphim AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Plug Terraphim Search into Claude Code and opencode (CLI First, MCP When You Need It)]]></title>
            <link>https://medium.com/terraphim-ai/plug-terraphim-search-into-claude-code-and-opencode-cli-first-mcp-when-you-need-it-a9644c2bcb8c?source=rss----663bc011fa12---4</link>
            <guid isPermaLink="false">https://medium.com/p/a9644c2bcb8c</guid>
            <category><![CDATA[claude-code]]></category>
            <category><![CDATA[mcps]]></category>
            <category><![CDATA[open-code]]></category>
            <category><![CDATA[terraphim]]></category>
            <category><![CDATA[knowledge-graph]]></category>
            <dc:creator><![CDATA[Alex Mikhalev]]></dc:creator>
            <pubDate>Sat, 18 Apr 2026 16:52:41 GMT</pubDate>
            <atom:updated>2026-04-18T16:52:40.963Z</atom:updated>
            <content:encoded><![CDATA[<p>Your AI coding agent already has a knowledge graph. It is just not yours yet. The model knows GitHub and Stack Overflow; it has no idea that in your project npm should be bun, that RFP is INCOSE shorthand for acquisition need, or that the Stripe receipt for the Obsidian licence lives in your Fastmail mailbox.</p><p>Two ways to fix that. CLI first.</p><p>The recommended path is a two-line slash command: drop a tsearch.md file into ~/.claude/commands/ and an identical copy into ~/.config/opencode/command/, both shelling out to terraphim-agent search --role &quot;&lt;role&gt;&quot; --limit 5 &quot;&lt;query&gt;&quot;. Zero new binaries. Works in either host. Three roles ready out of the box -- Terraphim Engineer (Rust/agent KG), Personal Assistant (Obsidian + Fastmail JMAP), System Operator (1,347-page Logseq MBSE KG).</p><p>The MCP server path — terraphim_mcp_server registered via claude mcp add and an entry in opencode.json -- earns its keep when you also want autocomplete-as-you-type or update_config_tool exposed to the model. Both paths read the same ~/.config/terraphim/embedded_config.json, so the role list is identical. Wire one or both.</p><p>The full write-up walks the slash command file, the MCP registration commands for both hosts, the SessionStart primer that tells the model which role to pick, and three concrete example queries with the rank values they return.</p><p><strong>Read the full post: </strong><a href="https://terraphim.ai/posts/terraphim-search-in-claude-code-and-opencode/"><strong>Plug Terraphim Search into Claude Code and opencode on terraphim.ai</strong></a></p><p>How-to in the docs: <a href="https://docs.terraphim.ai/howto/mcp-integration-claude-opencode.html"><strong>mcp-integration-claude-opencode on docs.terraphim.ai</strong></a></p><p>Mirror on dev.to: <a href="https://dev.to/alexmikhalev/plug-terraphim-search-into-claude-code-and-opencode-cli-first-mcp-when-you-need-it-4404">https://dev.to/alexmikhalev/plug-terraphim-search-into-claude-code-and-opencode-cli-first-mcp-when-you-need-it-4404</a></p><p>Why deterministic graph embeddings make this practical: <a href="https://terraphim.ai/posts/why-graph-embeddings-matter/">Why Graph Embeddings Matter</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a9644c2bcb8c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/terraphim-ai/plug-terraphim-search-into-claude-code-and-opencode-cli-first-mcp-when-you-need-it-a9644c2bcb8c">Plug Terraphim Search into Claude Code and opencode (CLI First, MCP When You Need It)</a> was originally published in <a href="https://medium.com/terraphim-ai">Terraphim AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[System Operator Demo: A Logseq Knowledge Graph Drives Enterprise MBSE Search]]></title>
            <link>https://medium.com/terraphim-ai/system-operator-demo-a-logseq-knowledge-graph-drives-enterprise-mbse-search-a61c94029069?source=rss----663bc011fa12---4</link>
            <guid isPermaLink="false">https://medium.com/p/a61c94029069</guid>
            <category><![CDATA[mbse]]></category>
            <category><![CDATA[systems-engineering]]></category>
            <category><![CDATA[terraphim]]></category>
            <category><![CDATA[knowledge-graph]]></category>
            <category><![CDATA[logseq]]></category>
            <dc:creator><![CDATA[Alex Mikhalev]]></dc:creator>
            <pubDate>Sat, 18 Apr 2026 16:52:28 GMT</pubDate>
            <atom:updated>2026-04-18T16:52:28.754Z</atom:updated>
            <content:encoded><![CDATA[<p>Terraphim’s System Operator role is the demo we point people at when they want to see a real Logseq knowledge graph drive search — 1,347 Logseq pages, 52 of them carrying explicit synonyms:: lines, covering Model-Based Systems Engineering vocabulary.</p><p>The knowledge graph is doing real work. When you type RFP, Terraphim&#39;s Aho-Corasick automaton normalises it to acquisition need -- the canonical INCOSE term -- because that is the mapping in Acquisition need.md. life cycle model collapses to life cycle concepts. business analysis collapses to business or mission analysis. The ranker walks the graph from there. None of this is text matching; the word RFP never appears in the canonical page body.</p><p>The post walks the full demo: automated setup script now clones to a durable ~/.config/terraphim/system_operator path (not /tmp), three roles ready (System Operator, Engineer, Default), integration test you can run in one command. Also compares to the local-first Personal Assistant pattern we <a href="https://terraphim.ai/posts/personal-assistant-role-jmap-obsidian/">wrote up yesterday</a> -- same engine, different haystacks.</p><p><strong>Read the full post: </strong><a href="https://terraphim.ai/posts/system-operator-logseq-knowledge-graph/"><strong>System Operator Demo on terraphim.ai</strong></a></p><p>Repository: <a href="https://github.com/terraphim/system-operator">github.com/terraphim/system-operator</a></p><p>Mirror on dev.to: <a href="https://dev.to/alexmikhalev/system-operator-demo-a-logseq-knowledge-graph-drives-enterprise-mbse-search-1kb">https://dev.to/alexmikhalev/system-operator-demo-a-logseq-knowledge-graph-drives-enterprise-mbse-search-1kb</a></p><p>Why deterministic graph embeddings make this practical at scale: <a href="https://terraphim.ai/posts/why-graph-embeddings-matter/">Why Graph Embeddings Matter</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a61c94029069" width="1" height="1" alt=""><hr><p><a href="https://medium.com/terraphim-ai/system-operator-demo-a-logseq-knowledge-graph-drives-enterprise-mbse-search-a61c94029069">System Operator Demo: A Logseq Knowledge Graph Drives Enterprise MBSE Search</a> was originally published in <a href="https://medium.com/terraphim-ai">Terraphim AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Personal Assistant Role: One Search Across Email and Notes]]></title>
            <link>https://medium.com/terraphim-ai/personal-assistant-role-one-search-across-email-and-notes-42000babeb3b?source=rss----663bc011fa12---4</link>
            <guid isPermaLink="false">https://medium.com/p/42000babeb3b</guid>
            <category><![CDATA[jmap]]></category>
            <category><![CDATA[terraphim]]></category>
            <category><![CDATA[knowledge-graph]]></category>
            <category><![CDATA[personal-assistant]]></category>
            <category><![CDATA[obsidian]]></category>
            <dc:creator><![CDATA[Alex Mikhalev]]></dc:creator>
            <pubDate>Fri, 17 Apr 2026 16:25:53 GMT</pubDate>
            <atom:updated>2026-04-17T16:25:53.209Z</atom:updated>
            <content:encoded><![CDATA[<p>Most “personal AI” tools split your context across silos: one box for email, another for notes, a third for your chat history. Terraphim treats every source as a haystack on the same role, so a single query crosses them all.</p><p>The new Personal Assistant role wires up the two most common personal sources — a Fastmail mailbox via JMAP and an Obsidian vault on disk — under a single Terraphim role. Ranking is the same terraphim-graph scoring used everywhere else: an Aho-Corasick automaton built from the vault contributes synonyms specific to your project vocabulary, then both haystacks share the same rank ladder. Notes and email interleave by relevance, not by source.</p><p>The Fastmail token is never in the config file — it is injected at runtime via op run from 1Password, so the secret never lands on disk. A small wrapper script makes invocation a one-liner.</p><p>The full write-up — with the JSON snippet for the role, the wrapper script pattern, the three verification queries, and a note on why the published terraphim-agent on crates.io needs a local rebuild for JMAP today -- is on terraphim.ai:</p><p><strong>Read the full post: </strong><a href="https://terraphim.ai/posts/personal-assistant-role-jmap-obsidian/"><strong>Personal Assistant Role on terraphim.ai</strong></a></p><p>The step-by-step how-to lives in the docs: <a href="https://docs.terraphim.ai/howto/personal-assistant-role.html"><strong>Personal Assistant Role on docs.terraphim.ai</strong></a></p><p>Mirror on dev.to: <a href="https://dev.to/alexmikhalev/personal-assistant-role-one-search-across-email-and-notes-5691">https://dev.to/alexmikhalev/personal-assistant-role-one-search-across-email-and-notes-5691</a></p><p>Why this even works at sub-millisecond latency without a vector database is the subject of <a href="https://terraphim.ai/posts/why-graph-embeddings-matter/">Why Graph Embeddings Matter</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=42000babeb3b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/terraphim-ai/personal-assistant-role-one-search-across-email-and-notes-42000babeb3b">Personal Assistant Role: One Search Across Email and Notes</a> was originally published in <a href="https://medium.com/terraphim-ai">Terraphim AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why Graph Embeddings Matter]]></title>
            <link>https://medium.com/terraphim-ai/why-graph-embeddings-matter-344941c174b8?source=rss----663bc011fa12---4</link>
            <guid isPermaLink="false">https://medium.com/p/344941c174b8</guid>
            <category><![CDATA[terraphim]]></category>
            <category><![CDATA[knowledge-graph]]></category>
            <category><![CDATA[aho-corasick]]></category>
            <category><![CDATA[graph-embedding]]></category>
            <category><![CDATA[context-engineering]]></category>
            <dc:creator><![CDATA[Alex Mikhalev]]></dc:creator>
            <pubDate>Fri, 17 Apr 2026 11:17:08 GMT</pubDate>
            <atom:updated>2026-04-17T11:17:08.718Z</atom:updated>
            <content:encoded><![CDATA[<p>Vector databases are probabilistic and slow. Graph embeddings are deterministic and sub-millisecond. If you are building context for an AI coding agent — or any system where you need to know <em>why</em> a result came back — the difference is not academic. It changes what your application is allowed to promise.</p><h4>The Pitch in One Paragraph</h4><p>Terraphim represents concepts as nodes in a knowledge graph and ranks them by how many synonyms and edges connect them. There is no embedding model, no GPU, no per-query distance computation in a 1024-dimensional space. There is an <a href="https://en.wikipedia.org/wiki/Aho%E2%80%93Corasick_algorithm">Aho-Corasick</a> automaton built once, queried in O(n+m+z) time over the input length plus the number of matches. The mechanism is described in detail on the <a href="https://terraphim.ai/docs/graph-embeddings/">Graph Embeddings reference</a> page; this post is about why it matters.</p><h4>The Numbers</h4><p>Three numbers carry the argument. Each is reproducible on a laptop.</p><ul><li><strong>1.4 million patterns matched in under one millisecond, with under 4 GB of RAM.</strong> That is the working set behind a multi-role knowledge graph — operator, engineer, analyst — held resident in the same process that serves the query.</li><li><strong>5–10 nanoseconds per knowledge-graph inference step.</strong> Not microseconds. Nanoseconds. Once the automaton is built, traversal is a tight loop over byte slices and graph edges, and modern CPUs are extremely good at that.</li><li><strong>20 milliseconds to rebuild the embeddings for a role from scratch.</strong> Rename a synonym, add a new term, drop an obsolete one — the whole role’s graph is reconstituted before your editor has rendered the next frame.</li></ul><p>For comparison, a typical vector-DB nearest-neighbour query lands in the 5–50 ms range <em>after</em> you have paid the embedding API call (50–500 ms) and the network round-trip. We are not in the same regime.</p><h4>Three Consequences</h4><p>The numbers are interesting on their own. The reason they matter is what they let you build.</p><h4>1. Full Explainability</h4><p>Every match in Terraphim traces back to a specific edge in the knowledge graph and a specific synonym in a specific role. There is no “the model said so.” When a search returns a document, you can show the user exactly which terms matched, which role’s graph supplied the synonym, and which edges connected them. That is not a debugging nicety — it is a regulatory requirement in any domain where you have to defend a decision after the fact. Healthcare, legal, finance, government. Vector search by construction cannot do this.</p><h4>2. No Training, No Retraining, No Fine-Tuning</h4><p>Adding a new concept is a text edit. You write the synonym down, you point Terraphim at the file, the graph rebuilds in 20 ms. There is no training run, no GPU bill, no “we need to schedule a retrain on the new corpus.” This collapses the loop between <em>noticing a gap</em> and <em>fixing the gap</em> from days or weeks to seconds. For an AI coding agent that needs to learn a project’s vocabulary as you onboard, this is the difference between a working tool and a stalled rollout.</p><h4>3. Language-Agnostic Without Language Detection</h4><p>Because matching is done on normalised terms — synonyms you supply explicitly — the same node in the graph can carry English, French, Russian, and Mandarin labels at no extra cost. There is no language-detection step, no per-language embedding model, no separate index. The query “consensus” and the query “консенсус” both reach the same node if you have told the graph they are synonyms. Stop-word lists become irrelevant: if a word is not in the graph, it does not match, full stop.</p><h4>What This Lets You Do</h4><p>The pieces above are infrastructure. The story arc continues:</p><ul><li><strong>Build hooks that transform AI coding agent output deterministically.</strong> When Claude Code suggests npm install, intercept it via a graph-embeddings match and replace it with bun install. We wrote this up at <a href="https://terraphim.ai/posts/teaching-ai-agents-with-knowledge-graphs/">Teaching AI Coding Agents with Knowledge Graph Hooks</a> — that post is the <em>demo</em> of what this engine enables.</li><li><strong>Capture and reuse mistakes.</strong> When an agent gets corrected, store the correction as a new synonym and the next session never repeats it. See <a href="https://terraphim.ai/posts/teaching-ai-agents-to-learn-from-mistakes/">Teaching AI Agents to Learn from Their Mistakes</a> and <a href="https://terraphim.ai/posts/learning-via-negativa/">Learning via Negativa</a>.</li><li><strong>Run the whole thing in a 4 GB process on your laptop with no network calls.</strong> The compactness is not an accident — it is the engineering brief from the <a href="https://terraphim.ai/capabilities/origin-story/">Origin Story</a>, which explains where the design came from and why it has stayed this small.</li></ul><h4>How to Apply</h4><p>If you want to wire this into your own project, the <a href="https://terraphim.ai/how-tos/command-rewriting-howto/">Command Rewriting How-to</a> walks through the moving parts: where to put your synonyms, how the role graph is built, how hooks call the matcher.</p><p>The mechanism — automata, ranking formula, ASCII walk-through — is on the <a href="https://terraphim.ai/docs/graph-embeddings/">Graph Embeddings reference</a> page. Read that next if you want the data structures.</p><h4>Why Bother Saying This Out Loud</h4><p>The current default in the AI tooling ecosystem is to reach for a vector database the moment anyone mentions “semantic search.” It is the path of least resistance because the tools are well-marketed and the API surface is familiar. But for a large class of problems — explainability-first systems, on-device agents, anywhere you need a hard latency budget or a hard explainability guarantee — graph embeddings are the better-engineered answer. Not the only answer; the better one for that class.</p><p>The promotion campaign over the next few weeks goes deeper: a <a href="https://terraphim.ai/posts/sub-millisecond-context-knowledge-graphs/">sub-millisecond context article</a> walks through the FST/Aho-Corasick implementation, and the <em>Context Engineering with Knowledge Graphs</em> book (launching in May) puts it in the wider context of moving from RAG to context graphs.</p><p>Until then: read the reference, try the how-to, and let us know in <a href="https://terraphim.discourse.group/">Discourse</a> what you build with it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=344941c174b8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/terraphim-ai/why-graph-embeddings-matter-344941c174b8">Why Graph Embeddings Matter</a> was originally published in <a href="https://medium.com/terraphim-ai">Terraphim AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Disciplined Engineering: How We Build AI Systems That Actually Work]]></title>
            <link>https://medium.com/terraphim-ai/disciplined-engineering-how-we-build-ai-systems-that-actually-work-bc83b445173f?source=rss----663bc011fa12---4</link>
            <guid isPermaLink="false">https://medium.com/p/bc83b445173f</guid>
            <category><![CDATA[developer-tools]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[rust]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[engineering]]></category>
            <dc:creator><![CDATA[Alex Mikhalev]]></dc:creator>
            <pubDate>Thu, 16 Apr 2026 15:41:53 GMT</pubDate>
            <atom:updated>2026-04-16T15:41:53.042Z</atom:updated>
            <content:encoded><![CDATA[<p>AI coding agents are making us worse engineers, unless we add discipline back. Here is what we do instead of vibe coding, and how you can do it too in 30 seconds.</p><h4>The Vibe Coding Problem</h4><p>Every AI-generated pull request we review has the same pattern:</p><ul><li><strong>Scope creep</strong> beyond the original task. You ask for a bug fix, you get a refactored module.</li><li><strong>No traceability</strong> from requirements to tests. The agent shipped code, but nobody verified it does what was actually asked.</li><li><strong>Knowledge lost between sessions.</strong> Each conversation starts from scratch. Yesterday’s design decisions evaporate overnight.</li></ul><p>The agent shipped code. It even passed the tests. But the tests were written by the same agent that wrote the code, optimising for the metric rather than understanding the problem.</p><p>The missing piece is not better models. It is engineering discipline. AI agents need the same rigour humans use: understand the problem before coding, verify against the design, validate against requirements. We encoded this as executable skills that any AI coding agent can follow.</p><h4>The V-Model: Adding Discipline Back</h4><p>We built a V-model for AI agents. The left side asks “what should we build?” The right side asks “did we build it correctly?”</p><figure><img alt="The V-Model for AI Agents" src="https://cdn-images-1.medium.com/max/1024/0*tJWQ3HWBQXUNeuAp.png" /></figure><h4>Phase 1: Research</h4><p>Before writing any code, the agent must understand the problem space:</p><ul><li>Search existing knowledge graphs for relevant patterns</li><li>Identify language-specific constraints</li><li>Determine optimal context window for target language</li><li>Find similar implementations in the codebase</li></ul><h4>Phase 2: Design</h4><p>Create a specification before implementation:</p><ul><li>Define interfaces and data structures</li><li>Identify cross-language considerations</li><li>Plan for compiler feedback integration</li><li>Document the “why” not just the “what”</li></ul><h4>Phase 3: Implementation</h4><p>Write code with tests from the start:</p><ul><li>Language-appropriate context management</li><li>Compiler feedback integration points</li><li>Type-safe by default (for typed languages)</li><li>Self-documenting through clear structure</li></ul><h4>Phase 4: Verification</h4><p>Verify against the design, not just tests:</p><ul><li>Type-checking passes</li><li>Linting passes</li><li>Compiler warnings addressed</li><li>Design intent preserved</li></ul><h4>Phase 5: Validation</h4><p>Validate against the original requirements:</p><ul><li>Does it solve the actual problem?</li><li>Are there simpler alternatives?</li><li>What’s the maintenance burden?</li></ul><h4>terraphim-skills: 32+ Executable Disciplines</h4><p>We packaged the V-model as executable skills you can add to any AI agent:</p><pre>npx skills add terraphim/terraphim-skills</pre><p>This installs skills that enforce:</p><ul><li><strong>disciplined-research</strong>: Understand before building</li><li><strong>disciplined-design</strong>: Plan before coding</li><li><strong>disciplined-implementation</strong>: Build with tests</li><li><strong>disciplined-verification</strong>: Verify against design</li><li><strong>disciplined-validation</strong>: Validate against requirements</li></ul><p>Each skill is a self-contained prompt that guides the agent through the phase’s inputs, outputs, and quality gates.</p><h4>Quality Gates: The Judge System</h4><p>Our judge system (Kimi K2.5) catches what humans miss:</p><ul><li>90% verdict agreement with human reviewers</li><li>62.5% NO-GO detection rate on genuinely flawed code</li><li>~9s average review latency</li></ul><p>Automated quality gates, zero manual overhead. Every PR reviewed before it merges.</p><h4>Guard Rails in Practice</h4><p>AI agents do not type commands into a terminal. They invoke tools programmatically, and they do not always get it right. “Cleaning up build artefacts” becomes rm -rf ./src (one-character typo). &quot;Resetting to last commit&quot; becomes git reset --hard (uncommitted work gone). You need a safety net that operates between the agent and your shell.</p><p>We use two layers of guard rails:</p><p><strong>Layer 1: git-safety-guard</strong> (a terraphim-skill that runs as a PreToolUse hook):</p><ul><li>Blocks git reset --hard, git push --force, rm -rf and similar destructive commands before they execute</li><li>Checks for secrets in diffs before commits</li><li>Validates commit message format</li><li>Zero configuration: install the skill, protection is immediate</li></ul><p><strong>Layer 2: </strong><a href="https://github.com/Dicklesworthstone/destructive_command_guard"><strong>Destructive Command Guard (DCG)</strong></a> by Jeff Emanuel, integrated via tool hooks:</p><ul><li>A Rust binary using SIMD-accelerated pattern matching</li><li>Intercepts every shell command the agent attempts to run</li><li>Returns allow/block verdicts in under 1ms</li><li>Works with Claude Code, OpenCode, and any agent that exposes a pre-execution hook</li></ul><p>The architecture is simple: the agent calls a bash tool, the hook pipes the command to DCG as JSON, DCG pattern-matches against known destructive commands, and blocks execution before damage occurs. The agent receives an error explaining why, and can adjust its approach.</p><h4>Real Example: AI Dark Factory</h4><p>We run 12+ AI agents overnight on a single machine, coordinated by a Rust orchestrator. Each agent follows the V-model:</p><ul><li><strong>Safety agents</strong> run continuously with automatic restart and cooldown. They handle monitoring, log analysis, and drift detection. If one crashes, the orchestrator waits 15 minutes before restarting (up to 3 times) to prevent crash loops.</li><li><strong>Core agents</strong> are scheduled via cron. They pick the highest-priority unblocked issue from the Gitea board (ranked by PageRank across the dependency graph), claim it, branch, implement with tests, and open a pull request.</li><li><strong>Growth agents</strong> run on demand for research, code review, and content generation.</li></ul><p>Every agent’s output passes through the judge system before merge. The morning routine is reviewing verdicts, not debugging overnight chaos. When an agent produces a NO-GO verdict, the PR is flagged with the specific issues: missing test coverage, undocumented API changes, or security concerns.</p><p>This is disciplined engineering at scale: not process overhead, but automated quality gates that catch problems before they compound.</p><h4>Conclusion</h4><p>The gap between what AI agents can do and what they should do is real. It is not a technology gap: it is a discipline gap. The V-model and 32+ executable skills we built are available today:</p><pre>npx skills add terraphim/terraphim-skills</pre><p>Add discipline back. Your future self will thank you.</p><p><em>Deeper dive: The V-model and quality gates we use are detailed in Chapters 3–4 of “Context Engineering with Knowledge Graphs”. Coming soon.</em></p><p><strong>Related posts:</strong></p><ul><li><a href="https://terraphim.ai/posts/teaching-ai-agents-with-knowledge-graphs/">Teaching AI Coding Agents with Knowledge Graph Hooks</a></li><li><a href="https://terraphim.ai/posts/teaching-ai-agents-to-learn-from-mistakes/">Teaching AI Agents to Learn from Their Mistakes</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bc83b445173f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/terraphim-ai/disciplined-engineering-how-we-build-ai-systems-that-actually-work-bc83b445173f">Disciplined Engineering: How We Build AI Systems That Actually Work</a> was originally published in <a href="https://medium.com/terraphim-ai">Terraphim AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>