Skip to content

Instantly share code, notes, and snippets.

@vilaca
Created June 9, 2026 14:13
Show Gist options
  • Select an option

  • Save vilaca/a2e9dfc661447b0b088746c4a003b011 to your computer and use it in GitHub Desktop.

Select an option

Save vilaca/a2e9dfc661447b0b088746c4a003b011 to your computer and use it in GitHub Desktop.
factory IO
I/O Operations by Category
Based on my analysis of the codebase, here are all the files that perform I/O (disk, network, or process) operations:
Disk I/O (fs module)
File Reading:
* src/tools/read.ts — reads files with streams and readline
* src/cli/args.ts — reads config files
* src/core/context/project-facts.ts — reads project metadata
* src/core/config/index.ts — loads configuration files
* src/core/hooks/trust.ts — reads trust policy files
* src/core/skills/loader.ts — loads skill files
* src/security/paths.ts — validates paths and reads files
* src/providers/copilot/auth.ts — reads certificates
* src/providers/googleaistudio/auth.ts — reads auth files
* src/utils/build-info.ts — reads build metadata
* src/utils/git.ts — reads git-related files
File Writing:
* src/tools/write.ts — writes files
* src/tools/edit.ts — edits files in place
* src/utils/atomic-write.ts — atomic file writes
* src/ui/tui/slash/stats.ts — writes stats files
* src/ui/tui/agent-loop/useAgentLoopActions.ts — writes state to disk
File Caching:
* src/core/agent/cache/file-cache.ts — caches tool responses
Session Logging:
* src/core/session/session-log/writer.ts — writes session logs
* src/core/session/session-log/reader.ts — reads session logs
* src/core/session/key-stats.ts — reads/writes statistics
Tool Implementations:
* src/tools/glob.ts — glob file operations
* src/tools/grep.ts — file searching
Agent I/O:
* src/core/agent/tool-calls/tool-call-corrector.ts — handles tool corrections
--------------------------------------------------------------------------------------------------------------------------------
-
Network I/O (fetch + HTTP requests)
Web Fetching Tool:
* src/tools/web/fetch.ts — low-level URL fetching with redirect handling
* src/tools/web/index.ts — WebFetch tool implementation
Provider Model Fetching:
* src/providers/openai/catalog.ts — fetches OpenAI model catalog
* src/providers/openai/stream.ts — streaming HTTP requests
* src/providers/openai/responses-stream.ts — handles streaming responses
* src/providers/anthropic.ts — Anthropic API calls
* src/providers/cohere.ts — Cohere API calls
* src/providers/copilot/index.ts — Copilot model fetching
* src/providers/copilot/auth.ts — GitHub auth via HTTP
* src/providers/googleaistudio/index.ts — Google API calls
* src/providers/groq.ts — Groq API calls
* src/providers/llamacpp.ts — llama.cpp local server calls
* src/providers/ollama.ts — Ollama local server calls
* src/providers/opencodezen/google.ts — OpenCodezen API calls
* src/providers/openrouter.ts — OpenRouter API calls
* src/providers/mistral.ts — Mistral API calls
* src/providers/vercel.ts — Vercel API calls
* src/providers/cerebras.ts — Cerebras API calls
* src/providers/nvidia.ts — NVIDIA API calls
* src/providers/workersai.ts — Workers AI API calls
* src/cli/startup/picker-data.ts — fetches provider/model data during startup
--------------------------------------------------------------------------------------------------------------------------------
-
Process/Subprocess I/O (child_process module)
Bash Execution:
* src/tools/bash.ts — spawns shell processes
* src/tools/grep.ts — spawns ripgrep/grep processes
Git Operations:
* src/utils/git.ts — executes git commands
* src/core/hooks/index.ts — spawns user shell hooks
User Interaction:
* src/cli/prompts.ts — interactive readline prompts
Stream/Readline:
* src/tools/read.ts — uses readline for file reading with streams
--------------------------------------------------------------------------------------------------------------------------------
-
Summary by Layer
┌────────────┬────────────────────────────────────────────┬────────────────┬────────────────┐
│ Layer │ Disk I/O │ Network I/O │ Process I/O │
├────────────┼────────────────────────────────────────────┼────────────────┼────────────────┤
│ tools/ │ read, write, edit, glob, grep │ web fetch │ bash, grep │
├────────────┼────────────────────────────────────────────┼────────────────┼────────────────┤
│ core/ │ config, context, cache, session-log, hooks │ — │ hooks (spawns) │
├────────────┼────────────────────────────────────────────┼────────────────┼────────────────┤
│ providers/ │ — │ ~18 providers │ — │
├────────────┼────────────────────────────────────────────┼────────────────┼────────────────┤
│ cli/ │ args │ startup picker │ prompts │
├────────────┼────────────────────────────────────────────┼────────────────┼────────────────┤
│ ui/ │ stats, agent-loop │ — │ — │
├────────────┼────────────────────────────────────────────┼────────────────┼────────────────┤
│ utils/ │ git, atomic-write, build-info │ — │ git │
├────────────┼────────────────────────────────────────────┼────────────────┼────────────────┤
│ security/ │ paths validation │ — │ — │
└────────────┴────────────────────────────────────────────┴────────────────┴────────────────┘
Total files doing I/O: ~60 files
* Disk I/O: ~25 files
* Network I/O: ~20 files
* Process I/O: ~7 files
* Session/Logging: ~3 files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment