<?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>Forem: arga wicaksono</title>
    <description>The latest articles on Forem by arga wicaksono (@arga_wicaksono).</description>
    <link>https://forem.com/arga_wicaksono</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3937650%2F73a0bd0b-68d0-49e0-9668-6190f09edc6d.png</url>
      <title>Forem: arga wicaksono</title>
      <link>https://forem.com/arga_wicaksono</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/arga_wicaksono"/>
    <language>en</language>
    <item>
      <title>How I Give LLMs Perfect Code Context Without Hallucinations — Using a Single CLI Tool</title>
      <dc:creator>arga wicaksono</dc:creator>
      <pubDate>Mon, 18 May 2026 09:30:41 +0000</pubDate>
      <link>https://forem.com/arga_wicaksono/how-i-give-llms-perfect-code-context-without-hallucinations-using-a-single-cli-tool-19l9</link>
      <guid>https://forem.com/arga_wicaksono/how-i-give-llms-perfect-code-context-without-hallucinations-using-a-single-cli-tool-19l9</guid>
      <description>&lt;p&gt;How do I get context for my AI assistant?&lt;br&gt;
Four different tools. Four different interfaces. And some questions have no standard tool at all.&lt;/p&gt;
&lt;h2&gt;
  
  
  The Problem With Modern Code Navigation
&lt;/h2&gt;

&lt;p&gt;The Unix philosophy says "do one thing well." And tools like fd, rg, and fzf are excellent at what they do. But when you need to understand a codebase — not just search it — you end up in an integration nightmare.&lt;/p&gt;

&lt;p&gt;Consider a real workflow:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Find a file&lt;/strong&gt;: &lt;code&gt;fd "auth" | fzf&lt;/code&gt; — works great&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Search inside files&lt;/strong&gt;: &lt;code&gt;rg "authenticate" -C 3&lt;/code&gt; — works great&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Find where a function is defined&lt;/strong&gt;: &lt;code&gt;ctags -R &amp;amp;&amp;amp; grep "authenticate" tags&lt;/code&gt; — wait, ctags doesn't handle all languages well, and the output format is outdated&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Find all callers of a function&lt;/strong&gt;: No standard CLI tool exists for this&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Understand what depends on a module&lt;/strong&gt;: You need custom scripts or an IDE&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Get context for AI&lt;/strong&gt;: Copy-paste manually&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For AI-assisted development, the situation is even worse. When Claude or ChatGPT tries to help you with code, it often gets random snippets and hallucinates. The problem isn't the AI — it's the context.&lt;/p&gt;
&lt;h2&gt;
  
  
  One Binary to Rule Them All
&lt;/h2&gt;

&lt;p&gt;That's why I built &lt;strong&gt;CodeScope&lt;/strong&gt; (&lt;code&gt;cs&lt;/code&gt;) — a single Rust binary that handles all of the above and more. Here's what it looks like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# File search (fuzzy matching)&lt;/span&gt;
cs file &lt;span class="s2"&gt;"config"&lt;/span&gt; &lt;span class="nt"&gt;-I&lt;/span&gt;                    &lt;span class="c"&gt;# Interactive picker&lt;/span&gt;
cs open &lt;span class="s2"&gt;"main"&lt;/span&gt; &lt;span class="nt"&gt;--line&lt;/span&gt; 42               &lt;span class="c"&gt;# Find + open in $EDITOR&lt;/span&gt;

&lt;span class="c"&gt;# Content search (3 modes: fuzzy, exact, regex)&lt;/span&gt;
cs content &lt;span class="s2"&gt;"fn main"&lt;/span&gt;                    &lt;span class="c"&gt;# Fuzzy search&lt;/span&gt;
cs content &lt;span class="s2"&gt;"TODO|FIXME"&lt;/span&gt; &lt;span class="nt"&gt;--regex&lt;/span&gt;         &lt;span class="c"&gt;# Regex search&lt;/span&gt;
cs content &lt;span class="s2"&gt;"config"&lt;/span&gt; &lt;span class="nt"&gt;-x&lt;/span&gt;                  &lt;span class="c"&gt;# Exact substring&lt;/span&gt;
cs content &lt;span class="s2"&gt;"old"&lt;/span&gt; &lt;span class="nt"&gt;--replace&lt;/span&gt; &lt;span class="s2"&gt;"new"&lt;/span&gt; &lt;span class="nt"&gt;--write&lt;/span&gt; &lt;span class="c"&gt;# Find and replace&lt;/span&gt;

&lt;span class="c"&gt;# Symbol intelligence (10 languages)&lt;/span&gt;
cs where &lt;span class="s2"&gt;"parse_config"&lt;/span&gt;                 &lt;span class="c"&gt;# Find definition&lt;/span&gt;
cs refs &lt;span class="s2"&gt;"MyStruct"&lt;/span&gt;                      &lt;span class="c"&gt;# Find all references&lt;/span&gt;
cs callers &lt;span class="s2"&gt;"process_data"&lt;/span&gt;               &lt;span class="c"&gt;# Who calls this function?&lt;/span&gt;
cs symbols &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;--symbol-type&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="nt"&gt;-l&lt;/span&gt; 20  &lt;span class="c"&gt;# List all functions&lt;/span&gt;

&lt;span class="c"&gt;# Context engine for AI&lt;/span&gt;
cs context &lt;span class="s2"&gt;"authentication"&lt;/span&gt;             &lt;span class="c"&gt;# Extract ranked context&lt;/span&gt;
cs pack &lt;span class="s2"&gt;"auth flow"&lt;/span&gt; &lt;span class="nt"&gt;-b&lt;/span&gt; 8000             &lt;span class="c"&gt;# Pack into token-efficient LLM prompt&lt;/span&gt;
cs trace &lt;span class="s2"&gt;"main"&lt;/span&gt; &lt;span class="nt"&gt;--max-depth&lt;/span&gt; 5           &lt;span class="c"&gt;# Trace execution flow&lt;/span&gt;

&lt;span class="c"&gt;# Dependency intelligence&lt;/span&gt;
cs graph &lt;span class="nt"&gt;--type&lt;/span&gt; modules                 &lt;span class="c"&gt;# Module dependency tree&lt;/span&gt;
cs graph &lt;span class="nt"&gt;--type&lt;/span&gt; calls &lt;span class="nt"&gt;--format&lt;/span&gt; dot      &lt;span class="c"&gt;# Call graph (Graphviz)&lt;/span&gt;
cs impact &lt;span class="s2"&gt;"utils.rs"&lt;/span&gt;                    &lt;span class="c"&gt;# What depends on this?&lt;/span&gt;

&lt;span class="c"&gt;# Cross-repo search&lt;/span&gt;
cs across &lt;span class="s1"&gt;'TODO'&lt;/span&gt; &lt;span class="nt"&gt;--workspace&lt;/span&gt; ~/projects &lt;span class="c"&gt;# Search all repos at once&lt;/span&gt;

&lt;span class="c"&gt;# AI integration&lt;/span&gt;
cs serve &lt;span class="nt"&gt;--mcp&lt;/span&gt;                          &lt;span class="c"&gt;# MCP server for Claude/Cursor&lt;/span&gt;
cs semantic &lt;span class="s2"&gt;"database connection pool"&lt;/span&gt;   &lt;span class="c"&gt;# Semantic search&lt;/span&gt;
cs rewrite &lt;span class="s2"&gt;"add error handling"&lt;/span&gt; &lt;span class="nt"&gt;--write&lt;/span&gt; &lt;span class="c"&gt;# AI-powered code rewrite&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What Makes CodeScope Different&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Deterministic, Not Probabilistic&lt;br&gt;
Unlike AI-powered tools, CodeScope always returns the same results for the same query. No randomness, no hallucinations. This is critical for developer trust — you need to know your tools are reliable.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;AI-Consumable by Design&lt;br&gt;
Every command supports JSON output (-j flag). This makes it trivial to pipe results into AI workflows:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Get structured context for Claude&lt;/span&gt;
cs context &lt;span class="s2"&gt;"authentication"&lt;/span&gt; &lt;span class="nt"&gt;-j&lt;/span&gt; | Claude &lt;span class="s2"&gt;"explain this code"&lt;/span&gt;

&lt;span class="c"&gt;# Pack code for an LLM prompt&lt;/span&gt;
cs pack &lt;span class="s2"&gt;"error handling"&lt;/span&gt; &lt;span class="nt"&gt;-b&lt;/span&gt; 8000 &lt;span class="nt"&gt;-j&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; prompt.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Zero Runtime Dependencies&lt;br&gt;
One static binary. No Python, no Node.js, no database. Install it once and it works everywhere. The binary is ~2 MB thanks to Rust's optimization and LTO + strip.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Feature Flags for Lean Builds&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Full build (web search + interactive) — default, ~2 MB&lt;/span&gt;
cargo build &lt;span class="nt"&gt;--release&lt;/span&gt;

&lt;span class="c"&gt;# Without web search — smaller&lt;/span&gt;
cargo build &lt;span class="nt"&gt;--release&lt;/span&gt; &lt;span class="nt"&gt;--no-default-features&lt;/span&gt; &lt;span class="nt"&gt;--features&lt;/span&gt; interactive

&lt;span class="c"&gt;# Minimal: file + content only — smallest possible&lt;/span&gt;
cargo build &lt;span class="nt"&gt;--release&lt;/span&gt; &lt;span class="nt"&gt;--no-default-features&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Technical Architecture
&lt;/h2&gt;

&lt;p&gt;CodeScope is organized into 28 Rust modules covering 7 capability pillars:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr8p1h2yyl0es1r4nk5r6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr8p1h2yyl0es1r4nk5r6.png" alt=" "&gt;&lt;/a&gt;&lt;br&gt;
The symbol intelligence engine uses regex-based parsing that supports 10 programming languages: Rust, Python, JavaScript/TypeScript, Go, Java/Kotlin, C, C++, Ruby, PHP, and Swift.&lt;/p&gt;

&lt;p&gt;For semantic search, CodeScope uses a pure TF-IDF implementation with cosine similarity — no external ML library needed. It tokenizes source files, strips common keywords, and ranks results by relevance.&lt;/p&gt;
&lt;h2&gt;
  
  
  Real-World Example: Onboarding to a New Project
&lt;/h2&gt;

&lt;p&gt;Here's how I use CodeScope when joining a new project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Step 1: Get an overview&lt;/span&gt;
cs stats                              &lt;span class="c"&gt;# File count per language&lt;/span&gt;
cs graph &lt;span class="nt"&gt;--type&lt;/span&gt; modules                &lt;span class="c"&gt;# Module structure&lt;/span&gt;

&lt;span class="c"&gt;# Step 2: Find the authentication system&lt;/span&gt;
cs context &lt;span class="s2"&gt;"authentication"&lt;/span&gt;            &lt;span class="c"&gt;# All relevant files + symbols&lt;/span&gt;
cs where &lt;span class="s2"&gt;"authenticate"&lt;/span&gt; &lt;span class="nt"&gt;--open&lt;/span&gt;         &lt;span class="c"&gt;# Jump to definition&lt;/span&gt;

&lt;span class="c"&gt;# Step 3: Understand the data flow&lt;/span&gt;
cs trace &lt;span class="s2"&gt;"handle_request"&lt;/span&gt; &lt;span class="nt"&gt;--max-depth&lt;/span&gt; 5  &lt;span class="c"&gt;# Follow the call chain&lt;/span&gt;
cs impact &lt;span class="s2"&gt;"models/user.rs"&lt;/span&gt;             &lt;span class="c"&gt;# What uses the user model?&lt;/span&gt;

&lt;span class="c"&gt;# Step 4: Search for common patterns&lt;/span&gt;
cs across &lt;span class="s1"&gt;'TODO'&lt;/span&gt; &lt;span class="nt"&gt;--workspace&lt;/span&gt; ~/projects  &lt;span class="c"&gt;# All TODOs across all repos&lt;/span&gt;
cs content &lt;span class="s1"&gt;'deprecated'&lt;/span&gt; &lt;span class="nt"&gt;--count&lt;/span&gt; &lt;span class="nt"&gt;-j&lt;/span&gt;     &lt;span class="c"&gt;# Deprecated APIs with counts&lt;/span&gt;

&lt;span class="c"&gt;# Step 5: Get AI assistance&lt;/span&gt;
cs pack &lt;span class="s2"&gt;"authentication flow"&lt;/span&gt; &lt;span class="nt"&gt;-b&lt;/span&gt; 8000    &lt;span class="c"&gt;# Pack context for LLM&lt;/span&gt;
cs rewrite &lt;span class="s2"&gt;"add input validation"&lt;/span&gt; &lt;span class="nt"&gt;--dry-run&lt;/span&gt;  &lt;span class="c"&gt;# AI-suggested improvements&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What used to take 30+ minutes with 5 different tools now takes 2 minutes with one binary.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try It
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Quick install (macOS/Linux)&lt;/span&gt;
curl &lt;span class="nt"&gt;-sSL&lt;/span&gt; https://raw.githubusercontent.com/Arga-Wicaksono/codescope/main/scripts/install.sh | bash

&lt;span class="c"&gt;# Homebrew&lt;/span&gt;
brew tap Arga-Wicaksono/codescope &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; brew &lt;span class="nb"&gt;install &lt;/span&gt;codescope

&lt;span class="c"&gt;# From source&lt;/span&gt;
cargo &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;--git&lt;/span&gt; https://github.com/Arga-Wicaksono/codescope.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;GitHub: &lt;a href="https://github.com/Arga-Wicaksono/codescope" rel="noopener noreferrer"&gt;https://github.com/Arga-Wicaksono/codescope&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;CodeScope is MIT licensed and open source. I'd love to hear your feedback, ideas, and contributions. What codebase navigation workflows would you like to see supported?&lt;/p&gt;

&lt;p&gt;If you found this useful, follow me for more posts about Rust CLI tools and developer productivity. Feel free to star the repo on GitHub!&lt;/p&gt;




&lt;h2&gt;
  
  
  Tips untuk Dev.to
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Tags&lt;/strong&gt;: &lt;code&gt;#rust&lt;/code&gt; &lt;code&gt;#cli&lt;/code&gt; &lt;code&gt;#opensource&lt;/code&gt; &lt;code&gt;#productivity&lt;/code&gt; &lt;code&gt;#ai&lt;/code&gt; &lt;code&gt;#devtools&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cross-post ke&lt;/strong&gt;: Hashnode, Medium, dan personal blog&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Follow-up articles&lt;/strong&gt; (ide untuk seri):

&lt;ul&gt;
&lt;li&gt;"How I implemented TF-IDF semantic search in pure Rust"&lt;/li&gt;
&lt;li&gt;"Building an MCP server for Claude in Rust"&lt;/li&gt;
&lt;li&gt;"Zero-dependency CLI tools: the Rust advantage"&lt;/li&gt;
&lt;li&gt;"Benchmarking code search: fd vs rg vs cs on real codebases"&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

</description>
      <category>ai</category>
      <category>rust</category>
      <category>programming</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
