Date: February 15, 2026
Comparison Scope: Agentic AI chat pipelines, LLM engines, tool systems, and context management
Both applications share a common architectural foundation (agentic loop, tool system, conversation summarization) but differ significantly in:
- Deployment model: Desktop Electron app (IDE) vs Web-based Express server (Pocket Guide)
- LLM backend: Local models via
node-llama-cpp(IDE) vs Cloud API services (Pocket Guide) - Context management: Similar summarization strategies, but Pocket Guide has more aggressive pruning
- Tool execution: Nearly identical tool sets, but Pocket Guide has additional anti-hallucination guards
- Task classification: IDE has sophisticated task type detection; Pocket Guide uses simpler routing
- Type: Electron desktop application
- Entry Point:
electron-main.js→ IPC handlers →agenticChat.js - LLM Engine:
llmEngine.js(local models vianode-llama-cpp) - Cloud Fallback:
cloudLLMService.js(optional, for cloud models) - Tool System:
mcpToolServer.js(MCP protocol-based) - Context Management:
conversationSummarizer.js
- Type: Express.js web server (port 3300)
- Entry Point:
server.js→ WebSocket/HTTP →agent.js - LLM Engine:
llm.js(CloudLLMService - Cerebras primary, fallbacks) - Tool System:
tools.js(ported from guIDE's mcpToolServer) - Context Management:
conversationSummarizer.js(adapted from guIDE)
- Primary: Local models via
node-llama-cpp - Model Loading:
- Uses
getNodeLlamaCppPath()to resolve ESM entry (dist/index.js) asfile://URL on Windows modelPathpassed as raw filesystem path (notfile://) toloadModel()
- Uses
- Context Management:
- Adaptive context sizing based on system RAM
- KV cache reuse via
lastEvaluation(preserves tokenized system prompts) - System prompt optimization: avoids double-prompting when
systemContextprovided
- Features:
- GPU layer offloading (auto-detects VRAM)
- Flash attention support
- Streaming generation with token batching
- Abort/cancel support
- Primary: Cerebras API (up to 30 keys, round-robin)
- Fallback Chain: Groq → SambaNova → OpenRouter → Gemini → Pollinations (free)
- Key Management:
- Unified multi-provider key pool (all providers in one rotation)
- Smart rotation for rate-limited models (GLM 4.7: 100 RPD/key) - picks key with most remaining quota
- Per-key daily usage tracking (survives restarts via JSON file)
- TPM (tokens per minute) tracking per provider
- Auto-cooldown on 429/rate limit errors
- Model Routing:
- Auto-routes to optimal model per iteration (GLM for planning, Llama for execution)
- Model-specific context limits (Qwen 3 32B = 32K, GLM 4.7 = 131K)
- Features:
- Native function calling support (Groq, SambaNova, OpenRouter, Gemini)
- Refusal detection (short responses with refusal keywords → try next key)
- Request queue with throttling (400ms between requests)
Key Difference: IDE prioritizes local inference (privacy, offline), Pocket Guide prioritizes cloud speed/scale.
- Max Iterations: Configurable (default 100, can be overridden per request)
- Task Type Detection: Sophisticated regex-based classifier
- Categories:
'chat','browser','code','general' - Critical Fix: Previously too aggressive - classified actionable requests as 'chat'
- Current Logic: Explicitly checks absence of
browserWordsandcodeWordsbefore 'chat' - All task types now allow full iterations (removed
taskType === 'chat' ? 1 : MAX_ITERATIONS)
- Categories:
- Tool Injection:
- Task-specific tool filtering via
mcpToolServer.getToolPromptForTask(taskType) 'chat'= no tools,'browser'= browser tools only,'code'= file/terminal tools,'general'= all tools
- Task-specific tool filtering via
- Cloud vs Local Paths:
- Separate execution paths for cloud (
cloudLLM.generateStream) and local (llmEngine.generateStream) - Critical Bug Fixed:
iterationToolResultswas undefined in local path (usedtoolResults.resultsinstead)
- Separate execution paths for cloud (
- System Prompt Construction:
DEFAULT_SYSTEM_PREAMBLE+ tool definitions + memory/RAG/file context- Critical Fix: Removed double-prompting (was prepending
_getActiveSystemPrompt()tosystemContext)
- Max Iterations:
MAX_ITERATIONS = 999999(effectively unlimited) - Task Type Detection: Simpler - no explicit task type classification
- Always injects full tool set (no filtering)
- Relies on model to choose appropriate tools
- System Prompt:
SYSTEM_PROMPT(compressed, ~55% fewer tokens than prior 21K-char version)- Includes tool definitions, workflow rules, data integrity rules
- User rules (persistent behavioral memory) appended if present
- Anti-Hallucination Guards:
- Execution state tracking (
_executionState) - ground truth of what actually happened - Model claim verification (
_verifyModelClaims) - checks if model claims visits/actions without tool calls - Fabrication detection for
write_file- warns if large file written without prior browser data extraction - Vague comment detection - flags summaries like "people are discussing" without actual quotes
- Execution state tracking (
- Domain Retry Limiter:
- Tracks attempts per domain (
_domainAttempts) - After
MAX_DOMAIN_ATTEMPTS(4), forces stop and suggests alternative approach - Blocks CAPTCHA/bot-detected domains permanently
- Tracks attempts per domain (
- Progressive Context Pruning:
- At 55% context capacity, compresses old tool results (keeps 250-400 chars)
- Compresses old assistant messages (keeps 300 chars)
- More aggressive than IDE's approach
Key Difference: Pocket Guide has more aggressive anti-hallucination guards and unlimited iterations, IDE has task-specific tool filtering.
- Tool Categories:
- Browser tools (Playwright-based)
- File operations (read/write/edit/delete)
- Terminal/command execution
- Web search (DuckDuckGo)
- Git operations
- RAG/memory tools
- Custom tool creation
- Tool Prompt Building:
_buildToolPrompt()- includes categorization, parameter descriptions, common patterns- Recent Addition: Few-shot example (
web_search) for small models - Task-specific filtering via
getToolPromptForTask(taskType)
- Parameter Normalization:
- Extensive schema drift handling (
_normalizeBrowserParams,_normalizeFsParams) - Handles
selector→ref,path→filePath, etc.
- Extensive schema drift handling (
- Security:
- Path sanitization (
_sanitizeFilePath) - blocks traversal, hallucinated absolute paths - Shell arg sanitization (
_sanitizeShellArg) - Permission gates for destructive operations
- Path sanitization (
- Tool Set: Nearly identical to guIDE (ported from
mcpToolServer.js) - Tool Parsing:
- Same
parseToolCalls()logic (fenced blocks, inline JSON, brace-counting) - JSON sanitization for control characters
- Tool name aliases (same
ALIASESmap)
- Same
- Additional Features:
- Scratchpad files (
.pocket-scratch/) for context overflow - Auto-captured page data (
_lastPageData,_pageDataHistory) for verification - Blocked domains tracking (
_blockedDomains) - skips browser tools on CAPTCHA sites
- Scratchpad files (
- Browser Tool Capping:
- Caps browser tools at 2 per iteration (forces sequential: navigate→snapshot→type)
- Prevents stale-ref cascading failures
Key Difference: Pocket Guide has more aggressive browser tool capping and page data verification.
- Structure:
originalGoal- user's original message (verbatim, capped 2000 chars)completedSteps- tool calls with compressed params/outcomescurrentState- page, file, directory, lastActionkeyFindings- important discoveriesimportantContext- user corrections, constraintstaskPlan- planned steps (if model outlined them)pendingSteps- steps still to do
- Summary Generation:
- Structured sections: TASK GOAL, USER INSTRUCTIONS, COMPLETED WORK, CURRENT STATE, KEY FINDINGS, REMAINING STEPS
- Compression: groups repeated tool calls (e.g., "browser_click (×5)")
- Bounded: keeps last 40 detailed entries, compresses older ones
- Rotation Trigger: Based on
historyLengthvseffectiveMaxChars(model-specific)
- Structure: Nearly identical to guIDE (adapted from it)
- Differences:
- Slightly simpler (no
taskPlan/pendingStepstracking) - Same compression strategy (groups repeated tools)
- Same bounded approach (40 entries max)
- Slightly simpler (no
- Integration:
- Used in agentic loop for context rotation
- Progressive pruning at 55% capacity (before hard rotation)
Key Difference: Essentially the same - Pocket Guide is a direct port with minor simplifications.
- Base:
DEFAULT_SYSTEM_PREAMBLE(identity, capabilities, workflow) - Dynamic Additions:
- Tool definitions (task-filtered)
- Memory/RAG context
- File context (open files, project structure)
- User instructions/corrections
- Construction: Built in
agenticChat.js, passed assystemContexttollmEngine.generateStream() - Critical Fix: Removed double-prompting (was prepending
_getActiveSystemPrompt()tosystemContext)
- Base:
SYSTEM_PROMPT(compressed, ~55% fewer tokens than prior version) - Content:
- Workflow rules (plan, execute, verify, fix, never stop early)
- Data integrity rules (REAL DATA ONLY, ZERO FABRICATION, SCRATCHPAD = TRUTH)
- Tool format examples
- File rules, browser rules, research efficiency tips
- Output rules, error recovery
- Dynamic Additions:
- User rules (persistent behavioral memory from file)
- Tool definitions (always full set, no filtering)
- Construction:
_buildSystemPromptWithRules()inagent.js
Key Difference: Pocket Guide has a more compressed, rule-heavy prompt; IDE has a more modular, context-aware prompt.
- Tool Failures: Error messages passed back to model, model decides retry strategy
- Stuck Detection:
- Tool loop detection (same tool+params repeated)
- Cycle detection (2-4 tool sequence repeating)
- Context Overflow: Conversation summarization triggers at model-specific limits
- Abort Support:
agenticCancelledflag,llmEngine.cancelGeneration()
- Tool Failures:
- Error enrichment (
_enrichErrorFeedback) - provides actionable guidance - Circuit breaker (
_shouldSkipTool) - skips tools that failed 5+ times consecutively - Auto-retry for transient browser failures (target closed, frame detached)
- Error enrichment (
- Stuck Detection:
- More lenient thresholds (browser-active sessions: 10 iterations min, 0.97 overlap threshold)
- Tool loop detection (same as IDE)
- Cycle detection (same as IDE)
- Hallucination Detection:
- Execution state verification (
_verifyModelClaims) - Fabrication warnings for large
write_filewithout data extraction - Vague comment detection
- Execution state verification (
- Domain Retry Limiter: Forces stop after 4 attempts per domain
Key Difference: Pocket Guide has more aggressive error recovery and anti-hallucination guards.
- KV Cache Reuse:
lastEvaluationpreserves tokenized system prompts across iterations - System Prompt Caching: Only updates when text actually changes
- Token Batching:
createIpcTokenBatcher()batches tokens for IPC efficiency - Context Rotation: Model-specific limits (e.g., Qwen 3 32B = 32K tokens)
- Progressive Context Pruning: Compresses old messages at 55% capacity (before hard rotation)
- Browser Tool Capping: Limits to 2 per iteration (prevents stale-ref cascades)
- Update Todo Capping: Max 6
update_todocalls per iteration - Model Routing: Uses cheaper models (Llama) for routine execution, expensive (GLM) for planning
- Key Rotation: Smart rotation for rate-limited models (picks key with most remaining quota)
Key Difference: IDE optimizes for KV cache reuse, Pocket Guide optimizes for context efficiency and cost.
| Aspect | guIDE (IDE) | Pocket Guide |
|---|---|---|
| Deployment | Electron desktop app | Express web server |
| LLM Backend | Local (node-llama-cpp) primary, cloud optional |
Cloud (Cerebras) primary, fallbacks |
| Task Classification | Sophisticated (chat/browser/code/general) | None (always full tool set) |
| Tool Filtering | Task-specific (reduces context) | Always full set |
| Max Iterations | Configurable (default 100) | Unlimited (999999) |
| Anti-Hallucination | Basic (tool loop detection) | Advanced (execution state, fabrication detection) |
| Context Pruning | On rotation only | Progressive (55% capacity) |
| Model Routing | N/A (single model per session) | Auto-routes (GLM for planning, Llama for execution) |
| Key Management | N/A | Unified multi-provider pool with smart rotation |
| Browser Tool Capping | None | 2 per iteration (sequential enforcement) |
- ESM Import Path: Fixed
getNodeLlamaCppPath()to returndist/index.jsasfile://URL - Model Path: Fixed
modelPathto be raw filesystem path (notfile://) forloadModel() - Undefined Variable: Fixed
iterationToolResults→toolResults.resultsin local model path - Task Classifier: Fixed overly aggressive 'chat' classification (now checks absence of browser/code words)
- Double System Prompt: Removed redundant
_getActiveSystemPrompt()prepending - Few-shot Example: Added concrete tool call example to tool prompt
- No recent critical fixes documented (appears more stable, likely due to cloud backend reliability)
- Consider adopting Pocket Guide's anti-hallucination guards:
- Execution state tracking
- Model claim verification
- Fabrication detection for
write_file
- Consider progressive context pruning (at 55% capacity) to reduce rotation frequency
- Consider browser tool capping (2 per iteration) to prevent stale-ref cascades
- Consider error enrichment (
_enrichErrorFeedback) for better small-model guidance
- Consider task type classification to reduce context usage (like IDE's approach)
- Consider KV cache reuse if/when local models are added
- Consider system prompt modularity (like IDE's context-aware construction)
Both pipelines are well-architected and share a common foundation. The IDE prioritizes local inference and task-specific optimization, while Pocket Guide prioritizes cloud scale and anti-hallucination robustness. Each has strengths the other could adopt:
- IDE's strengths: Task classification, KV cache reuse, modular system prompts
- Pocket Guide's strengths: Anti-hallucination guards, progressive pruning, smart model routing
The recent fixes to IDE (task classifier, double prompt, undefined variable) address critical issues that were likely impacting small model performance. Pocket Guide's more aggressive guards suggest it's been battle-tested against hallucination issues that IDE may encounter as it scales.
Document Status: Complete
Next Steps: Consider cross-pollinating optimizations between both pipelines