<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: NEXT4I DEV</title>
    <description>The latest articles on DEV Community by NEXT4I DEV (@dev_next4i).</description>
    <link>https://dev.to/dev_next4i</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4057697%2Fb9191896-5c71-46c0-985e-6c58c3c85ffb.png</url>
      <title>DEV Community: NEXT4I DEV</title>
      <link>https://dev.to/dev_next4i</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/dev_next4i"/>
    <language>en</language>
    <item>
      <title>How to Write an AI Agent Skill File That Reduces Guesswork</title>
      <dc:creator>NEXT4I DEV</dc:creator>
      <pubDate>Mon, 14 Sep 2026 16:58:08 +0000</pubDate>
      <link>https://dev.to/dev_next4i/how-to-write-an-ai-agent-skill-file-that-reduces-guesswork-2cn9</link>
      <guid>https://dev.to/dev_next4i/how-to-write-an-ai-agent-skill-file-that-reduces-guesswork-2cn9</guid>
      <description>&lt;p&gt;A prompt can tell an agent what to do once. A skill file can document how a team handles that class of work repeatedly.&lt;/p&gt;

&lt;p&gt;For developers, the distinction matters. An agent may have repository access and the right tools, yet still has to make decisions about scope, references, validation, and failure handling. If those decisions are undefined, a technically valid result can still be the wrong result.&lt;/p&gt;

&lt;p&gt;This guide builds a small, generic skill for reviewing API changes. The point is not to prescribe one universal Agent Skills format. It is to show how to turn vague intent into an executable workflow.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Skill discovery, instruction loading, and tool use vary by model, agent runtime, system instructions, and available tools. Treat the structure below as a portable design pattern, then adapt it to your platform.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  The problem with a reasonable instruction
&lt;/h2&gt;

&lt;p&gt;Consider this prompt:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Review this API and make sure it follows best practices.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It sounds clear, but the agent still has to decide:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Which API contract is authoritative?&lt;/li&gt;
&lt;li&gt;Does the review include authentication and permissions?&lt;/li&gt;
&lt;li&gt;Should it modify code or only produce a report?&lt;/li&gt;
&lt;li&gt;Which tests should it run?&lt;/li&gt;
&lt;li&gt;What should it do when information is missing?&lt;/li&gt;
&lt;li&gt;What does a completed review contain?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Different models may fill those gaps differently. The result can be reasonable without matching the workflow you intended.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prompt versus skill
&lt;/h2&gt;

&lt;p&gt;I use this distinction:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A prompt says, “Do this task now.”&lt;/li&gt;
&lt;li&gt;A skill says, “This is how we handle this type of task.”&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A useful skill does not make a model magically smarter. It makes the operating boundaries visible.&lt;/p&gt;

&lt;p&gt;At minimum, it should define:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Trigger: when the skill applies&lt;/li&gt;
&lt;li&gt;Goal: what outcome it should produce&lt;/li&gt;
&lt;li&gt;Scope: what is included and excluded&lt;/li&gt;
&lt;li&gt;Workflow: steps the agent can follow&lt;/li&gt;
&lt;li&gt;References: information to read under specific conditions&lt;/li&gt;
&lt;li&gt;Constraints: actions and claims that are prohibited&lt;/li&gt;
&lt;li&gt;Uncertainty handling: what to do when evidence is missing&lt;/li&gt;
&lt;li&gt;Completion criteria: how to validate the result&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  A practical directory structure
&lt;/h2&gt;

&lt;p&gt;Start with one file while the workflow is small. Split it when references, examples, or reusable scripts become large enough to distract from the main instructions.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;api-review-skill/
├── SKILL.md
├── references/
│   ├── api-contract.md
│   ├── security-rules.md
│   ├── output-examples.md
│   └── troubleshooting.md
├── scripts/
│   └── validate.sh
└── assets/
    └── review-template.md
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The exact file names and supported directories depend on the platform and runtime. More importantly, models may not select or load these files in the same way. The main file should therefore explain why and when each reference matters.&lt;/p&gt;

&lt;h2&gt;
  
  
  A generic &lt;code&gt;SKILL.md&lt;/code&gt; example
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="nn"&gt;---&lt;/span&gt;
&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;api-change-review&lt;/span&gt;
&lt;span class="na"&gt;description&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Review&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;API&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;changes&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;for&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;contract&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;compatibility,"&lt;/span&gt;
  &lt;span class="s"&gt;security boundaries, and required validation. Use when an&lt;/span&gt;
  &lt;span class="s"&gt;endpoint, request schema, response schema, authentication,&lt;/span&gt;
  &lt;span class="s"&gt;or permission behavior changes.&lt;/span&gt;
&lt;span class="nn"&gt;---&lt;/span&gt;

&lt;span class="gh"&gt;# API Change Review&lt;/span&gt;

&lt;span class="gu"&gt;## Goal&lt;/span&gt;

Produce a review report that identifies contract-breaking changes,
security-sensitive changes, missing validation, and unresolved assumptions.

&lt;span class="gu"&gt;## Scope&lt;/span&gt;

Review the proposed change and related tests.
Do not modify implementation files unless the user requests edits.

&lt;span class="gu"&gt;## Workflow&lt;/span&gt;
&lt;span class="p"&gt;
1.&lt;/span&gt; Read the changed files and the API contract.
&lt;span class="p"&gt;2.&lt;/span&gt; Identify changes to endpoints, fields, status codes, and behavior.
&lt;span class="p"&gt;3.&lt;/span&gt; If authentication, secrets, or permissions are involved,
   read the security rules.
&lt;span class="p"&gt;4.&lt;/span&gt; Compare the tests with the changed behavior.
&lt;span class="p"&gt;5.&lt;/span&gt; Produce the required report.
&lt;span class="p"&gt;6.&lt;/span&gt; Run the validation command when the environment supports it.

&lt;span class="gu"&gt;## Reference routing&lt;/span&gt;
&lt;span class="p"&gt;
-&lt;/span&gt; Read &lt;span class="sb"&gt;`references/api-contract.md`&lt;/span&gt; for endpoint or schema changes.
&lt;span class="p"&gt;-&lt;/span&gt; Read &lt;span class="sb"&gt;`references/security-rules.md`&lt;/span&gt; for authentication,
  secrets, or permission changes.
&lt;span class="p"&gt;-&lt;/span&gt; Read &lt;span class="sb"&gt;`references/output-examples.md`&lt;/span&gt; only when the report format
  is unclear.
&lt;span class="p"&gt;-&lt;/span&gt; Read &lt;span class="sb"&gt;`references/troubleshooting.md`&lt;/span&gt; when validation fails.

&lt;span class="gu"&gt;## Constraints&lt;/span&gt;
&lt;span class="p"&gt;
-&lt;/span&gt; Do not invent endpoints, fields, metrics, or test results.
&lt;span class="p"&gt;-&lt;/span&gt; Do not expose credentials, customer data, or internal URLs.
&lt;span class="p"&gt;-&lt;/span&gt; Do not present an unimplemented requirement as released behavior.
&lt;span class="p"&gt;-&lt;/span&gt; Flag assumptions that require human review.

&lt;span class="gu"&gt;## Required output&lt;/span&gt;
&lt;span class="p"&gt;
1.&lt;/span&gt; Summary
&lt;span class="p"&gt;2.&lt;/span&gt; Contract-breaking changes
&lt;span class="p"&gt;3.&lt;/span&gt; Security-sensitive changes
&lt;span class="p"&gt;4.&lt;/span&gt; Missing or affected tests
&lt;span class="p"&gt;5.&lt;/span&gt; Assumptions requiring review
&lt;span class="p"&gt;6.&lt;/span&gt; Validation performed

&lt;span class="gu"&gt;## Completion criteria&lt;/span&gt;
&lt;span class="p"&gt;
-&lt;/span&gt; Every changed behavior is mapped to the contract.
&lt;span class="p"&gt;-&lt;/span&gt; Security-sensitive changes are explicitly identified.
&lt;span class="p"&gt;-&lt;/span&gt; Validation results state what was and was not run.
&lt;span class="p"&gt;-&lt;/span&gt; Unresolved assumptions are visible.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This example is intentionally generic. It demonstrates an instruction contract, not a claim about one platform's required syntax.&lt;/p&gt;

&lt;h2&gt;
  
  
  Before and after
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Before
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Review this API and make sure it follows best practices.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  After
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Review the API change using the api-change-review skill.

Use `references/api-contract.md` as the contract source.
If the change touches authentication, secrets, or permissions,
also apply `references/security-rules.md`.

Produce the required review report. Do not modify implementation files.
State which validation commands were run and flag unresolved assumptions.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The second instruction is not better because it is longer. It is better because fewer operational decisions are left undefined.&lt;/p&gt;

&lt;h2&gt;
  
  
  Turn the index into a routing table
&lt;/h2&gt;

&lt;p&gt;A file list tells an agent what exists. A routing table explains when a file becomes relevant.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Reference&lt;/th&gt;
&lt;th&gt;Read when&lt;/th&gt;
&lt;th&gt;Skip when&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;api-contract.md&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;An endpoint, schema, status code, or behavior changes&lt;/td&gt;
&lt;td&gt;The task does not involve an API contract&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;security-rules.md&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Authentication, secrets, roles, or permissions are involved&lt;/td&gt;
&lt;td&gt;The task has no security-sensitive behavior&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;output-examples.md&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The required report shape is unclear&lt;/td&gt;
&lt;td&gt;The output contract is already explicit&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;troubleshooting.md&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Validation cannot run or fails&lt;/td&gt;
&lt;td&gt;Validation succeeds normally&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;This table is guidance, not an enforcement mechanism. Actual reference selection still depends on the model, runtime, context strategy, and tools.&lt;/p&gt;

&lt;h2&gt;
  
  
  Single file or multiple files?
&lt;/h2&gt;

&lt;p&gt;Keep the skill in one file when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;it has one short workflow&lt;/li&gt;
&lt;li&gt;all constraints fit without hiding the main steps&lt;/li&gt;
&lt;li&gt;examples are small&lt;/li&gt;
&lt;li&gt;no reusable scripts are needed&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Split the skill when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;references are long or domain-specific&lt;/li&gt;
&lt;li&gt;several workflows share the same rules&lt;/li&gt;
&lt;li&gt;examples make the main file difficult to scan&lt;/li&gt;
&lt;li&gt;validation scripts are reusable&lt;/li&gt;
&lt;li&gt;sensitive rules require separate ownership or review&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The main file should remain enough to answer two questions: What should the agent do, and where should it look next?&lt;/p&gt;

&lt;h2&gt;
  
  
  Treat skills like software
&lt;/h2&gt;

&lt;p&gt;A skill can contain instructions, references, and executable code. Review an external skill before using it, especially when it can access files, call a network service, or run scripts.&lt;/p&gt;

&lt;p&gt;Check for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;file access outside the expected scope&lt;/li&gt;
&lt;li&gt;network and API destinations&lt;/li&gt;
&lt;li&gt;hardcoded credentials&lt;/li&gt;
&lt;li&gt;destructive file operations&lt;/li&gt;
&lt;li&gt;hidden instructions that attempt to bypass system rules&lt;/li&gt;
&lt;li&gt;scripts whose behavior has not been reviewed&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For organizational use, sandboxing and coexistence tests may also be appropriate. Different models can respond to the same instruction or tool surface differently.&lt;/p&gt;

&lt;h2&gt;
  
  
  Validation checklist
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="p"&gt;-&lt;/span&gt; [ ] The description states when the skill should trigger.
&lt;span class="p"&gt;-&lt;/span&gt; [ ] The goal and scope are explicit.
&lt;span class="p"&gt;-&lt;/span&gt; [ ] The workflow contains observable steps.
&lt;span class="p"&gt;-&lt;/span&gt; [ ] Each reference has a condition for when to read it.
&lt;span class="p"&gt;-&lt;/span&gt; [ ] Prohibited actions and claims are listed.
&lt;span class="p"&gt;-&lt;/span&gt; [ ] Missing information has a defined handling rule.
&lt;span class="p"&gt;-&lt;/span&gt; [ ] The output contract is reusable and testable.
&lt;span class="p"&gt;-&lt;/span&gt; [ ] Completion criteria can be checked.
&lt;span class="p"&gt;-&lt;/span&gt; [ ] No secrets or internal URLs are embedded.
&lt;span class="p"&gt;-&lt;/span&gt; [ ] Executable scripts have been reviewed.
&lt;span class="p"&gt;-&lt;/span&gt; [ ] The skill was tested on tasks that should trigger it.
&lt;span class="p"&gt;-&lt;/span&gt; [ ] The skill was tested on tasks that should not trigger it.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Final takeaway
&lt;/h2&gt;

&lt;p&gt;Before handing a skill to an agent, read it as if you were a developer joining the project today:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Can I complete the work from this information? What would I still have to guess? If I must make a decision, do I know which direction to take?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A good skill does not remove reasoning. It removes avoidable guessing.&lt;/p&gt;

&lt;p&gt;Read the canonical article on NEXT4I: &lt;a href="https://www.next4i.com/dev-notes/en" rel="noopener noreferrer"&gt;https://www.next4i.com/dev-notes/en&lt;/a&gt;&lt;/p&gt;

</description>
      <category>aiskill</category>
      <category>ai</category>
      <category>llm</category>
      <category>next4i</category>
    </item>
    <item>
      <title>What Is Token &amp; LLM Cost Optimization</title>
      <dc:creator>NEXT4I DEV</dc:creator>
      <pubDate>Mon, 07 Sep 2026 14:35:04 +0000</pubDate>
      <link>https://dev.to/dev_next4i/what-is-token-llm-cost-optimization-398l</link>
      <guid>https://dev.to/dev_next4i/what-is-token-llm-cost-optimization-398l</guid>
      <description>&lt;h1&gt;
  
  
  What Is a Token in LLMs? A Developer's Guide to Cost Optimization and Architecture
&lt;/h1&gt;

&lt;p&gt;Understanding how LLM tokens work is the difference between an AI feature that costs $50/month and one that runs up a $5,000 AWS/OpenAI bill.&lt;/p&gt;

&lt;p&gt;Here is the engineering breakdown of tokenization algorithms, input vs. output pricing asymmetries, multilingual overhead, model pricing dynamics, and six production strategies implemented at NEXT4I to cut inference costs by up to 50-80%.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;code&gt;#Buildinpublic&lt;/code&gt;, &lt;code&gt;#ModelAI&lt;/code&gt;, &lt;code&gt;#LLM&lt;/code&gt;, &lt;code&gt;#AIArchitecture&lt;/code&gt;, &lt;code&gt;#TokenOptimization&lt;/code&gt;, &lt;code&gt;#AIDeveloper&lt;/code&gt;&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  1. What Is a Token Under the Hood?
&lt;/h2&gt;

&lt;p&gt;LLMs do not process raw text or strings. They consume &lt;strong&gt;Tokens&lt;/strong&gt;—subword representations mapped to high-dimensional embedding vectors via algorithms like &lt;strong&gt;Byte-Pair Encoding (BPE)&lt;/strong&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"Hello world" -&amp;gt; ["Hello", " world"] (2 tokens)
"Unstoppable" -&amp;gt; ["Un", "stoppable"] (2 tokens)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  The Multilingual Token Penalty
&lt;/h3&gt;

&lt;p&gt;Because vocabulary dictionaries are predominantly trained on English corpora, languages without whitespace delimitation (such as Thai) suffer severe subword fragmentation:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;English: &lt;code&gt;1 Token ≈ 0.75 words&lt;/code&gt; (~4 characters).&lt;/li&gt;
&lt;li&gt;Thai: &lt;code&gt;1 Word ≈ 3 to 8 Tokens&lt;/code&gt; (frequently split into byte-level representations).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A prompt written in Thai can cost up to 6x more in raw token usage and introduce noticeable latency compared to its English equivalent.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. Formatting Mechanics: Linebreaks &amp;amp; The "Emoji Tax"
&lt;/h2&gt;

&lt;p&gt;Every character in your prompt payload carries a token cost:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Newlines (&lt;code&gt;\n&lt;/code&gt;) and Numbered Markdown:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Consumes 1 token per newline.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Verdict:&lt;/strong&gt; Highly recommended. Clear formatting provides structural anchors for transformer attention heads, significantly reducing hallucination.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;The Emoji Tax:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Emojis are complex multibyte Unicode sequences, often consuming &lt;strong&gt;2 to 6+ tokens each&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Avoid embedding decorative emojis in static system prompts that execute millions of times.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  3. Input vs. Output Tokens: Why Output Costs 3x–5x More
&lt;/h2&gt;

&lt;p&gt;API rate cards price Output Tokens significantly higher than Input Tokens. Why?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Input Tokens (Parallelized Compute):&lt;/strong&gt; Processed simultaneously across GPU tensor cores in a single matrix multiplication pass (Prefill / Encoding). It is fast and hardware-efficient.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Output Tokens (Sequential Autoregression):&lt;/strong&gt; Generated one token at a time (Autoregressive Decoding). The model generates token N, appends it back to the context history, and re-computes attention for token N+1. This locks GPU resources over the entire generation cycle.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  4. Why Model Pricing Varies by 100x (Dense vs. MoE Architecture)
&lt;/h2&gt;

&lt;p&gt;You may have noticed that API pricing spans from $0.30 to $50.00+ per 1 million tokens across models:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;DeepSeek-V4:&lt;/strong&gt; $0.50 – $1.70 / 1M Tokens (Massive architecture, exceptionally cost-efficient)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Gemini 3.7 Flash:&lt;/strong&gt; $0.30 – $1.80 / 1M Tokens (High-efficiency edge tier)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Claude Sonnet 5:&lt;/strong&gt; $2.00 – $10.00 / 1M Tokens (Mid-tier balanced powerhouse)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OpenAI GPT-5.6 Terra:&lt;/strong&gt; $2.00 – $12.00 / 1M Tokens (Enterprise mid-tier)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Claude Opus 5:&lt;/strong&gt; $5.00 – $25.00 / 1M Tokens (Premium reasoning class)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Claude Fable 5:&lt;/strong&gt; $10.00 – $50.00 / 1M Tokens (Mythos-class model from Anthropic)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OpenAI GPT-5.6 Sol:&lt;/strong&gt; $4.00 – $30.00 / 1M Tokens (OpenAI's flagship)&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Model pricing per token fluctuates frequently across providers and should be used strictly for relative comparative analysis.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This pricing variance stems from three fundamental drivers:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Architectural Design: Dense Models vs. Mixture-of-Experts (MoE)
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Dense Models
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Mechanics:&lt;/strong&gt; Every incoming vector/token is processed through &lt;strong&gt;100% of the model's parameters&lt;/strong&gt;, from the initial layer to the final output layer.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Analogy:&lt;/strong&gt; Like a company where every single employee must sit in every meeting and vote on every decision—regardless of whether the task is simple arithmetic or legal compliance.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Trade-offs:&lt;/strong&gt; Highly compute-intensive (massive FLOPs per token), resulting in higher per-token inference costs. However, memory management and GPU scheduling remain straightforward.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Mixture-of-Experts (MoE)
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Mechanics:&lt;/strong&gt; An intelligent gating mechanism called a &lt;strong&gt;Router (or Gating Network)&lt;/strong&gt; acts as a dispatcher, evaluating incoming tokens and dynamically routing them to specialized sub-networks (&lt;strong&gt;Experts&lt;/strong&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Execution Flow:&lt;/strong&gt;

&lt;ol&gt;
&lt;li&gt;The Router analyzes each token and activates only a sparse subset of experts (e.g., selecting 2 out of 8 or 64 total experts).&lt;/li&gt;
&lt;li&gt;Compute flows exclusively through the parameters of the chosen experts.&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Analogy:&lt;/strong&gt; Like a well-structured organization with an executive dispatcher. A calculus question is routed strictly to the math experts without distracting the linguistics team.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Advantages:&lt;/strong&gt; Enables total model capacity (Total Parameters) to scale massively while keeping active compute per token (Active Parameters / FLOPs) extremely low. This allows lightning-fast generation and drastically lower API prices (e.g., DeepSeek, Mixtral).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Trade-offs:&lt;/strong&gt; Requires massive VRAM/RAM pools to keep all expert weights loaded in memory simultaneously.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  The MoE Achilles' Heel: When Routers Fail
&lt;/h3&gt;

&lt;p&gt;While MoE unlocks unmatched cost efficiency, its performance is tightly bound to routing stability:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Loss of Nuance &amp;amp; Context Disruption:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Natural language is rich with subtle subtext. If a router misinterprets a token and dispatches it to the wrong expert, nuanced meaning collapses. The output may stay grammatically intact but lose analytical depth or fail to address the core prompt intent.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Router Collapse &amp;amp; Expert Imbalance:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Routers naturally develop bias toward a handful of frequently trained experts, causing severe load imbalance. The favored experts hit computational bottlenecks while neglected experts become &lt;strong&gt;Dead Parameters&lt;/strong&gt;, defeating the entire purpose of modular specialization.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cascading Errors:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;LLMs process representations layer by layer. If an early-layer router misroutes a token, downstream layers receive corrupted intermediate activations, amplifying routing errors across subsequent layers.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  🛠️ Engineering Safeguards Used by Frontier Labs:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Auxiliary Load Balancing Loss:&lt;/strong&gt; Incorporating penalty penalties into the loss function during pre-training to enforce uniform token distribution across all expert sub-networks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Capacity Factor Enforcement:&lt;/strong&gt; Setting strict token buffer caps per expert. Once an expert's capacity threshold is reached, excess tokens are spilled over to secondary experts to prevent execution bottlenecks.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  2. Reasoning Overhead (Thinking / Chain-of-Thought Tokens)
&lt;/h3&gt;

&lt;p&gt;Reasoning-focused models (like Claude Opus, OpenAI GPT Sol) generate thousands of internal, hidden &lt;strong&gt;Chain-of-Thought tokens&lt;/strong&gt; before emitting their first visible output token. Providers meter and bill for every single background reasoning step.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Hardware Sovereignty &amp;amp; Custom Silicon
&lt;/h3&gt;

&lt;p&gt;Hyperscalers operating proprietary custom silicon (such as Google’s TPU clusters for Gemini) achieve significantly lower baseline operating costs than providers renting general-purpose Nvidia H100/H200 GPU clusters.&lt;/p&gt;




&lt;h2&gt;
  
  
  5. 6 Production Strategies to Cut Token Costs by 80%
&lt;/h2&gt;

&lt;p&gt;Here are some of the production-level strategies we use in building NEXT4I:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Prompt Engineering for Token Efficiency
&lt;/h3&gt;

&lt;p&gt;Eliminate fluff and instructions that don't add semantic value. Use concise formats like YAML or Markdown instead of verbose JSON schemas.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Leverage Prompt Caching
&lt;/h3&gt;

&lt;p&gt;Major LLM providers (Anthropic, OpenAI, DeepSeek, Google) offer prompt caching. Placing static context (system instructions, tool definitions, schemas) at the prompt root allows providers to cache the KV-cache, reducing input costs by &lt;strong&gt;75%–90%&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Intelligent Model Cascading (Model Routing)
&lt;/h3&gt;

&lt;p&gt;Never route every query to flagship models. Route simple classification, data extraction, and formatting tasks to lightweight models or budget-friendly models (Gemini Flash, DeepSeek), escalating only complex reasoning tasks to larger models (Claude Sonnet, GPT Terra, GPT Sol, Claude Opus / Fable).&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Sliding Context Windows &amp;amp; Conversation Pruning
&lt;/h3&gt;

&lt;p&gt;Chat histories grow quadratically &lt;code&gt;($O(n^2)$)&lt;/code&gt; if sent in their entirety on every turn. Maintain a rolling sliding window of the last 5–10 messages, or summarize older context into a single concise paragraph.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Pre-Retrieval RAG Filtering
&lt;/h3&gt;

&lt;p&gt;In RAG pipelines, do not inject full documents into the context window. Use embedding similarity and rerankers to select top-k (3 to 5) chunks, applying semantic deduplication before prompt construction.&lt;/p&gt;

&lt;h3&gt;
  
  
  6. Multilingual Translation Layer
&lt;/h3&gt;

&lt;p&gt;For bulk data extraction or batch processing on non-Latin languages, translating text to English with a lightweight model prior to deep inference on flagship models can reduce total token usage and improve execution latency.&lt;/p&gt;




&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;+-------------------+---------------------------------------------------+
| Metric            | Engineering Reality                               |
+-------------------+---------------------------------------------------+
| Token Ratio (EN)  | ~1 Token ≈ 0.75 words (~4 characters)             |
| Token Ratio (TH)  | ~1 Word ≈ 3–8 Tokens (byte-level inflation)       |
| Cost Ratio        | Output is 3x–5x more expensive than Input         |
| Pricing Deltas    | Dense vs MoE, TPU/ASIC custom silicon, CoT tokens |
| Core Optimizers   | Caching + Routing + Windowing + RAG Filtering     |
+-------------------+---------------------------------------------------+
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Treating tokens as finite compute bandwidth ensures your AI infrastructure remains fast, scalable, and economically sustainable.&lt;/p&gt;




&lt;p&gt;Explore the NEXT4I journey and read the original article at: &lt;a href="https://go.next4i.com/next4i/devnotes/en" rel="noopener noreferrer"&gt;https://go.next4i.com/next4i/devnotes/en&lt;/a&gt;&lt;/p&gt;

</description>
      <category>llm</category>
      <category>ai</category>
      <category>buildinpublic</category>
      <category>next4i</category>
    </item>
    <item>
      <title>The RAG War Story: How I Learned to Stop Worrying and Love Markdown</title>
      <dc:creator>NEXT4I DEV</dc:creator>
      <pubDate>Tue, 01 Sep 2026 11:23:36 +0000</pubDate>
      <link>https://dev.to/dev_next4i/the-rag-war-story-how-i-learned-to-stop-worrying-and-love-markdown-4f5p</link>
      <guid>https://dev.to/dev_next4i/the-rag-war-story-how-i-learned-to-stop-worrying-and-love-markdown-4f5p</guid>
      <description>&lt;p&gt;&lt;strong&gt;TLDR;&lt;/strong&gt; When building an AI knowledge retrieval pipeline that extracts text from documents, I discovered that PDF is the worst format for AI and Markdown is the best. Here's the multi-step pipeline I had to build just to handle PDFs, why it was necessary, and the generic pattern you can steal to handle document ingestion in your own RAG systems.&lt;/p&gt;




&lt;h3&gt;
  
  
  The Problem: PDFs Are Pixel-Perfect Hell for AI Parsers
&lt;/h3&gt;

&lt;p&gt;I was building a RAG (Retrieval-Augmented Generation) pipeline for NEXT4I the kind of system that reads your documents first, then answers questions from them. Standard stuff: document ingestion → chunking → embedding → vector search → LLM answer generation.&lt;/p&gt;

&lt;p&gt;I chose a beautiful Thai tourism PDF as my test document. Professional design, complex Thai typography, images, tables, charts the works. Real-world document, real-world pain.&lt;/p&gt;

&lt;p&gt;Here's what the naive approach looked like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PDF File → PDF Parser → Extracted Text → Chunk → Embed → Search
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And here's what actually worked:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PDF File
  ├─→ PDF Parser → Raw Text (broken Thai, missing punctuation)
  ├─→ Page Renderer → Full-Color Images
  │     └─→ B&amp;amp;W Converter → High-Contrast Images
  ├─→ AI Vision Model (color images) → Image Descriptions
  ├─→ AI Vision Model (B&amp;amp;W images) → Text Extraction
  └─→ Cross-Validation Layer
        ├─→ Multi-Model Synthesis
        ├─→ Spell-Check Model (critical for Thai)
        └─→ Human Review
              └─→ Final Structured Text → Chunk → Embed → Search
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Why the complexity?&lt;/strong&gt; Because PDF is fundamentally a &lt;em&gt;presentation&lt;/em&gt; format, not a &lt;em&gt;data&lt;/em&gt; format. When you extract text from a PDF, you're not reading structured data you're reverse-engineering a rendered page layout. For languages with complex typography like Thai (where vowels can appear above, below, left, or right of consonants, and tone marks float above), this is especially brutal.&lt;/p&gt;




&lt;h3&gt;
  
  
  The Generic Pattern: Multi-Path Document Ingestion with Cross-Validation
&lt;/h3&gt;

&lt;p&gt;If you're building any system that ingests arbitrary documents, you'll inevitably hit the PDF wall. Here's the reusable pattern I settled on:&lt;/p&gt;

&lt;h4&gt;
  
  
  Architecture
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                    ┌──────────────┐
                    │   Document   │
                    │   Ingest     │
                    └──────┬───────┘
                           │
              ┌────────────┼────────────┐
              ▼            ▼            ▼
        ┌──────────┐ ┌──────────┐ ┌──────────┐
        │  Direct  │ │  Image   │ │  Image   │
        │  Text    │ │  (Color) │ │  (B&amp;amp;W)   │
        │ Extract  │ │  Render  │ │  Render  │
        └────┬─────┘ └────┬─────┘ └────┬─────┘
             │            │            │
             ▼            ▼            ▼
        ┌──────────┐ ┌──────────┐ ┌──────────┐
        │  Text    │ │  Vision  │ │  Vision  │
        │  Output  │ │  Model   │ │  Model   │
        │          │ │  (Desc)  │ │  (OCR)   │
        └────┬─────┘ └────┬─────┘ └────┬─────┘
             │            │            │
             └────────────┼────────────┘
                          │
                          ▼
                 ┌─────────────────┐
                 │  Cross-Validate │
                 │  &amp;amp; Synthesize   │
                 │  (Multi-Model)  │
                 └────────┬────────┘
                          │
                          ▼
                 ┌─────────────────┐
                 │  Spell-Check    │
                 │  &amp;amp; Normalize    │
                 └────────┬────────┘
                          │
                          ▼
                 ┌─────────────────┐
                 │  Human Review   │
                 │  (Optional)     │
                 └────────┬────────┘
                          │
                          ▼
                 ┌─────────────────┐
                 │  Structured     │
                 │  Output → Embed │
                 └─────────────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The key insight: &lt;strong&gt;no single extraction path is reliable enough on its own.&lt;/strong&gt; You need multiple independent paths producing results, then a synthesis layer that cross-validates. Think of it like sensor fusion each path is a noisy sensor, and the truth emerges from the overlap.&lt;/p&gt;

&lt;h4&gt;
  
  
  Why Spell-Check is Non-Negotiable for Non-English Languages
&lt;/h4&gt;

&lt;p&gt;For English, you might get away without a dedicated spell-check pass. For Thai where a single misplaced tone mark changes the entire word you absolutely cannot. OCR and vision models hallucinate characters constantly on decorated fonts or text-over-image backgrounds. A dedicated language model fine-tuned for spell correction is the difference between "usable" and "garbage."&lt;/p&gt;




&lt;h3&gt;
  
  
  The Real Takeaway: Markdown is AI-Native. Everything Else Is Legacy.
&lt;/h3&gt;

&lt;p&gt;After building this entire pipeline, I had a moment of clarity. If that same document had been authored in Markdown:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gu"&gt;## Top Destinations&lt;/span&gt;

| Province | Highlight | Best Season |
|----------|-----------|-------------|
| Krabi    | Islands   | Nov–Apr     |
| Chiang Mai | Mountains | Nov–Feb   |

See the &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;full itinerary&lt;/span&gt;&lt;span class="p"&gt;](&lt;/span&gt;&lt;span class="sx"&gt;#itinerary&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; for details.

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;br&gt;
mermaid&lt;br&gt;
graph TD&lt;br&gt;
    A[Arrive Bangkok] --&amp;gt; B[Fly to Krabi]&lt;br&gt;
    B --&amp;gt; C[Island Hopping]&lt;br&gt;
    C --&amp;gt; D[Return]&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;br&gt;
markdown&lt;/p&gt;

&lt;p&gt;...the entire pipeline collapses to: &lt;strong&gt;read the file → chunk → embed → search.&lt;/strong&gt; That's it.&lt;/p&gt;

&lt;p&gt;No OCR. No vision models. No B&amp;amp;W conversion. No multi-path cross-validation. No spell-check model. No human review for format-induced errors.&lt;/p&gt;

&lt;p&gt;Markdown is structured, plain-text, and both human-readable and machine-parseable by default. It's the only format where:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Headings&lt;/strong&gt; are unambiguously &lt;code&gt;#&lt;/code&gt; / &lt;code&gt;##&lt;/code&gt; not inferred from font size&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tables&lt;/strong&gt; are &lt;code&gt;| column | row |&lt;/code&gt; syntax not pixel grids&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Diagrams&lt;/strong&gt; are Mermaid text not flattened raster images&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Code&lt;/strong&gt; is fenced not monospaced-font heuristics&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;"And here is how the human user experiences it:"&lt;/p&gt;
&lt;h2&gt;
  
  
  Top Destinations
&lt;/h2&gt;
&lt;/blockquote&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Province&lt;/th&gt;
&lt;th&gt;Highlight&lt;/th&gt;
&lt;th&gt;Best Season&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Krabi&lt;/td&gt;
&lt;td&gt;Islands&lt;/td&gt;
&lt;td&gt;Nov–Apr&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Chiang Mai&lt;/td&gt;
&lt;td&gt;Mountains&lt;/td&gt;
&lt;td&gt;Nov–Feb&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;See the full itinerary for details.&lt;br&gt;
&lt;/p&gt;

&lt;pre data-lang="mermaid"&gt;&lt;code&gt;graph TD
    A[Arrive Bangkok] --&amp;gt; B[Fly to Krabi]
    B --&amp;gt; C[Island Hopping]
    C --&amp;gt; D[Return]&lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;&lt;em&gt;"In reality, we can't always control the documents we ingest, and we can't just ignore them because they might contain critical data. But if we were to start from scratch, Markdown is definitely the go-to choice."&lt;/em&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  How This Shapes Our Architecture at NEXT4I
&lt;/h3&gt;

&lt;p&gt;At NEXT4I, we treat Markdown as a first-class format throughout our stack. When building AI knowledge retrieval systems for everyday users and organizations, we encourage Markdown as the source of truth and handle PDFs as a necessary-but-painful compatibility layer.&lt;/p&gt;

&lt;p&gt;The design principle is simple: &lt;strong&gt;AI Integration by Design.&lt;/strong&gt; Make AI a first-class citizen of your content architecture, not something you bolt on later and hope it works. The format you choose today determines the ceiling of your AI capabilities tomorrow.&lt;/p&gt;




&lt;p&gt;Thanks for reading all the way to the end, I'll keep working on more articles like this.&lt;/p&gt;




&lt;p&gt;Explore the NEXT4I journey and read the original article at: &lt;a href="https://go.next4i.com/next4i/devnotes/en" rel="noopener noreferrer"&gt;https://go.next4i.com/next4i/devnotes/en&lt;/a&gt;&lt;/p&gt;

</description>
      <category>rag</category>
      <category>markdown</category>
      <category>pdf</category>
      <category>next4i</category>
    </item>
    <item>
      <title>What Is LLM Actually Doing? A Fellow Engineer's Take on Vectors, Next-Token Prediction, and Fail-back Routing</title>
      <dc:creator>NEXT4I DEV</dc:creator>
      <pubDate>Tue, 01 Sep 2026 05:30:51 +0000</pubDate>
      <link>https://dev.to/dev_next4i/what-is-llm-actually-doing-a-fellow-engineers-take-on-vectors-next-token-prediction-and-bb5</link>
      <guid>https://dev.to/dev_next4i/what-is-llm-actually-doing-a-fellow-engineers-take-on-vectors-next-token-prediction-and-bb5</guid>
      <description>&lt;p&gt;&lt;strong&gt;Why treating an LLM as a probability engine, not a brain, changes how you architect around it. The reasoning behind NEXT4I's AI layer.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;code&gt;#LLM&lt;/code&gt; &lt;code&gt;#BuildinPublic&lt;/code&gt; &lt;code&gt;#SystemArchitecture&lt;/code&gt; &lt;code&gt;#AI&lt;/code&gt; &lt;code&gt;#Model AI&lt;/code&gt; &lt;code&gt;#AI Router&lt;/code&gt; &lt;code&gt;#AI Stable&lt;/code&gt;&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;I used to wonder why the model confidently gives you a wrong number. It's not a bug in the traditional sense, it's the model doing exactly what it's built to do: predicting the next token from probability, with zero actual arithmetic happening underneath.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TLDR;&lt;/strong&gt; An LLM (large language model) converts text into vectors (numeric coordinates in a high-dimensional meaning-space) and generates output via next-token prediction, sampled with parameters like top-k and temperature. Because it's fundamentally a probability engine and not a calculator or a database, I designed NEXT4I with automatic model fail-back routing and task-based model selection instead of trusting any single model as a source of truth.&lt;/p&gt;




&lt;h3&gt;
  
  
  The Mental Model: Vectors, Not Meaning
&lt;/h3&gt;

&lt;p&gt;Every token gets embedded into a vector, often with hundreds or thousands of dimensions. Semantically similar tokens end up close together in that space. That's why semantic search (vector-based retrieval) can match "large flying animal consumes insects" to "big bird eats worms" even with zero shared keywords, unlike old-school lexical search (TF-IDF/BM25) which needs literal term overlap.&lt;/p&gt;

&lt;p&gt;GPUs handle this well because they're already wired for massive parallel floating-point math (the same math used to shade millions of pixels per frame), so throwing billions of similarly-directed vectors at a GPU is a natural fit, not a coincidence.&lt;/p&gt;

&lt;h3&gt;
  
  
  Generation Is Sampling, Not Retrieval
&lt;/h3&gt;

&lt;p&gt;Given a prompt, the model doesn't look up an answer, it samples one token at a time from a probability distribution. Two knobs matter in practice:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;top_k: 2        # only sample from the top-2 most likely next tokens
temperature: 0.2  # low = deterministic/precise, high = creative/varied
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Low temperature + low top_k gives you consistent, "boring" output, good for structured extraction. High temperature gives you variety, good for brainstorming, bad for anything requiring precision.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why LLMs Hallucinate on Arithmetic
&lt;/h3&gt;

&lt;p&gt;There's no calculator inside the model. It doesn't evaluate &lt;code&gt;x * y&lt;/code&gt;, it predicts digits that are statistically plausible given the prompt, one token at a time. It gets &lt;code&gt;2 * 2&lt;/code&gt; right because that pattern is everywhere in training data. It confidently botches large multiplication because it's still just sampling digits, not computing. This is exactly why production systems now delegate real math to a tool call (a Python sandbox, a calculator function) instead of trusting raw model output.&lt;/p&gt;




&lt;h3&gt;
  
  
  Core Value: A Generic Model-Tier Fail-back Router
&lt;/h3&gt;

&lt;p&gt;Here's the simple pattern, stripped of any specific business logic, a reusable fail-back wrapper for any set of same-tier model clients:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;modelrouter&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s"&gt;"context"&lt;/span&gt;
    &lt;span class="s"&gt;"errors"&lt;/span&gt;
    &lt;span class="s"&gt;"fmt"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c"&gt;// ModelClient is any backend that can answer a prompt.&lt;/span&gt;
&lt;span class="k"&gt;type&lt;/span&gt; &lt;span class="n"&gt;ModelClient&lt;/span&gt; &lt;span class="k"&gt;interface&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;Name&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;
    &lt;span class="n"&gt;Complete&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Context&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;prompt&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c"&gt;// TieredRouter tries each client in a tier in order until one succeeds.&lt;/span&gt;
&lt;span class="k"&gt;type&lt;/span&gt; &lt;span class="n"&gt;TieredRouter&lt;/span&gt; &lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;tier&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;&lt;span class="n"&gt;ModelClient&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;NewTieredRouter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;clients&lt;/span&gt; &lt;span class="o"&gt;...&lt;/span&gt;&lt;span class="n"&gt;ModelClient&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;TieredRouter&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;TieredRouter&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;tier&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;clients&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c"&gt;// Complete attempts each model in the tier, fail-back on error.&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;TieredRouter&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;Complete&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Context&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;prompt&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;errs&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;&lt;span class="kt"&gt;error&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="k"&gt;range&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tier&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Complete&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;prompt&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="n"&gt;errs&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;errs&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Errorf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"%s: %w"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Name&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;errors&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;errs&lt;/span&gt;&lt;span class="o"&gt;...&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is intentionally boring: try the next model in the same tier on failure, return the first success. No retries with backoff yet, no circuit breaker, just the core fail-back idea. In NEXT4I's actual implementation, tiers are populated dynamically and health state feeds back into ordering, but that logic is abstracted here on purpose, the generic version above is what's actually useful to share.&lt;/p&gt;

&lt;h3&gt;
  
  
  Core Value: Task-Based Routing, the Simple Version
&lt;/h3&gt;

&lt;p&gt;A minimal router that inspects task complexity before picking a tier:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;modelrouter&lt;/span&gt;

&lt;span class="k"&gt;type&lt;/span&gt; &lt;span class="n"&gt;Complexity&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;

&lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;Simple&lt;/span&gt; &lt;span class="n"&gt;Complexity&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;iota&lt;/span&gt;
    &lt;span class="n"&gt;Complex&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;ClassifyAndRoute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;task&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;simpleTier&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;complexTier&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;TieredRouter&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;TieredRouter&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;estimateComplexity&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;task&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;Simple&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;simpleTier&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;complexTier&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;estimateComplexity&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;task&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;Complexity&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;task&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="m"&gt;100&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;Simple&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;Complex&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;estimateComplexity&lt;/code&gt; can be as crude as a length/keyword heuristic or as sophisticated as a small classifier model, the point is the routing &lt;em&gt;decision&lt;/em&gt; happens before the expensive call, not after.&lt;/p&gt;




&lt;h3&gt;
  
  
  Trade-offs I Made
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Fail-back within a tier, not across tiers.&lt;/strong&gt; Swapping a cheap model in for an expensive one silently would change output quality without anyone noticing. Tiers exist specifically to avoid that.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No cross-request state in the router.&lt;/strong&gt; Keeps it stateless and trivially horizontally scalable, at the cost of not learning from past failures within a single request lifecycle.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Routing is a toggle, not a mandate.&lt;/strong&gt; Users can pin a specific model when they need deterministic behavior from one exact provider, the router only kicks in by default.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;If there's one thing worth taking away: treat the model as a probability engine you can't fully trust, and let the system around it, fail-back, routing, tool calls for math, carry the reliability burden instead.&lt;/p&gt;




&lt;p&gt;Thanks for reading all the way to the end, I'll keep working on more articles like this.&lt;/p&gt;




&lt;p&gt;Explore the NEXT4I journey and read the original article at: &lt;a href="https://go.next4i.com/next4i/journey/en" rel="noopener noreferrer"&gt;https://go.next4i.com/next4i/journey/en&lt;/a&gt;&lt;/p&gt;

</description>
      <category>llm</category>
      <category>buildinpublic</category>
      <category>next4i</category>
      <category>architecture</category>
    </item>
    <item>
      <title>How to Build a "Second Brain" with Obsidian That Your AI Agent Can Read, Without Building a Custom RAG Pipeline</title>
      <dc:creator>NEXT4I DEV</dc:creator>
      <pubDate>Mon, 17 Aug 2026 11:40:46 +0000</pubDate>
      <link>https://dev.to/dev_next4i/how-to-build-a-second-brain-with-obsidian-that-your-ai-agent-can-read-without-building-a-custom-29h3</link>
      <guid>https://dev.to/dev_next4i/how-to-build-a-second-brain-with-obsidian-that-your-ai-agent-can-read-without-building-a-custom-29h3</guid>
      <description>&lt;p&gt;Ever run into this? You wrote a detailed technical spec three months ago, and today someone asks "how did we design this module again?" You end up spending 20 minutes hitting &lt;code&gt;Cmd+F&lt;/code&gt; across Google Docs, Trello, and &lt;code&gt;README.md&lt;/code&gt; files scattered across different repos, or sometimes there's no documentation at all, so you have to dig through the code and reverse-engineer it by eye.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TLDR;&lt;/strong&gt; I built a knowledge-base system for NEXT4I using Obsidian (plain Markdown) together with Git and a VS Code AI agent, without writing a single line of custom integration. The core of the system is choosing tools that already "speak the same language" from day one (plain text, open formats), so AI can read our knowledge base practically for free, no RAG pipeline required.&lt;/p&gt;




&lt;h3&gt;
  
  
  Pain Point: Scattered Knowledge and Requirements Make Search Hard and Nothing Stays in Sync
&lt;/h3&gt;

&lt;p&gt;Before this system, all of NEXT4I's knowledge was scattered across many places: notebooks, Apple Notes, Google Docs, Google Sheets, Trello, &lt;code&gt;README.md&lt;/code&gt; files, or, even worse, sometimes there was no documentation at all, just buried in the code, spread across multiple repos each written in a different language, frontend and backend alike.&lt;/p&gt;

&lt;p&gt;This isn't just an inconvenience. It makes search genuinely hard, sometimes it's &lt;code&gt;Cmd+F&lt;/code&gt; and pray. Worse: my AI coding agent could read the entire codebase, but &lt;strong&gt;it had zero visibility into the reasoning behind that code&lt;/strong&gt;, because that reasoning was scattered somewhere the AI couldn't reach.&lt;/p&gt;




&lt;h3&gt;
  
  
  Design Constraints: 3 Non-Negotiables
&lt;/h3&gt;

&lt;p&gt;Before picking a tool, I set 3 rules:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;It has to be affordable, or free if possible.&lt;/li&gt;
&lt;li&gt;It has to be accessible online anytime, from my phone, and still work offline.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Plain text, zero lock-in.&lt;/strong&gt; If the tool disappears tomorrow, the files must remain immediately readable and usable.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Local-first, Git-friendly.&lt;/strong&gt; It has to be a normal folder I can &lt;code&gt;git init&lt;/code&gt; and track right away.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AI-readable without building extra infrastructure.&lt;/strong&gt; My AI agent already lives in VS Code, so the knowledge base has to sit inside that workspace without me building an extra pipeline.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Obsidian passed everything, because at its core, an Obsidian vault is just a folder of &lt;code&gt;.md&lt;/code&gt; files.&lt;/p&gt;




&lt;h3&gt;
  
  
  Architecture: Vault Structure
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;vault/
├── Ideas/          # Raw concepts, brainstorming
├── Manifesto/      # Vision, mission, core policies
├── Principles/     # Design rules, engineering guidelines
├── Infrastructure/ # Deployment topology, IaC specs
├── Platform/       # Domain model, API contracts
├── Script/         # Utility scripts, automation, runbooks
├── Skill/          # Patterns, checklists, reusable knowledge
└── Appendix/       # Domain glossary, citations
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Every file is a plain &lt;code&gt;.md&lt;/code&gt;. Links use &lt;code&gt;[[wiki-link]]&lt;/code&gt; syntax. Metadata lives in YAML frontmatter, and Graph View renders the relationships as a visible dependency graph.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Version control&lt;/strong&gt; is just &lt;code&gt;git init&lt;/code&gt; inside the vault folder, then committing every change with a rationale. &lt;code&gt;git log -- "Infrastructure/sharding-strategy.md"&lt;/code&gt; shows the full decision history for that topic. Push it to a private GitHub repo and you get backup, an audit trail, and branching for major revisions, all for free.&lt;/p&gt;




&lt;h3&gt;
  
  
  Key Insight: AI Access Without Building Anything
&lt;/h3&gt;

&lt;p&gt;This is the part that changed everything.&lt;/p&gt;

&lt;p&gt;Obsidian vault = a folder of &lt;code&gt;.md&lt;/code&gt; files.&lt;br&gt;
VS Code = opens any folder as a workspace.&lt;br&gt;
AI coding agent (running as a VS Code extension) = reads every file in that workspace.&lt;/p&gt;

&lt;p&gt;So the "integration" here is: &lt;strong&gt;open the vault folder in VS Code.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That's it. No API, no embedding pipeline, no vector database, no chunking strategy. Just plain Markdown files that the AI agent reads natively.&lt;/p&gt;


&lt;h3&gt;
  
  
  Prompt Patterns I Actually Use
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Contextual search + reasoning:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Search all documents that mention our sharding strategy.
Summarize every trade-off we've considered
and tell me which approach we ultimately chose and why.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Gap analysis:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Look at everything in the Infrastructure/ folder
and tell me which architectural decisions are still undocumented,
compared against the template in Skill/.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Drafting from conventions, not from a blank page:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Using the patterns in Skill/go-backend/ and the domain model in Platform/core/,
draft a design doc for a new message consumer
following our established conventions.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Impact analysis via link traversal:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;If I change the authentication rule in Principles/auth.md,
trace every file in Platform/ and Skill/ that links to it via [[links]]
and tell me what needs updating.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The AI reads across multiple files, follows &lt;code&gt;[[wiki-links]]&lt;/code&gt;, understands the relationships, and synthesizes an answer, without me writing a single line of integration code.&lt;/p&gt;




&lt;h3&gt;
  
  
  Philosophy: Seamless Integration by Design
&lt;/h3&gt;

&lt;p&gt;The pattern here isn't "integrate 3 tools." It's &lt;strong&gt;choosing components that already speak the same language.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Obsidian chose Markdown, the most universally readable format in computing, over a proprietary database. Git works with any plain text. AI agents already know how to read files in a VS Code workspace.&lt;/p&gt;




&lt;h3&gt;
  
  
  Bonus: Obsidian Canvas as a Visual Layer
&lt;/h3&gt;

&lt;p&gt;Obsidian's Canvas is an infinite whiteboard, place document cards, text, media, then draw connections between them.&lt;/p&gt;

&lt;p&gt;I use Canvas for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;System architecture sketches:&lt;/strong&gt; each service as a card, data flow arrows, real specs embedded right on the board&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Decision trees:&lt;/strong&gt; "if we pick X, then Y and Z are affected," with linked evidence&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Plan strategy &amp;amp; flow:&lt;/strong&gt; for planning work, sequencing, and various NEXT4I workflows&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Canvas files are Markdown too under the hood (JSON-like structure), so they're Git-versioned and AI-readable as well. Drop a &lt;code&gt;.canvas&lt;/code&gt; file into your VS Code workspace and ask the AI to analyze it for circular dependencies or single points of failure.&lt;/p&gt;




&lt;h3&gt;
  
  
  What I Learned
&lt;/h3&gt;

&lt;p&gt;What makes this system work isn't the technology, it's what I &lt;em&gt;didn't&lt;/em&gt; build. No middleware, no proprietary pipeline, no vendor lock-in.&lt;/p&gt;

&lt;p&gt;The discipline of plain text + Git + open formats is a feature, not a limitation.&lt;/p&gt;

&lt;p&gt;If you're a dev or a small team drowning in scattered documents, try this before jumping to a heavyweight knowledge-management platform. Plain Markdown with a good folder structure will take you further than you'd expect.&lt;/p&gt;




&lt;p&gt;Thanks for reading all the way to the end, I'll keep working on more articles like this.&lt;/p&gt;

&lt;p&gt;Explore the NEXT4I journey and read the original article at: &lt;a href="https://go.next4i.com/next4i/journey/en" rel="noopener noreferrer"&gt;https://go.next4i.com/next4i/journey/en&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Alternatively, you can register to join &lt;strong&gt;NEXT4I&lt;/strong&gt; the AI-Native Ecosystem I am currently building at: &lt;a href="https://go.next4i.com/next4i-devto-en" rel="noopener noreferrer"&gt;https://go.next4i.com/next4i-devto-en&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;tags: &lt;br&gt;
&lt;code&gt;#buildinpublic&lt;/code&gt;&lt;br&gt;
&lt;code&gt;#secondbrain&lt;/code&gt;&lt;br&gt;
&lt;code&gt;#next4i&lt;/code&gt;&lt;br&gt;
&lt;code&gt;#obsidian&lt;/code&gt;&lt;/p&gt;




</description>
      <category>ai</category>
      <category>markdown</category>
      <category>productivity</category>
    </item>
    <item>
      <title>How I Built an AI-Readable Second Brain with Obsidian, Git, and a VS Code AI Agent</title>
      <dc:creator>NEXT4I DEV</dc:creator>
      <pubDate>Fri, 07 Aug 2026 07:55:45 +0000</pubDate>
      <link>https://dev.to/dev_next4i/how-i-built-an-ai-readable-second-brain-with-obsidian-git-and-a-vs-code-ai-agent-5hep</link>
      <guid>https://dev.to/dev_next4i/how-i-built-an-ai-readable-second-brain-with-obsidian-git-and-a-vs-code-ai-agent-5hep</guid>
      <description>&lt;p&gt;When you're a solo founder and lead architect, your knowledge base is your most valuable asset. Lose the thread on why a decision was made, and you spend hours — sometimes days — reconstructing context that you &lt;em&gt;already figured out once&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;I want to share the exact setup I use at NEXT4I to turn a folder of Markdown files into a fully searchable, version-controlled, AI-readable knowledge system. No proprietary SaaS, no vendor lock-in, no custom integration work.&lt;/p&gt;

&lt;p&gt;This is the Key Highlight of this post: a genuinely useful, generic pattern you can apply to your own projects today. The NEXT4I-specific business logic stays abstracted (per our security rules), but the pattern itself is 100% reusable.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. The Architecture: Three Layers, Zero Magic
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;┌─────────────────────────────────────────┐
│           AI Agent (VS Code)            │
│   Reads, Searches, Summarizes, Drafts   │
└──────────────────┬──────────────────────┘
                   │ reads plain .md files
┌──────────────────▼──────────────────────┐
│       Git-tracked Obsidian Vault        │
│  ├── Idea/           (brainstorms)      │
│  ├── Infrastructure/ (architecture docs)│
│  ├── Platform/       (product specs)    │
│  ├── Script/         (automation)       │
│  └── Skill/          (reusable limits)  │
└──────────────────┬──────────────────────┘
                   │ committed &amp;amp; pushed
┌──────────────────▼──────────────────────┐
│         GitHub (remote backup)          │
└─────────────────────────────────────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Layer 1 — The Vault (Obsidian):&lt;/strong&gt; A folder of interconnected &lt;code&gt;.md&lt;/code&gt; files. The key insight is that Obsidian uses plain Markdown with &lt;code&gt;[[wiki-links]]&lt;/code&gt; for connections — no database, no proprietary format.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Layer 2 — Version Control (Git):&lt;/strong&gt; Every vault is a git repo. Every change to any document has a commit message, a timestamp, and a diff. You can &lt;code&gt;git log --oneline -- Idea/&lt;/code&gt; to see the evolution of a concept.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Layer 3 — AI Agent (VS Code Extension):&lt;/strong&gt; Because the vault is just a file tree of &lt;code&gt;.md&lt;/code&gt; files, any AI coding agent that can read a codebase can also read your knowledge base. Point the agent at the vault folder, and it has full context.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. The Setup: Step-by-Step
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Step 1: Create the Vault
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;
&lt;span class="nb"&gt;mkdir &lt;/span&gt;next4i-knowledge

&lt;span class="nb"&gt;cd &lt;/span&gt;next4i-knowledge

&lt;span class="nb"&gt;mkdir &lt;/span&gt;Idea Infrastructure Platform Script Skill

git init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Open this folder in Obsidian: &lt;strong&gt;Open folder as vault&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Link Everything
&lt;/h3&gt;

&lt;p&gt;Inside a note, link to another note with &lt;code&gt;[[Note Name]]&lt;/code&gt;. Obsidian auto-suggests as you type. Over time, this builds a graph you can visualize with &lt;code&gt;Cmd/Ctrl + G&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pro tip:&lt;/strong&gt; Create a &lt;code&gt;_INDEX.md&lt;/code&gt; in each folder that links to the most important notes. This becomes a human-readable table of contents AND a search anchor for the AI.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3: Add Git Discipline
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;
git add &lt;span class="nt"&gt;-A&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"infra: initial sharding strategy decision"&lt;/span&gt;

git remote add origin git@github.com:your-org/knowledge-vault.git

git push &lt;span class="nt"&gt;-u&lt;/span&gt; origin main

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Treat commit messages like code. Use prefixes: &lt;code&gt;idea:&lt;/code&gt;, &lt;code&gt;infra:&lt;/code&gt;, &lt;code&gt;platform:&lt;/code&gt;, &lt;code&gt;script:&lt;/code&gt;, &lt;code&gt;skill:&lt;/code&gt;. This makes &lt;code&gt;git log --oneline --grep="infra:"&lt;/code&gt; instantly useful.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 4: Open in VS Code and Activate the AI
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;
code /path/to/vault

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With an AI agent extension active (Copilot, Cline, Cody, etc.), try prompts like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;"Summarize the key architectural decisions in the Infrastructure folder."&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;"Find any contradiction between documents in /Platform/ and /Infrastructure/."&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;"Draft a new document in /Idea/ based on the sharding notes in /Infrastructure/."&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The agent reads the files as context, just like it would for code.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. The Design Pattern: Folder-Convention-as-API
&lt;/h2&gt;

&lt;p&gt;Here's the key pattern: &lt;strong&gt;your folder structure IS your API&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;By keeping a consistent vault structure, both humans and AI know where to look:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Folder&lt;/th&gt;
&lt;th&gt;Contains&lt;/th&gt;
&lt;th&gt;AI Use Case&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Idea/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Raw, unstructured thinking&lt;/td&gt;
&lt;td&gt;Generate summaries, find related concepts&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Infrastructure/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;System topology, deployment, config&lt;/td&gt;
&lt;td&gt;Validate consistency, trace dependencies&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Platform/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Feature specs, user flows&lt;/td&gt;
&lt;td&gt;Draft task tickets, check requirement coverage&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Script/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Automation, one-liners&lt;/td&gt;
&lt;td&gt;Explain what a script does, suggest improvements&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Skill/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Reusable patterns, checklists&lt;/td&gt;
&lt;td&gt;Retrieve relevant patterns for new tasks&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;This is essentially a &lt;strong&gt;convention-based RAG (Retrieval-Augmented Generation)&lt;/strong&gt; setup without any vector database, embedding pipeline, or chunking strategy. The "chunking" is the natural boundary of each &lt;code&gt;.md&lt;/code&gt; file. The "retrieval" is the AI agent's file-reading capability.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. Why This Beats a Wiki
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Wiki / Confluence&lt;/th&gt;
&lt;th&gt;This Setup (Obsidian + Git)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Vendor lock-in&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Plain &lt;code&gt;.md&lt;/code&gt; files, portable anywhere&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;Search is siloed&lt;/strong&gt; within the tool&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;VS Code AI&lt;/strong&gt; searches across the whole vault&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;No version control&lt;/strong&gt; (or poor built-in)&lt;/td&gt;
&lt;td&gt;Full version control (&lt;code&gt;git blame&lt;/code&gt;, &lt;code&gt;git diff&lt;/code&gt;, &lt;code&gt;git log&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Hard to automate&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Scriptable&lt;/strong&gt; — &lt;code&gt;grep&lt;/code&gt;, &lt;code&gt;sed&lt;/code&gt;, and AI prompts all work&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;AI needs API integration&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;AI reads files natively&lt;/strong&gt;, zero setup required&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  5. What I Learned
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;The biggest surprise:&lt;/strong&gt; The AI agent became better at finding connections in my own notes than I was. It doesn't have recency bias. It doesn't forget what I wrote 8 months ago. It reads everything with equal attention.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The biggest lesson:&lt;/strong&gt; AI-native doesn't mean "add an AI button." It means design your systems — including your thinking systems — so that AI can participate as a first-class citizen without special plumbing.&lt;/p&gt;




&lt;p&gt;I'm building NEXT4I as an AI-native ecosystem from the ground up. If you're interested in following a solo founder's engineering journey — or want early access — join here: &lt;br&gt;
&lt;a href="https://go.next4i.com/next4i-devto-en" rel="noopener noreferrer"&gt;Subscribe NEXT4I or want early access — join here&lt;/a&gt;&lt;/p&gt;

</description>
      <category>buildinpublic</category>
      <category>obsidian</category>
      <category>next4i</category>
      <category>secondbrain</category>
    </item>
  </channel>
</rss>
