[{"data":1,"prerenderedAt":717},["ShallowReactive",2],{"docs-navigation":3,"\u002Farchitecture":80,"\u002Farchitecture-surround":712},[4,14,50,56,62,68,74],{"title":5,"path":6,"stem":7,"children":8},"Getting Started","\u002Fgetting-started","1.getting-started\u002Findex",[9,10],{"title":5,"path":6,"stem":7},{"title":11,"path":12,"stem":13},"Usage","\u002Fgetting-started\u002Fusage","1.getting-started\u002Fusage",{"title":15,"path":16,"stem":17,"children":18},"Packs","\u002Fpacks","2.packs",[19,22,28,34,40,44],{"title":20,"path":16,"stem":21},"Pack System","2.packs\u002Findex",{"title":23,"path":24,"stem":25,"children":26},"Pack Commands","\u002Fpacks\u002Fcommands","2.packs\u002Fcommands\u002Findex",[27],{"title":23,"path":24,"stem":25},{"title":29,"path":30,"stem":31,"children":32},"Curation","\u002Fpacks\u002Fcuration","2.packs\u002Fcuration\u002Findex",[33],{"title":29,"path":30,"stem":31},{"title":35,"path":36,"stem":37,"children":38},"Personas","\u002Fpacks\u002Fpersonas","2.packs\u002Fpersonas\u002Findex",[39],{"title":35,"path":36,"stem":37},{"title":41,"path":42,"stem":43},"Pack Prompt","\u002Fpacks\u002Fprompt","2.packs\u002Fprompt",{"title":45,"path":46,"stem":47,"children":48},"Skills","\u002Fpacks\u002Fskills","2.packs\u002Fskills\u002Findex",[49],{"title":45,"path":46,"stem":47},{"title":51,"path":52,"stem":53,"children":54},"Knowledge Graph & Memory","\u002Fmemory","3.memory\u002Findex",[55],{"title":51,"path":52,"stem":53},{"title":57,"path":58,"stem":59,"children":60},"Configuration","\u002Fconfiguration","4.configuration\u002Findex",[61],{"title":57,"path":58,"stem":59},{"title":63,"path":64,"stem":65,"children":66},"Architecture","\u002Farchitecture","5.architecture\u002Findex",[67],{"title":63,"path":64,"stem":65},{"title":69,"path":70,"stem":71,"children":72},"Commands","\u002Fcommands","6.commands\u002Findex",[73],{"title":69,"path":70,"stem":71},{"title":75,"path":76,"stem":77,"children":78},"Security","\u002Fsecurity","7.security\u002Findex",[79],{"title":75,"path":76,"stem":77},{"id":81,"title":63,"body":82,"description":704,"extension":705,"links":706,"meta":707,"navigation":709,"path":64,"seo":710,"stem":65,"__hash__":711},"docs\u002F5.architecture\u002Findex.md",{"type":83,"value":84,"toc":689},"minimark",[85,90,94,98,235,238,251,254,258,265,292,295,321,325,328,398,402,405,448,451,455,458,517,521,524,552,555,587,591,598,614,617,621,624,650,653,657],[86,87,89],"h2",{"id":88},"overview","Overview",[91,92,93],"p",{},"Working Mind is a local-first terminal AI agent built on a single-agent loop with tool calling. The core is pack-agnostic -- it knows nothing about any domain. Packs define the domain through prompts, tools, skills, and personas.",[86,95,97],{"id":96},"tech-stack","Tech Stack",[99,100,101,117],"table",{},[102,103,104],"thead",{},[105,106,107,111,114],"tr",{},[108,109,110],"th",{},"Layer",[108,112,113],{},"Technology",[108,115,116],{},"Why",[118,119,120,135,160,184,199,222],"tbody",{},[105,121,122,129,132],{},[123,124,125],"td",{},[126,127,128],"strong",{},"Runtime",[123,130,131],{},"Node.js \u002F Bun",[123,133,134],{},"Cross-platform, npm distribution",[105,136,137,142,157],{},[123,138,139],{},[126,140,141],{},"LLM SDK",[123,143,144,151,152,156],{},[145,146,150],"a",{"href":147,"rel":148},"https:\u002F\u002Fgithub.com\u002Fopenai\u002Fopenai-node",[149],"nofollow","OpenAI SDK"," (",[153,154,155],"code",{},"openai",")",[123,158,159],{},"Unified API for all OpenAI-compatible providers. Anthropic, Google, and Ollama use their own adapters but the OpenAI SDK handles the majority of endpoints including OpenRouter and any OpenAI-compatible server.",[105,161,162,167,181],{},[123,163,164],{},[126,165,166],{},"TUI",[123,168,169,151,174,177,178,156],{},[145,170,173],{"href":171,"rel":172},"https:\u002F\u002Fgithub.com\u002Fopentui\u002Fopentui",[149],"OpenTUI",[153,175,176],{},"@opentui\u002Fcore"," + ",[153,179,180],{},"@opentui\u002Freact",[123,182,183],{},"React-based terminal UI framework. Renders the chat interface, tool call panels, sidebar, and input bar. Built on React 19 with Ink-compatible rendering.",[105,185,186,191,196],{},[123,187,188],{},[126,189,190],{},"MCP",[123,192,193],{},[153,194,195],{},"@modelcontextprotocol\u002Fsdk",[123,197,198],{},"Official MCP SDK for stdio transport. Handles tool discovery, server lifecycle, and message routing.",[105,200,201,206,219],{},[123,202,203],{},[126,204,205],{},"Memory",[123,207,208,209,212,213,212,216,156],{},"Native SQLite (",[153,210,211],{},"bun:sqlite"," \u002F ",[153,214,215],{},"better-sqlite3",[153,217,218],{},"sql.js",[123,220,221],{},"Built-in knowledge graph. No MCP server dependency. Stores entities, relations, observations with FTS5 search, temporal validity, and contradiction detection.",[105,223,224,229,232],{},[123,225,226],{},[126,227,228],{},"Language",[123,230,231],{},"TypeScript",[123,233,234],{},"Type-safe agent logic, strict null checks, esbuild for fast bundling.",[91,236,237],{},"The OpenAI SDK is the backbone of the provider layer. Working Mind uses it for:",[239,240,241,245,248],"ul",{},[242,243,244],"li",{},"Streaming chat completions with tool calling",[242,246,247],{},"Structured function call formatting",[242,249,250],{},"OpenRouter and any OpenAI-compatible endpoint (Ollama's OpenAI-compat API, vLLM, LM Studio)",[91,252,253],{},"Anthropic and Google have their own API formats, so Working Mind uses dedicated adapters for those providers while the OpenAI SDK covers everything else.",[86,255,257],{"id":256},"agent-loop","Agent Loop",[91,259,260,261,264],{},"The main loop runs in ",[153,262,263],{},"runAgent()",":",[266,267,268,274,280,286],"ol",{},[242,269,270,273],{},[126,271,272],{},"Stream"," -- Send the conversation (system prompt + history) to the LLM. Stream the response.",[242,275,276,279],{},[126,277,278],{},"Check for tool calls"," -- If the LLM responds with tool calls, execute them. If not, return the response to the user.",[242,281,282,285],{},[126,283,284],{},"Execute tools"," -- For each tool call: parse arguments, get user approval, execute, push result to conversation.",[242,287,288,291],{},[126,289,290],{},"Repeat"," -- Continue the loop until the LLM responds without tool calls or the turn budget is exhausted.",[91,293,294],{},"The loop has guardrails:",[239,296,297,303,309,315],{},[242,298,299,302],{},[126,300,301],{},"Turn budget"," -- Maximum iterations (default: 20, configurable)",[242,304,305,308],{},[126,306,307],{},"Context compaction"," -- When conversation exceeds 100K characters, older messages are compacted into a synthetic summary",[242,310,311,314],{},[126,312,313],{},"Orphan cleanup"," -- Tool result messages without matching tool calls are removed before each turn",[242,316,317,320],{},[126,318,319],{},"Cancellation"," -- Ctrl+C aborts the current LLM request",[86,322,324],{"id":323},"system-prompt-assembly","System Prompt Assembly",[91,326,327],{},"The system prompt is assembled from multiple sources:",[266,329,330,344,357,363,369,374,380],{},[242,331,332,335,336,339,340,343],{},[126,333,334],{},"Pack prompt"," -- From the pack's ",[153,337,338],{},"prompt.md"," (or ",[153,341,342],{},"config.systemPrompts.default"," if no pack)",[242,345,346,349,350,353,354,156],{},[126,347,348],{},"Current task"," -- Directive from slash commands (e.g., ",[153,351,352],{},"\u002Fingest"," sets ",[153,355,356],{},"currentTask",[242,358,359,362],{},[126,360,361],{},"Available skills"," -- List of inactive skills the user can activate",[242,364,365,368],{},[126,366,367],{},"Active skills"," -- Instructions from currently active skills",[242,370,371,373],{},[126,372,301],{}," -- Information about the available tool-call turns",[242,375,376,379],{},[126,377,378],{},"Knowledge index"," -- Truncated list of entities in the knowledge graph",[242,381,382,385,386,389,390,393,394,397],{},[126,383,384],{},"Project rules"," -- From ",[153,387,388],{},"AGENTS.md",", ",[153,391,392],{},"LAB.md",", or ",[153,395,396],{},"WBRAIN.md"," in the current directory",[86,399,401],{"id":400},"mcp-integration","MCP Integration",[91,403,404],{},"MCP servers provide tools. The flow:",[266,406,407,417,423,432,442],{},[242,408,409,412,413,416],{},[126,410,411],{},"Pack declares servers"," -- ",[153,414,415],{},"pack.json"," lists required and optional servers",[242,418,419,422],{},[126,420,421],{},"Registry connects"," -- On startup, Working Mind connects to each MCP server via stdio transport",[242,424,425,428,429,156],{},[126,426,427],{},"Tools discovered"," -- Each server exposes tools (e.g., ",[153,430,431],{},"mcp__brave-search__web_search",[242,433,434,437,438,441],{},[126,435,436],{},"Tool filtering"," -- Packs can filter which tools are available (via ",[153,439,440],{},"toolFilter"," in personas)",[242,443,444,447],{},[126,445,446],{},"Execution"," -- When the LLM calls a tool, Working Mind routes it to the correct MCP server",[91,449,450],{},"All MCP servers run as local child processes. No remote connections. Stdio transport sidesteps the security vulnerabilities of remote MCP servers.",[86,452,454],{"id":453},"pack-loading","Pack Loading",[91,456,457],{},"Packs are loaded at startup:",[266,459,460,472,485,493,499,505,511],{},[242,461,462,385,465,468,469,156],{},[126,463,464],{},"Resolve pack names",[153,466,467],{},"--pack"," flags (default: ",[153,470,471],{},"starter",[242,473,474,477,478,481,482],{},[126,475,476],{},"Find pack directory"," -- Check builtin ",[153,479,480],{},"packs\u002F"," directory, then ",[153,483,484],{},"~\u002F.wmind\u002Fpacks\u002F",[242,486,487,492],{},[126,488,489,490],{},"Read ",[153,491,415],{}," -- Parse manifest, validate schema",[242,494,495,498],{},[126,496,497],{},"Read prompt.md"," -- Load the system prompt",[242,500,501,504],{},[126,502,503],{},"Read personas, skills, commands"," -- Load from subdirectories",[242,506,507,510],{},[126,508,509],{},"Register MCP servers"," -- Declare servers in the MCP registry",[242,512,513,516],{},[126,514,515],{},"Create agent"," -- Assemble system prompt, merge tools, store on agent instance",[86,518,520],{"id":519},"tool-resolution","Tool Resolution",[91,522,523],{},"When the agent is created, tools come from three sources:",[266,525,526,536,546],{},[242,527,528,531,532,535],{},[126,529,530],{},"Pack tools"," -- Defined in the pack's ",[153,533,534],{},"tools"," array (usually empty for declarative packs)",[242,537,538,541,542,545],{},[126,539,540],{},"Native tools"," -- Built-in tools like ",[153,543,544],{},"memory_*"," (12 knowledge graph tools)",[242,547,548,551],{},[126,549,550],{},"MCP tools"," -- Discovered from connected MCP servers",[91,553,554],{},"Persona tool filters can restrict which tools are available:",[239,556,557,563,569,575,581],{},[242,558,559,562],{},[153,560,561],{},"preset: \"all\""," -- all tools available",[242,564,565,568],{},[153,566,567],{},"preset: \"readonly\""," -- only read tools",[242,570,571,574],{},[153,572,573],{},"preset: \"none\""," -- no tools",[242,576,577,580],{},[153,578,579],{},"include: [...]"," -- only these tools",[242,582,583,586],{},[153,584,585],{},"exclude: [...]"," -- all tools except these",[86,588,590],{"id":589},"session-persistence","Session Persistence",[91,592,593,594,597],{},"Sessions are saved to ",[153,595,596],{},"~\u002F.wmind\u002Fsessions\u002F"," as JSON files. Each session stores:",[239,599,600,603,606,609,611],{},[242,601,602],{},"Conversation messages",[242,604,605],{},"Agent persona and pack name",[242,607,608],{},"Pack system prompt (for correct reconstruction on resume)",[242,610,367],{},[242,612,613],{},"Creation and update timestamps",[91,615,616],{},"When you resume a session, Working Mind reconstructs the agent with the same pack prompt, tools, and conversation history.",[86,618,620],{"id":619},"context-compaction","Context Compaction",[91,622,623],{},"When the conversation exceeds 100K characters, older messages are replaced with a synthetic summary:",[266,625,626,632,638,644],{},[242,627,628,631],{},[126,629,630],{},"Identify old messages"," -- Everything before the most recent tool-call sequence",[242,633,634,637],{},[126,635,636],{},"Preserve tool pairs"," -- Tool calls and their results must stay together",[242,639,640,643],{},[126,641,642],{},"Generate summary"," -- Replace old messages with a note summarizing what happened",[242,645,646,649],{},[126,647,648],{},"Continue"," -- The agent operates on the compacted context",[91,651,652],{},"This prevents context window overflow while maintaining conversation coherence.",[86,654,656],{"id":655},"key-design-decisions","Key Design Decisions",[239,658,659,665,671,677,683],{},[242,660,661,664],{},[126,662,663],{},"Single agent, not multi-agent"," -- One well-configured agent with the right tools matches multi-agent systems at lower token cost",[242,666,667,670],{},[126,668,669],{},"MCP as tool layer"," -- MCP servers are sensors (search, read) and actuators (create, write, scrape)",[242,672,673,676],{},[126,674,675],{},"Local-first"," -- No cloud dependency for the core. API keys go to LLM providers, not to us",[242,678,679,682],{},[126,680,681],{},"Declarative packs"," -- No code required. Anyone can create a pack by editing markdown files",[242,684,685,688],{},[126,686,687],{},"Approval gate"," -- Tool calls require user approval by default. Auto-approve is opt-in",{"title":690,"searchDepth":691,"depth":692,"links":693},"",1,2,[694,695,696,697,698,699,700,701,702,703],{"id":88,"depth":692,"text":89},{"id":96,"depth":692,"text":97},{"id":256,"depth":692,"text":257},{"id":323,"depth":692,"text":324},{"id":400,"depth":692,"text":401},{"id":453,"depth":692,"text":454},{"id":519,"depth":692,"text":520},{"id":589,"depth":692,"text":590},{"id":619,"depth":692,"text":620},{"id":655,"depth":692,"text":656},"How Working Mind works under the hood.","md",null,{"icon":708},"i-lucide-layers",true,{"title":63,"description":704},"Af28yt3sYaSZisuqL1cfk2FxsQRMvHSMqGd-jI3mspQ",[713,715],{"title":57,"path":58,"stem":59,"description":714,"children":-1},"Model providers, MCP servers, and settings.",{"title":69,"path":70,"stem":71,"description":716,"children":-1},"Builtin slash commands and how they work.",1778256993663]