8gent Code
Reference

How Tools Work

8gent uses a toolshed architecture inspired by Stripe's agent design. The agent never carries all tools in its prompt. Instead, it queries the toolshed by capability when needed, keeping the prompt small while allowing the tool catalog to scale.

// Agent queries by capability
toolshed.query(capability: "code.symbol")
// Returns: get_outline, get_symbol, search_symbols

Core Tools

Basic file and command operations available in every session.

ToolDescription
read_fileRead file contents
write_fileWrite file contents (auto-strips absolute paths to relative)
edit_fileEdit file with find/replace
list_filesList directory contents (includes directories)
run_commandRun shell commands (subject to permission system)
search_filesGlob and grep file search

AST Tools

Symbol-level code retrieval for massive token savings. Instead of reading a 2,119-token file, fetch a specific symbol for 61 tokens.

ToolDescription
get_outlineExtract all symbols from a file with signatures
get_symbolRetrieve a single symbol by its AST path
search_symbolsCross-file symbol search by name or pattern

Token Efficiency

AST-first retrieval fetches only the symbols needed rather than reading entire files, significantly reducing token usage per operation.

MCP Tools

Connect to external tools via the Model Context Protocol. Available tools depend on your MCP server configuration.

ToolDescription
mcp_connectConnect to an MCP server
mcp_callCall an MCP tool
mcp_listList available MCP capabilities

LSP Tools

Code intelligence via Language Server Protocol.

ToolDescription
lsp_definitionGo to definition
lsp_referencesFind all references
lsp_hoverGet hover information (types, docs)
lsp_completionGet code completions
lsp_diagnosticsGet diagnostics (errors, warnings)

Web Tools

Search and fetch content from the web.

ToolDescription
web_searchSearch the web
web_fetchFetch URL content
extract_contentExtract readable content from a URL

Media Tools

Read and process non-code files.

ToolDescription
read_imageRead and describe images
read_pdfExtract text from PDF files
search_pdfSearch within PDF documents

Notebook Tools

Work with Jupyter notebooks.

ToolDescription
read_notebookRead a Jupyter notebook (all cells with outputs)
edit_cellEdit a specific notebook cell
run_cellExecute a notebook cell

Background Tools

Manage long-running processes.

ToolDescription
run_backgroundRun a command in the background
check_backgroundCheck the status of a background task
kill_backgroundStop a background task

Long-running commands are automatically promoted to the process sidebar (Ctrl+B) when they exceed a time threshold.

Capability Groups

Tools are organized by capability for discovery:

CapabilityTools
codeAST query, symbol edit, patch
code.symbolget_outline, get_symbol, search_symbols
webweb_search, web_fetch, extract_content
mediaread_image, read_pdf, search_pdf
mcpmcp_connect, mcp_call, mcp_list
lsplsp_definition, lsp_references, lsp_hover, lsp_completion, lsp_diagnostics
executionrun_command, run_background, check_background, kill_background
repolist_files, search_files

Permission Model

Tools declare required permissions. The permission system checks these before execution:

PermissionDescription
read:codeRead source files
write:codeModify source files
read:fsRead filesystem
write:fsWrite filesystem
exec:shellExecute shell commands
net:fetchMake HTTP requests
net:listenOpen ports
mcp:connectConnect to MCP servers
lsp:connectConnect to LSP servers

Evidence Integration

All tools integrate with the evidence collection system. After a file write, command execution, or git commit, the validation system captures pass/fail signals:

const result = await toolshed.execute("write_file", { path, content });
// Evidence collector automatically captures the result
// Pass/fail badge appears in the chat stream