### AI Agent Quickstart Setup Source: https://vietbui.mintlify.app/concepts/linux-setup-guide A complete sequence of commands to install system dependencies, AI agents, and configure the environment. Run these steps in order as they contain load-bearing dependencies. ```bash # 1. System deps sudo apt-get update && sudo apt-get install -y git curl zsh jq stow build-essential ca-certificates # 2. nvm + node >= 18 curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash source ~/.nvm/nvm.sh && nvm install --lts && nvm use --lts # 3. ollama (local models) curl -fsSL https://ollama.com/install.sh | sh # 4. Clone repos — llm-wiki FIRST (dotfiles symlinks point here) mkdir -p ~/repos git clone git@github.com:vietbui1999ru/llm-wiki.git ~/repos/llm-wiki git clone git@github.com:vietbui1999ru/dotfiles.git ~/dotfiles # 5. Stow all dotfiles modules cd ~/dotfiles && stow claude opencode gemini codex # 6. Install Claude Code npm install -g @anthropic-ai/claude-code # 7. Install pi (council voice B / AFK loop worker) npm install -g @earendil-works/pi-coding-agent # 8. Install opencode (curl script — no brew needed on Linux) curl -fsSL https://opencode.ai/install | bash # 9. Install Gemini CLI npm install -g @google/gemini-cli # 10. Install wiki toolchain (uv + wiki-chat/index/mcp + git hook + ollama models) cd ~/repos/llm-wiki && bash claude-setup/scripts/install.sh # 11. Install headroom (context compression) — requires uv from step 10 uv tool install headroom-ai # 12. Set environment variables (edit values, then reload) cat >> ~/.zshrc << 'EOF' export ANTHROPIC_API_KEY="sk-ant-..." export GITHUB_TOKEN="ghp_..." # optional: council Voice B (GitHub Models) export PATH="$HOME/.local/bin:$PATH" source ~/repos/llm-wiki/templates/env-model-routing.sh # opencode model routing EOF source ~/.zshrc # 13. First claude run — downloads all plugins; qmd CLI becomes available after this claude --version # 14. Build wiki LightRAG index (one-time; ~30-60 min; costs ~$0.50 via Claude Haiku) wiki-index --full ``` -------------------------------- ### DiffViewer Setup and Integration Commands Source: https://vietbui.mintlify.app/entities/diffviewer Commands for starting the server, patching settings, and configuring integration with OpenCode and mobile devices. ```bash npm install node server.js # start server on :3333 bash scripts/install.sh # patch ~/.claude/settings.json hooks (idempotent) open http://localhost:3333 # OpenCode + Commandr integration: opencode --port 4096 ~/repos/Commandr OPENCODE_SERVER_URL=http://127.0.0.1:4096 node server.js ~/repos/Commandr # Mobile: node server.js --mobile --pair ~/repos/Commandr tailscale serve --bg 3334 # expose to tailnet ``` -------------------------------- ### Install and start Ollama Source: https://vietbui.mintlify.app/concepts/linux-setup-guide Installs the Ollama local model runner and starts the background daemon. ```bash curl -fsSL https://ollama.com/install.sh | sh ollama serve & # start daemon before install.sh runs ``` -------------------------------- ### Install and authenticate Gemini CLI Source: https://vietbui.mintlify.app/concepts/linux-setup-guide Install the Gemini CLI and perform initial authentication. ```bash npm install -g @google/gemini-cli gemini --version # should show 0.4x.x ``` ```bash gemini auth login ``` -------------------------------- ### Install opencode Source: https://vietbui.mintlify.app/concepts/linux-setup-guide Install the opencode CLI using the provided installation script or npm. ```bash curl -fsSL https://opencode.ai/install | bash # or: npm install -g opencode-ai opencode --version ``` -------------------------------- ### Install Wiki toolchain Source: https://vietbui.mintlify.app/concepts/linux-setup-guide Run the installation script for the wiki toolchain within the repository directory. ```bash cd ~/repos/llm-wiki bash claude-setup/scripts/install.sh ``` -------------------------------- ### Install system packages Source: https://vietbui.mintlify.app/concepts/linux-setup-guide Installs core utilities required for the development environment. ```bash sudo apt-get update && sudo apt-get install -y \ git curl zsh jq stow build-essential ca-certificates ``` -------------------------------- ### Install and use headroom Source: https://vietbui.mintlify.app/concepts/linux-setup-guide Install the headroom context compression tool and configure it for wrapping or proxying. ```bash uv tool install headroom-ai headroom --version ``` ```bash headroom wrap claude # wraps Claude Code — transparent compression headroom wrap opencode # wraps opencode headroom proxy --port 8787 # zero-code proxy; point ANTHROPIC_BASE_URL at it ``` -------------------------------- ### Install a local omp plugin Source: https://vietbui.mintlify.app/entities/omp Commands to navigate to a plugin directory and install it into the current project. ```bash cd pi-headroom && npm install omp install ./pi-headroom ``` -------------------------------- ### Clone and install project dependencies Source: https://vietbui.mintlify.app/guides/onboarding Clones the repository and executes the installation script to set up hooks and local binaries. ```bash git clone git@github.com:vietbui1999ru/llm-wiki.git ~/repos/llm-wiki cd ~/repos/llm-wiki bash claude-setup/scripts/install.sh ``` -------------------------------- ### Install ECC via Plugin Marketplace Source: https://vietbui.mintlify.app/entities/everything-claude-code Recommended installation method using the plugin marketplace followed by manual rule configuration. ```bash /plugin marketplace add https://github.com/affaan-m/everything-claude-code /plugin install ecc@ecc # Then manually copy rules (plugins can't distribute rules): mkdir -p ~/.claude/rules/ecc cp -r everything-claude-code/rules/common ~/.claude/rules/ecc/ cp -r everything-claude-code/rules/typescript ~/.claude/rules/ecc/ # pick your stack ``` -------------------------------- ### Header Versioning Examples Source: https://vietbui.mintlify.app/patterns/api-design Examples of versioning APIs using custom headers or media type parameters. ```text Accept: application/vnd.api+json;version=2 API-Version: 2024-01-01 ``` -------------------------------- ### Install Ponytail for Pi Agent Source: https://vietbui.mintlify.app/entities/ponytail Use the Pi CLI to install the Ponytail repository directly from GitHub. ```bash pi install git:github.com/DietrichGebert/ponytail ``` -------------------------------- ### New project setup workflow Source: https://vietbui.mintlify.app/guides/reference The recommended sequence of commands to initialize a new repository, plan features, and implement them using TDD. ```text /setup-matt-pocock-skills → configure repo /grill-with-docs → plan the change, build CONTEXT.md /to-prd → capture as issue /to-issues → break into tickets /tdd → implement each ticket /diagnose → when something breaks ``` -------------------------------- ### Test Builder Pattern Source: https://vietbui.mintlify.app/concepts/unit-testing Example of using a builder to centralize object construction and hide irrelevant setup. ```text OrderBuilder().WithStandardCustomer().WithItem(...).Build() ``` -------------------------------- ### Install Council for Zed Source: https://vietbui.mintlify.app/comparisons/cc-to-cross-platform-migration Execute the installation script with a minimal profile targeting the Zed environment. ```bash ./install.sh --profile minimal --target zed ``` -------------------------------- ### Install OpenTelemetry Instrumentation Packages Source: https://vietbui.mintlify.app/entities/opentelemetry Install the necessary OpenInference and core OpenTelemetry instrumentation packages for various AI frameworks. ```bash # OpenInference project (Arize) pip install openinference-instrumentation-anthropic pip install openinference-instrumentation-openai pip install openinference-instrumentation-langchain pip install openinference-instrumentation-llama-index # Core OTel (upstream) pip install opentelemetry-instrumentation-openai pip install opentelemetry-instrumentation-anthropic pip install opentelemetry-instrumentation-langchain pip install opentelemetry-instrumentation-llamaindex ``` -------------------------------- ### Daemon Initialization Source: https://vietbui.mintlify.app/syntheses/agent-diff-viewer Command to start the diff-viewer server in a named tmux window. ```bash tmux new-window -n diff-viewer 'node ~/.claude/tools/diff-viewer/server.js' ``` -------------------------------- ### Install ECC with Selective Profile Source: https://vietbui.mintlify.app/entities/everything-claude-code Minimal installation profile for rules and agents without hooks. ```bash ./install.sh --profile minimal --target claude # rules + agents only, no hooks ``` -------------------------------- ### URL Versioning Examples Source: https://vietbui.mintlify.app/patterns/api-design Examples of versioning APIs by including the version number in the URL path. ```text /v1/users /v2/users ``` -------------------------------- ### Install OpenCode DCP Plugin Source: https://vietbui.mintlify.app/concepts/dynamic-context-pruning Use the OpenCode CLI to install the latest version of the DCP plugin globally. ```bash opencode plugin @tarquinen/opencode-dcp@latest --global ``` -------------------------------- ### Install Lean Session Plugin Source: https://vietbui.mintlify.app/entities/lean-session Command to copy the plugin file to the OpenCode configuration directory. Ensure the file is in JavaScript format for proper loading. ```bash # Compile TS → JS first, or copy as-is if OpenCode handles TS cp ~/repos/llm-wiki/templates/lean-compaction-plugin.ts \ ~/.config/opencode/plugins/lean-session.js ``` -------------------------------- ### Install and run Pi coding agent Source: https://vietbui.mintlify.app/concepts/linux-setup-guide Install the Pi agent and execute it as a stateless subprocess for peer review tasks. ```bash npm install -g @earendil-works/pi-coding-agent pi --version ``` ```bash pi -p "Peer review: [decision]. Flag concerns." \ --model openai-codex/gpt-5.3-codex \ --no-session --no-extensions --no-skills ``` -------------------------------- ### Install Node.js via nvm Source: https://vietbui.mintlify.app/concepts/linux-setup-guide Downloads and installs the Node Version Manager and the latest LTS version of Node.js. ```bash curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash source ~/.bashrc # or ~/.zshrc nvm install --lts && nvm use --lts node --version # must be >= 18 ``` -------------------------------- ### Install Claude Code Source: https://vietbui.mintlify.app/concepts/linux-setup-guide Install the Claude Code CLI globally via npm. ```bash npm install -g @anthropic-ai/claude-code claude --version ``` -------------------------------- ### Test Naming Convention Examples Source: https://vietbui.mintlify.app/concepts/unit-testing Examples of the [Method]_[Scenario]_[ExpectedBehavior] naming pattern. ```text ProcessPayment_InsufficientFunds_ThrowsPaymentException Withdraw_ValidAmount_DecreasesBalance CalculateShipping_InternationalOrderOverThreshold_GetsFreeShipping ``` -------------------------------- ### Implement warm-server pattern with opencode serve Source: https://vietbui.mintlify.app/entities/opencode Starts a persistent HTTP server to avoid cold-boot overhead, allowing multiple tasks to attach to the same session. ```bash opencode serve --port 4096 & opencode run --attach http://localhost:4096 "task 1" opencode run --attach http://localhost:4096 "task 2" ``` -------------------------------- ### Install Docling via pip Source: https://vietbui.mintlify.app/entities/docling Use this command to install the Docling package in your Python environment. ```bash pip install docling ``` -------------------------------- ### TOON Format Example Source: https://vietbui.mintlify.app/concepts/llm-serialization-formats Demonstrates the TOON format using key shortening and structure flattening. ```text users[2]{id,name,role}: 1,Alice,admin 2,Bob,user ``` -------------------------------- ### Install ECC Manually Source: https://vietbui.mintlify.app/entities/everything-claude-code Fallback installation method using the provided script or npm package. ```bash ./install.sh --profile full # or: npx ecc-install --profile full ``` -------------------------------- ### Verify CLI Tool Installations Source: https://vietbui.mintlify.app/concepts/linux-setup-guide Run these commands to confirm that Claude Code, Wiki binaries, opencode, Pi, headroom, and Gemini CLI are correctly installed and configured. ```bash # Claude Code + plugins claude --version qmd query "agent orchestration" --limit 3 # Wiki binaries wiki-index --status wiki-chat --help # opencode opencode --version cat ~/.config/opencode/opencode.json | jq '.mcp | keys' # should include: "context7", "qmd", "wiki-rag" # Pi pi --version # headroom headroom --version # Gemini CLI gemini --version # Hooks ls ~/.claude/hooks/ # should include: context-threshold-check.sh, enforce-agent-whitelist.sh, # enforce-bash-safety.sh, judge-reminder.sh, lint-autofix.sh, etc. ``` -------------------------------- ### Define CLAUDE.md startup instructions Source: https://vietbui.mintlify.app/concepts/shared-task-queue Provides instructions for agents to claim tasks at the start of a session. ```markdown ## Startup: Claim Your Task Before doing anything else in a new session: 1. Run: bash "$(dirname "$(git rev-parse --git-common-dir)")/.agents/claim.sh" 2. If output starts with `claimed:` — read the file path; that's your task 3. If output is `inbox:empty` — check with the coordinator before continuing 4. On completion: run bash "$(dirname "$(git rev-parse --git-common-dir)")/.agents/complete.sh " ``` -------------------------------- ### Install the lean workflow Source: https://vietbui.mintlify.app/guides/onboarding Run this script to add a cross-provider AGENTS.md file to your project, ensuring consistent agent rules across repositories. ```bash ~/repos/llm-wiki/templates/install-agents-md.sh /path/to/project ``` -------------------------------- ### ONTO Format Example Source: https://vietbui.mintlify.app/concepts/llm-serialization-formats Demonstrates the ONTO format using pipe-delimited rows and indentation for hierarchical data. ```text Telemetry[3]: device_id: sensor-001|sensor-002|sensor-003 temperature: 23.5|24.1|22.9 location: lat: 37.77|37.78|37.79 lon: -122.41|-122.42|-122.43 ``` -------------------------------- ### Configure MIPROv2 with two-LM setup Source: https://vietbui.mintlify.app/entities/dspy Separates the prompt generation model from the task evaluation model to optimize prompts using a stronger reasoning LM. ```python tp = dspy.MIPROv2( metric=validate_category, prompt_model=large_lm, # generates candidate prompts task_model=small_lm # evaluated against training set ) ``` -------------------------------- ### Install and Configure CodeGraphContext Source: https://vietbui.mintlify.app/entities/codegraphcontext Commands for installing the package, indexing directories, and setting up the MCP server for Claude Code integration. ```bash pip install codegraphcontext # Index current directory codegraphcontext index . # Index + watch simultaneously (daemon mode — live updates) codegraphcontext watch . # Auto-configure Claude Code (writes .claude.json) codegraphcontext mcp setup # Start MCP server codegraphcontext mcp start ``` -------------------------------- ### File Ownership Map Source: https://vietbui.mintlify.app/concepts/linux-setup-guide A mapping of configuration directories and files to their respective installation methods or sources. ```text ~/.claude/ ← stow claude ~/.claude/CLAUDE.md ← real file in dotfiles ~/.claude/settings.json ← real file in dotfiles ~/.claude/rules/ ← mix: real files + symlinks → llm-wiki/claude-setup/rules/ ~/.claude/hooks/ ← real files in dotfiles ~/.claude/plugins/cache/ ← downloaded on first claude run (not in dotfiles) ~/.config/opencode/opencode.json ← stow opencode (paths fixed by sed in Step 3+7) ~/.config/opencode/plugins/ ← stow opencode ~/.gemini/GEMINI.md ← stow gemini ~/.gemini/settings.json ← stow gemini ~/.gemini/commands/ ← stow gemini ~/.codex/ ← stow codex ~/.local/bin/wiki-chat ← install.sh ~/.local/bin/wiki-index ← install.sh ~/.local/bin/wiki-mcp ← install.sh ~/repos/llm-wiki/.git/hooks/post-commit ← install.sh ~/repos/llm-wiki/.lightrag/ ← wiki-index --full ``` -------------------------------- ### Define Related Nodes Configuration Source: https://vietbui.mintlify.app/concepts/linux-setup-guide A JSON array defining various concepts and entities related to the Linux setup guide, including their IDs, labels, and grouping. ```json const NODES=[{"id":"concepts/linux-setup-guide","label":"Linux Machine Setup Guide","group":"concepts","val":3.23606797749979},{"id":"syntheses/lean-agentic-workflow","label":"Lean Agentic Coding Workflow","group":"syntheses","val":5.795831523312719},{"id":"entities/opencode","label":"OpenCode","group":"entities","val":5.358898943540674},{"id":"entities/pi-agent","label":"Pi Agent (pi-mono)","group":"entities","val":5.123105625617661},{"id":"concepts/council-pattern","label":"Council Pattern","group":"concepts","val":4},{"id":"entities/headroom","label":"Headroom","group":"entities","val":3.23606797749979},{"id":"concepts/agent-harness","label":"Agent Harness","group":"concepts","val":7.48074069840786},{"id":"concepts/context-compression","label":"Context Compression Strategies","group":"concepts","val":6.0990195135927845},{"id":"concepts/agent-skills","label":"Agent Skills","group":"concepts","val":5.795831523312719},{"id":"concepts/agent-self-correction","label":"Agent Self-Correction","group":"concepts","val":5.358898943540674},{"id":"concepts/verification-pipeline","label":"Verification Pipeline","group":"concepts","val":5.358898943540674},{"id":"concepts/multi-vendor-adversarial-review","label":"Multi-Vendor Adversarial Review","group":"concepts","val":4.872983346207417},{"id":"syntheses/desktop-control-plane","label":"Desktop AI Agent Control Plane — Architecture Synthesis","group":"syntheses","val":4.60555127546399},{"id":"concepts/agentic-cicd","label":"Agentic CI/CD","group":"concepts","val":4.60555127546399},{"id":"concepts/worktree-isolation","label":"Worktree Isolation","group":"concepts","val":4.60555127546399},{"id":"syntheses/agent-primitive-selection","label":"Agent Primitive Selection","group":"syntheses","val":4.464101615137754},{"id":"comparisons/spec-driven-frameworks-vs-native","label":"Spec-Driven Frameworks vs Native Claude Code","group":"comparisons","val":4.3166247903554},{"id":"syntheses/control-plane-expansion-plan","label":"Control Plane Expansion Plan — Gap Analysis and Phase 0.5 Roadmap","group":"syntheses","val":4.3166247903554},{"id":"comparisons/cc-to-cross-platform-migration","label":"Claude Code → Cross-Platform Migration Matrix","group":"comparisons","val":4.16227766016838},{"id":"entities/dangeresque","label":"Dangeresque","group":"entities","val":4.16227766016838},{"id":"entities/sandcastle","label":"SandCastle","group":"entities","val":4.16227766016838},{"id":"comparisons/our-stack-vs-omp","label":"Our Stack vs omp","group":"comparisons","val":4},{"id":"entities/commandr","label":"Commandr","group":"entities","val":4},{"id":"entities/omp","label":"omp (oh-my-pi)","group":"entities","val":4},{"id":"concepts/rules-vs-hooks","label":"Rules vs. Hooks","group":"concepts","val":4},{"id":"concepts/memory-bank-pattern","label":"Memory Bank Pattern","group":"concepts","val":4},{"id":"comparisons/claude-code-vs-opencode-plugins","label":"Claude Code vs OpenCode Plugin Systems","group":"comparisons","val":3.8284271247461903},{"id":"entities/agentops","label":"AgentOps" ``` -------------------------------- ### Implementing a Facade in TypeScript Source: https://vietbui.mintlify.app/patterns/design-patterns-structural This example demonstrates wrapping multiple complex subsystem classes into a single ApiGateway class to provide a simplified interface for client requests. ```typescript // Complex subsystem internals (unchanged, 3rd-party or legacy) class AuthService { verify(token: string): boolean { return true; } } class RateLimiter { allow(userId: string): boolean { return true; } } class AuditLog { record(event: string): void { /* ... */ } } // Facade: one entry point for the common case class ApiGateway { private auth = new AuthService(); private limiter = new RateLimiter(); private audit = new AuditLog(); handleRequest(token: string, userId: string, action: string): boolean { if (!this.auth.verify(token)) return false; if (!this.limiter.allow(userId)) return false; this.audit.record(action); return true; } } ``` -------------------------------- ### /claude-init Source: https://vietbui.mintlify.app/guides/reference Initializes project onboarding by checking profile.md, scanning the codebase, and setting up CLAUDE.md. ```APIDOC ## /claude-init ### Description Performs project onboarding. It checks for the CGC flag in profile.md, scans the codebase, and prompts the user to configure CLAUDE.md and profile.md settings. ### Method Slash Command ### Endpoint /claude-init ``` -------------------------------- ### Access help documentation Source: https://vietbui.mintlify.app/entities/obsidian-cli Use the help command to retrieve the most current list of available commands. ```bash obsidian help ``` -------------------------------- ### Build and Verify Wiki Index Source: https://vietbui.mintlify.app/syntheses/local-rag-wiki Commands to verify the backend functionality and perform the initial full graph build. ```bash wiki-index --test # verify backend wiki-index --full # build (~30–60 min for ~150 pages with local LLM) ``` -------------------------------- ### Configure and Initialize Knowledge Graph Source: https://vietbui.mintlify.app/concepts/compounding-knowledge-base Sets up graph rendering properties, node styling, and initial animation state. ```javascript .linkColor(function(){return 'rgba(255,255,255,0.12)';}) .nodeRelSize(opt.ns).linkWidth(opt.lw) .linkDirectionalArrowLength(0).linkDirectionalArrowRelPos(1).linkDirectionalArrowColor(function(){return 'rgba(255,255,255,0.4)';}) .nodeCanvasObjectMode(function(){return 'after';}) .nodeCanvasObject(function(n,ctx,scale){var r=opt.ns*Math.sqrt(n.val||1); if(n.id===CUR){ctx.beginPath();ctx.arc(n.x,n.y,r+1.6,0,6.283);ctx.strokeStyle='#fff';ctx.lineWidth=1.2/scale;ctx.stroke();} if(opt.to>0&&opt.ts>0){var t=n.label.length>28?n.label.slice(0,26)+'…':n.label;ctx.globalAlpha=opt.to;ctx.font=((n.id===CUR?opt.ts+1:opt.ts))+'px ui-sans-serif,sans-serif';ctx.fillStyle=(n.id===CUR)?'#ffffff':'#aab0c0';ctx.textAlign='center';ctx.textBaseline='top';ctx.fillText(t,n.x,n.y+r+1.5);ctx.globalAlpha=1;}}) .onNodeClick(function(n){if(window.top){window.top.location.href='/'+n.id;}}); G.graphData(visible());G.d3VelocityDecay(0.4); function fit(){G.zoomToFit(400,20);} setTimeout(fit,350);setTimeout(fit,1100); ``` -------------------------------- ### Verify Claude Code Installation Source: https://vietbui.mintlify.app/concepts/linux-setup-guide Check the installed version of the Claude CLI to trigger plugin downloads. ```bash claude --version ``` -------------------------------- ### Initialize Graph Visualization Source: https://vietbui.mintlify.app/concepts/actor-model Sets up the color mapping, adjacency list, and visibility logic for the force-directed graph. ```javascript const C={concepts:'#8B7CF6',patterns:'#0D9373',systems:'#E0567C',syntheses:'#E2A03F',comparisons:'#3B82F6',entities:'#14B8A6',guides:'#9CA3AF'}; function lid(x){return (x&&x.id!==undefined)?x.id:x;} const ADJ=new Map(NODES.map(function(n){return [n.id,new Set()];})); LINKS.forEach(function(l){var s=lid(l.source),t=lid(l.target);if(ADJ.has(s)&&ADJ.has(t)){ADJ.get(s).add(t);ADJ.get(t).add(s);}}); var opt={ns:1.8,lw:0.6,ts:3.5,to:0.75,dp:2,ar:false}; function visible(){ if(!CUR)return {nodes:NODES,links:LINKS}; var dist=new Map([[CUR,0]]),fr=[CUR]; for(var d=1;d<=opt.dp;d++){var nx=[];fr.forEach(function(u){(ADJ.get(u)||[]).forEach(function(v){if(!dist.has(v)){dist.set(v,d);nx.push(v);}});});fr=nx;} var keep=new Set(dist.keys()); return {nodes:NODES.filter(function(n){return keep.has(n.id);}),links:LINKS.filter(function(l){return keep.has(lid(l.source))&&keep.has(lid(l.target));})}; } ``` ```javascript var el=document.getElementById('g'); var G=ForceGraph()(el).backgroundColor('#0f1117').nodeId('id') .warmupTicks(24).cooldownTicks(70).autoPauseRedraw(true) .nodeColor(function(n){return C[n.group]||'#9CA3AF';}).nodeLabel('label').nodeVal(function(n){return n.val;}) .linkColor(function(){return 'rgba(255,255,255,0.12)';}) .nodeRelSize(opt.ns).linkWidth(opt.lw) .linkDirectionalArrowLength(0).linkDirectionalArrowRelPos(1).linkDirectionalArrowColor(function(){return 'rgba(255,255,255,0.4)';}) .nodeCanvasObjectMode(function(){return 'after';}) .nodeCanvasObject(function(n,ctx,scale){var r=opt.ns*Math.sqrt(n.val||1); if(n.id===CUR){ctx.beginPath();ctx.arc(n.x,n.y,r+1.6,0,6.283);ctx.strokeStyle='#fff';ctx.lineWidth=1.2/scale;ctx.stroke();} if(opt.to>0&&opt.ts>0){var t=n.label.length>28?n.label.slice(0,26)+'…':n.label;ctx.globalAlpha=opt.to;ctx.font=((n.id===CUR?opt.ts+1:opt.ts))+'px ui-sans-serif,sans-serif';ctx.fillStyle=(n.id===CUR)?'#ffffff':'#aab0c0';ctx.textAlign='center';ctx.textBaseline='top';ctx.fillText(t,n.x,n.y+r+1.5);ctx.globalAlpha=1;}}) ``` -------------------------------- ### Initialize Memory Tool Source: https://vietbui.mintlify.app/concepts/agentic-memory-tool Configure the Anthropic client with the memory_20250818 tool and required beta headers. ```python response = client.beta.messages.create( model="claude-sonnet-4-6", tools=[{"type": "memory_20250818", "name": "memory"}], betas=["context-management-2025-06-27"], messages=messages, ... ) # Execute tool_use blocks against local /memories directory ``` -------------------------------- ### Query Wiki via CLI Source: https://vietbui.mintlify.app/guides/reference Execute a direct query against the wiki using the qmd tool. ```bash cd ~/repos/llm-wiki qmd query "context compression degradation" --files --min-score 0.4 ``` -------------------------------- ### Initialize and Configure Knowledge Graph UI Source: https://vietbui.mintlify.app/concepts/agentic-memory-tool Sets up the initial state of the graph panel, including visibility toggles, event listeners for settings, and dynamic header text updates. ```javascript if(!CUR)document.getElementById('depthRow').style.display='none'; var aE=document.getElementById('ar');aE.checked=opt.ar;aE.addEventListener('change',function(){opt.ar=aE.checked;apply(false);}); document.getElementById('gear').addEventListener('click',function(){document.getElementById('panel').classList.toggle('open');}); var hd=document.getElementById('hd');hd.textContent='⠿ '+(CUR?'Local graph':'Knowledge graph'); ``` -------------------------------- ### Optimize KV-Cache with Stable System Prompts Source: https://vietbui.mintlify.app/concepts/context-compression Demonstrates the difference between cache-unfriendly dynamic system prompts and cache-friendly static prompts. ```python # Cache-unfriendly: timestamp in system prompt system = f"Current time: {datetime.now().isoformat()}\nYou are..." # Cache-friendly: stable system prompt, dynamic data appended system = "You are a code assistant. Current time is provided per-request." ``` -------------------------------- ### Recommended Workflow for Experienced Developers Source: https://vietbui.mintlify.app/comparisons/spec-driven-frameworks-vs-native A structured sequence for building non-trivial software using lean skills and adversarial review. ```text 1. grill-me → PRD → kanban DAG (Pocock workflow, lean skills) 2. AFK parallel run via Dangeresque or SandCastle 3. Adversarial review (cross-vendor or Sonnet→Opus) 4. Human merge gate 5. Clear context between sessions; filesystem as state ``` -------------------------------- ### GET /agent Source: https://vietbui.mintlify.app/entities/opencode Lists all available agents. ```APIDOC ## GET /agent ### Description List available agents. ### Method GET ### Endpoint /agent ``` -------------------------------- ### Recommended Workflow for Non-Engineers Source: https://vietbui.mintlify.app/comparisons/spec-driven-frameworks-vs-native A simplified workflow for mid-complexity products focusing on discipline enforcement and human QA. ```text 1. Use Superpowers for discipline enforcement (Iron Laws catch what you'd miss) 2. Or: grill-me → explicit review checkpoints → human QA 3. Skip AFK parallel runs until process is stable ``` -------------------------------- ### GET /event Source: https://vietbui.mintlify.app/entities/opencode Retrieves an SSE stream of all bus events. ```APIDOC ## GET /event ### Description SSE stream of all bus events. ### Method GET ### Endpoint /event ``` -------------------------------- ### Initialize Force-Directed Graph for Documentation Source: https://vietbui.mintlify.app/concepts/software-documentation Sets up the graph data, adjacency mapping, and visualization parameters for rendering documentation relationships. ```javascript l-rag-wiki", "target": "concepts/wikilink-graph-extraction"},{"source": "comparisons/cc-to-cross-platform-migration", "target": "entities/opencode"},{"source": "comparisons/cc-to-cross-platform-migration", "target": "entities/agents-md-format"},{"source": "comparisons/cc-to-cross-platform-migration", "target": "concepts/agent-context-instructions"},{"source": "comparisons/cc-to-cross-platform-migration", "target": "concepts/agent-skills"},{"source": "comparisons/cc-to-cross-platform-migration", "target": "concepts/agent-subagents"},{"source": "entities/agent-native", "target": "concepts/agent-harness"},{"source": "entities/agent-native", "target": "concepts/agent-context-instructions"},{"source": "entities/agentops", "target": "concepts/multi-vendor-adversarial-review"},{"source": "entities/agentops", "target": "concepts/domain-glossary"},{"source": "entities/agentops", "target": "concepts/agent-context-instructions"},{"source": "entities/agentops", "target": "syntheses/lean-agentic-workflow"},{"source": "entities/agents-md-format", "target": "concepts/rules-vs-hooks"},{"source": "entities/agents-md-format", "target": "concepts/agent-context-instructions"},{"source": "entities/ai-coding-agents", "target": "concepts/agent-context-instructions"},{"source": "entities/ai-coding-agents", "target": "concepts/ai-specific-pitfalls"},{"source": "entities/ai-coding-agents", "target": "concepts/ai-code-review"},{"source": "entities/docling", "target": "concepts/contextual-retrieval"},{"source": "entities/opencode", "target": "concepts/context-compression"},{"source": "entities/opencode", "target": "concepts/agent-harness"},{"source": "entities/opencode", "target": "entities/ai-coding-agents"},{"source": "entities/pi-agent", "target": "concepts/model-tier-routing"},{"source": "entities/pi-agent", "target": "concepts/multi-vendor-adversarial-review"},{"source": "entities/pi-agent", "target": "entities/opencode"},{"source": "entities/pi-agent", "target": "concepts/agent-self-correction"},{"source": "guides/onboarding", "target": "concepts/software-documentation"},{"source": "guides/onboarding", "target": "concepts/agent-skills"},{"source": "guides/onboarding", "target": "syntheses/local-rag-wiki"},{"source": "guides/onboarding", "target": "concepts/tiered-knowledge-delivery"},{"source": "guides/onboarding", "target": "concepts/model-tier-routing"}],CUR="concepts/software-documentation",MAXD=3; const C={concepts:'#8B7CF6',patterns:'#0D9373',systems:'#E0567C',syntheses:'#E2A03F',comparisons:'#3B82F6',entities:'#14B8A6',guides:'#9CA3AF'}; function lid(x){return (x&&x.id!==undefined)?x.id:x;} const ADJ=new Map(NODES.map(function(n){return [n.id,new Set()];})); LINKS.forEach(function(l){var s=lid(l.source),t=lid(l.target);if(ADJ.has(s)&&ADJ.has(t)){ADJ.get(s).add(t);ADJ.get(t).add(s);}}); var opt={ns:1.8,lw:0.6,ts:3.5,to:0.75,dp:2,ar:false}; function visible(){ if(!CUR)return {nodes:NODES,links:LINKS}; var dist=new Map([[CUR,0]]),fr=[CUR]; for(var d=1;d<=opt.dp;d++){var nx=[];fr.forEach(function(u){(ADJ.get(u)||[]).forEach(function(v){if(!dist.has(v)){dist.set(v,d);nx.push(v);}});});fr=nx;} var keep=new Set(dist.keys()); return {nodes:NODES.filter(function(n){return keep.has(n.id);}),links:LINKS.filter(function(l){return keep.has(lid(l.source))&&keep.has(lid(l.target));})}; } var el=document.getElementById('g'); var G=ForceGraph()(el).backgroundColor('#0f1117').nodeId('id') .warmupTicks(24).cooldownTicks(70).autoPauseRedraw(true) .nodeColor(function(n){return C[n.group]||'#9CA3AF';}).nodeLabel('label').nodeVal(function(n){return n.val;}) .linkColor(function(){return 'rgba(255,255,255,0.12)';}) .nodeRelSize(opt.ns).linkWidth(opt.lw) .linkDirectionalArrowLength(0).linkDirectionalArrowRelPos(1).linkDirectionalArrowColor(function(){return 'rgba(255,255,255,0.4)';}) ``` -------------------------------- ### Define Multi-file Instructions Source: https://vietbui.mintlify.app/entities/opencode Configure the instructions field in opencode.json to include local files, glob patterns, or remote URLs. ```json { "instructions": [ "CONTRIBUTING.md", "docs/guidelines.md", ".cursor/rules/*.md", "https://raw.githubusercontent.com/my-org/shared-rules/main/style.md" ] } ``` -------------------------------- ### GET https://context7.com/api/v2/libs/search Source: https://vietbui.mintlify.app/entities/context7 Searches for libraries based on a name and query string. ```APIDOC ## GET https://context7.com/api/v2/libs/search ### Description Searches for libraries matching the provided name and query parameters. ### Method GET ### Endpoint https://context7.com/api/v2/libs/search ### Parameters #### Query Parameters - **libraryName** (string) - Required - The name of the library to search for. - **query** (string) - Required - The search query string. ### Response #### Success Response (200) - **results** (array) - A list of library objects containing id, title, and other metadata. ### Response Example { "results": [ { "id": "/vercel/next.js", "title": "Next.js" } ] } ``` -------------------------------- ### Offset-based Pagination Request Source: https://vietbui.mintlify.app/patterns/api-design Example of a request using offset and limit parameters for pagination. ```text GET /users?offset=100&limit=50 ``` -------------------------------- ### Initialize and Configure Force-Directed Graph Source: https://vietbui.mintlify.app/patterns/frontend Sets up the graph visualization with custom node colors, labels, and interaction handlers. Requires the ForceGraph library to be loaded in the environment. ```javascript const C={concepts:'#8B7CF6',patterns:'#0D9373',systems:'#E0567C',syntheses:'#E2A03F',comparisons:'#3B82F6',entities:'#14B8A6',guides:'#9CA3AF'}; function lid(x){return (x&&x.id!==undefined)?x.id:x;} const ADJ=new Map(NODES.map(function(n){return [n.id,new Set()];})); LINKS.forEach(function(l){var s=lid(l.source),t=lid(l.target);if(ADJ.has(s)&&ADJ.has(t)){ADJ.get(s).add(t);ADJ.get(t).add(s);}}); var opt={ns:1.8,lw:0.6,ts:3.5,to:0.75,dp:2,ar:false}; function visible(){ if(!CUR)return {nodes:NODES,links:LINKS}; var dist=new Map([[CUR,0]]),fr=[CUR]; for(var d=1;d<=opt.dp;d++){var nx=[];fr.forEach(function(u){(ADJ.get(u)||[]).forEach(function(v){if(!dist.has(v)){dist.set(v,d);nx.push(v);}});});fr=nx;} var keep=new Set(dist.keys()); return {nodes:NODES.filter(function(n){return keep.has(n.id);}),links:LINKS.filter(function(l){return keep.has(lid(l.source))&&keep.has(lid(l.target));})}; } var el=document.getElementById('g'); var G=ForceGraph()(el).backgroundColor('#0f1117').nodeId('id') .warmupTicks(24).cooldownTicks(70).autoPauseRedraw(true) .nodeColor(function(n){return C[n.group]||'#9CA3AF';}).nodeLabel('label').nodeVal(function(n){return n.val;}) .linkColor(function(){return 'rgba(255,255,255,0.12)';}) .nodeRelSize(opt.ns).linkWidth(opt.lw) .linkDirectionalArrowLength(0).linkDirectionalArrowRelPos(1).linkDirectionalArrowColor(function(){return 'rgba(255,255,255,0.4)';}) .nodeCanvasObjectMode(function(){return 'after';}) .nodeCanvasObject(function(n,ctx,scale){var r=opt.ns*Math.sqrt(n.val||1); if(n.id===CUR){ctx.beginPath();ctx.arc(n.x,n.y,r+1.6,0,6.283);ctx.strokeStyle='#fff';ctx.lineWidth=1.2/scale;ctx.stroke();} if(opt.to>0&&opt.ts>0){var t=n.label.length>28?n.label.slice(0,26)+'…':n.label;ctx.globalAlpha=opt.to;ctx.font=((n.id===CUR?opt.ts+1:opt.ts))+'px ui-sans-serif,sans-serif';ctx.fillStyle=(n.id===CUR)?'#ffffff':'#aab0c0';ctx.textAlign='center';ctx.textBaseline='top';ctx.fillText(t,n.x,n.y+r+1.5);ctx.globalAlpha=1;}}) .onNodeClick(function(n){if(window.top){window.top.location.href='/'+n.id;}}); G.graphData(visible());G.d3VelocityDecay(0.4); function fit(){G.zoomToFit(400,20);} setTimeout(fit,350);setTimeout(fit,1100); var pt;function pause(){G.pauseAnimation();}function resume(){G.resumeAnimation();} function idle(ms){clearTimeout(pt);pt=setTimeout(pause,ms);} document.body.addEventListener('pointerenter',function(){clearTimeout(pt);resume();}); document.body.addEventListener('pointerleave',function(){idle(250);}); ``` -------------------------------- ### GET https://context7.com/api/v2/context Source: https://vietbui.mintlify.app/entities/context7 Fetches documentation text for a specific library ID and query. ```APIDOC ## GET https://context7.com/api/v2/context ### Description Retrieves documentation text and code snippets for a given library ID and query. ### Method GET ### Endpoint https://context7.com/api/v2/context ### Parameters #### Query Parameters - **libraryId** (string) - Required - The unique identifier for the library. - **query** (string) - Required - The specific query to fetch documentation for. ### Response #### Success Response (200) - **body** (string) - Plain text documentation content. ``` -------------------------------- ### Initialize Graph Visualization and Context Logic Source: https://vietbui.mintlify.app/concepts/agent-context-instructions Sets up the graph configuration, node relationships, and visibility filtering based on the current context. ```javascript const C={concepts:'#8B7CF6',patterns:'#0D9373',systems:'#E0567C',syntheses:'#E2A03F',comparisons:'#3B82F6',entities:'#14B8A6',guides:'#9CA3AF'}; function lid(x){return (x&&x.id!==undefined)?x.id:x;} const ADJ=new Map(NODES.map(function(n){return [n.id,new Set()];})); LINKS.forEach(function(l){var s=lid(l.source),t=lid(l.target);if(ADJ.has(s)&&ADJ.has(t)){ADJ.get(s).add(t);ADJ.get(t).add(s);}}); var opt={ns:1.8,lw:0.6,ts:3.5,to:0.75,dp:2,ar:false}; function visible(){ if(!CUR)return {nodes:NODES,links:LINKS}; var dist=new Map([[CUR,0]]),fr=[CUR]; for(var d=1;d<=opt.dp;d++){var nx=[];fr.forEach(function(u){(ADJ.get(u)||[]).forEach(function(v){if(!dist.has(v)){dist.set(v,d);nx.push(v);}});});fr=nx;} var keep=new Set(dist.keys()); return {nodes:NODES.filter(function(n){return keep.has(n.id);}),links:LINKS.filter(function(l){return keep.has(lid(l.source))&&keep.has(lid(l.target));})}; } var el=document.getElementById('g'); var G=ForceGraph()(el).backgroundColor('#0f1117').nodeId('id') .warmupTicks(24).cooldownTicks(70).autoPauseRedraw(true) .nodeColor(function(n){return C[n.group]||'#9CA3AF';}).nodeLabel('label').nodeVal(function(n){return n.val;}) .linkColor(function(){return 'rgba(255,255,255,0.12)';}) .nodeRelSize(opt.ns).linkWidth(opt.lw) .linkDirectionalArrowLength(0).linkDirectionalArrowRelPos(1).linkDirectionalArrowColor(function(){return 'rgba(255,255,255,0.4)';}) .nodeCanvasObjectMode(function(){return 'after';}) ``` -------------------------------- ### Create a Partial Index Source: https://vietbui.mintlify.app/patterns/database Example of creating an index that only includes rows matching a specific condition. ```sql CREATE INDEX idx_active_users ON users(email) WHERE status = 'active'; ``` -------------------------------- ### Configure OpenTelemetry Python SDK Source: https://vietbui.mintlify.app/entities/opentelemetry Initializes the TracerProvider with a resource and OTLP HTTP exporter. Ensure instrumentation occurs before initializing SDK clients. ```python from opentelemetry import trace from opentelemetry.sdk.trace import TracerProvider from opentelemetry.sdk.trace.export import BatchSpanProcessor from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter from opentelemetry.sdk.resources import Resource resource = Resource.create({ "service.name": "my-ai-service", "deployment.environment": "production", }) provider = TracerProvider(resource=resource) provider.add_span_processor( BatchSpanProcessor(OTLPSpanExporter(endpoint="http://otel-collector:4318")) ) trace.set_tracer_provider(provider) # Instrument before creating any SDK clients AnthropicInstrumentor().instrument() ``` -------------------------------- ### Merge Overlapping Intervals Source: https://vietbui.mintlify.app/patterns/algorithmic Merges overlapping intervals by sorting them by start time and iterating through the list. ```python intervals.sort(key=lambda x: x[0]) merged = [intervals[0]] for start, end in intervals[1:]: if start <= merged[-1][1]: merged[-1][1] = max(merged[-1][1], end) else: merged.append([start, end]) ``` -------------------------------- ### Identify DRY Violations in Python Source: https://vietbui.mintlify.app/patterns/principles Example of redundant logic where identical calculations are defined in separate functions. ```python def calculate_book_price(quantity, price): return quantity * price def calculate_laptop_price(quantity, price): return quantity * price ``` -------------------------------- ### Initialize Traceloop SDK Source: https://vietbui.mintlify.app/entities/opentelemetry Use the Traceloop wrapper for simplified initialization and broader framework support. ```python from traceloop.sdk import Traceloop Traceloop.init(app_name="my-agent") # Instruments LangChain, LangGraph, OpenAI, Anthropic automatically ``` -------------------------------- ### Define Agent Team Composition Source: https://vietbui.mintlify.app/concepts/agent-teams Example of spawning a team with specialized reviewers for a specific pull request. ```text Create an agent team to review PR #142. Spawn three reviewers: - One focused on security implications - One checking performance impact - One validating test coverage ``` -------------------------------- ### Spawn a teammate subagent Source: https://vietbui.mintlify.app/concepts/agent-subagents Example command for invoking a subagent as a teammate within an agent team context. ```text Spawn a teammate using the security-reviewer agent type to audit the auth module. ``` -------------------------------- ### Implement Dynamic Programming with Tabulation Source: https://vietbui.mintlify.app/patterns/algorithmic Uses an iterative approach to fill a table starting from base cases. ```python dp = [0] * (n + 1) dp[0] = base_value for i in range(1, n + 1): dp[i] = combine(dp[i-1], ...) ``` -------------------------------- ### Single Responsibility Principle Violation Source: https://vietbui.mintlify.app/patterns/principles An example of a class handling multiple responsibilities, making it difficult to maintain and test. ```java // Invoice calculates totals, prints to console, AND writes to disk — three reasons to change public class Invoice { public double calculateTotal() { ... } public void printInvoice() { System.out.println(...); } public void saveToFile(String filename) { ... } } ``` -------------------------------- ### Model ID reasoning suffix example Source: https://vietbui.mintlify.app/concepts/model-task-routing Demonstrates applying the high-effort reasoning suffix to a specific model ID. ```text opencode-go/kimi-k2.7-code:high ``` -------------------------------- ### Socratic Learning Source: https://vietbui.mintlify.app/guides/reference Engages Claude in a Socratic mode to guide development without providing direct code dumps. ```text /earn-it → Claude becomes Socratic: asks questions, guides design, you write the code → No code dumps; you earn each implementation piece ```