How ilhanakd-max/local_ajan works
LocAi is a terminal coding-agent runtime: a user submits a task through the CLI, the agent prompts a selected model, parses its response for tool requests, executes approved project operations, and feeds results back for further steps or a final answer. The graph also covers documented sessions, model-specific behavior, Brain/Worker orchestration, and provider integrations. Evidence is strongest for the sampled CLI, parser, tool, session, safety, and client code; some links to unsampled runtime modules follow the README’s stated workflow, so uncertain call wiring is omitted.
Main entry points: loop.py Agent loop · cli.py CLI commands · registry.py Tool registry · fs_tools.py File and search tools
Components 27
CLI and interaction
- CLI commands
src/lokal_ajan/cli.py - Terminal UI
src/lokal_ajan/ui/console.py
Agent runtime
- Agent loop
src/lokal_ajan/agent/loop.py - Prompt building
src/lokal_ajan/agent/prompt.py - Conversation history
src/lokal_ajan/agent/history.py - Context management
src/lokal_ajan/agent/context.py - Tool-call parser
src/lokal_ajan/agent/parser.py - Thinking control
src/lokal_ajan/agent/thinking.py - Brain / Worker
src/lokal_ajan/agent
Project tools and safety
- Tool registry
src/lokal_ajan/tools/registry.py - File and search tools
src/lokal_ajan/tools/fs_tools.py - Shell execution
src/lokal_ajan/tools/shell_tool.py - Git inspection
src/lokal_ajan/tools/git_tools.py - Workspace sandbox
src/lokal_ajan/safety/sandbox.py - Action confirmation
src/lokal_ajan/safety/confirm.py
Models and providers
- Model profiles
src/lokal_ajan/llm/model_profiles.py - Ollama client
src/lokal_ajan/llm/ollama_client.py - OpenRouter client
src/lokal_ajan/llm/openrouter_client.py - Groq client
src/lokal_ajan/llm/groq_client.py - NineRouter client
src/lokal_ajan/llm/ninerouter_client.py - NVIDIA client
src/lokal_ajan/llm/nvidia_client.py
Sessions and configuration
- Session persistence
src/lokal_ajan/agent/session.py - Configuration
src/lokal_ajan/config.py
Other components
- Developer
- Project workspace
- Ollama service
- Hosted model APIs
Connections 33
- Developer → CLI commands: submits task
- CLI commands → Terminal UI: renders interaction
- CLI commands → Agent loop: starts agent
- CLI commands → Configuration: loads settings
- CLI commands → Session persistence: manages sessions
- Agent loop → Prompt building: builds prompt
- Agent loop → Conversation history: updates history
- Agent loop → Context management: bounds context
- Agent loop → Model profiles: selects profile
- Agent loop → Ollama client: requests completion
- Agent loop → OpenRouter client: requests completion
- Agent loop → Groq client: requests completion
- Agent loop → NineRouter client: requests completion
- Agent loop → NVIDIA client: requests completion
- Ollama client → Ollama service: streams requests
- OpenRouter client → Hosted model APIs: streams requests
- Groq client → Hosted model APIs: streams requests
- NineRouter client → Hosted model APIs: streams requests
- NVIDIA client → Hosted model APIs: streams requests
- Agent loop → Tool-call parser: parses response
- Tool-call parser → Tool registry: checks tool names
- Agent loop → Tool registry: dispatches tool
- Tool registry → File and search tools: dispatches tool
- Tool registry → Shell execution: dispatches tool
- Tool registry → Git inspection: dispatches tool
- File and search tools → Project workspace: reads and writes
- Shell execution → Project workspace: operates in
- Git inspection → Project workspace: inspects changes
- Shell execution → Action confirmation: requests approval
- File and search tools → Action confirmation: requests approval
- Agent loop → Workspace sandbox: constrains operations
- Agent loop → Brain / Worker: delegates tasks
- Agent loop → Session persistence: saves and loads