README: enhanced with line counts, design decisions, full source file table

This commit is contained in:
Commander 2026-04-07 16:58:45 -04:00
parent 5f6fdde7c8
commit 8eb891bc6e

View File

@ -1,25 +1,29 @@
# Alfred Agent
The autonomous AI agent runtime for Alfred Linux and Alfred IDE.
**Autonomous AI agent runtime — 1,870 lines, 8 source files, 14 tools, multi-provider.**
The standalone agent that powers AI capabilities across Alfred Linux and Alfred IDE. Handles tool-calling loops, multi-provider LLM routing, session persistence, and a 7-section system prompt. Runs as a PM2 service or interactive CLI.
## Architecture
- **Multi-provider support**: Anthropic Claude, OpenAI GPT, Groq (via OpenAI-compatible adapter)
- **14 built-in tools**: File operations, web search, shell execution, code analysis
- **Session persistence**: Full conversation history stored to disk
- **7-section system prompt**: Structured reasoning with identity, capabilities, safety guardrails
- **Multi-provider**: Anthropic Claude, OpenAI GPT, Groq (via OpenAI-compatible adapter)
- **14 built-in tools**: File I/O, web search, shell execution, code analysis, workflow hooks
- **Session persistence**: Full conversation history stored to disk as JSON
- **7-section system prompt**: Identity, capabilities, tool descriptions, safety guardrails, context, reasoning, output formatting
- **Core loop**: Autonomous tool-calling with reasoning → action → observation cycle
## Source Files
## Source Files (1,870 lines total)
| File | Purpose |
|------|---------|
| `src/providers.js` | Multi-LLM provider abstraction (Anthropic, OpenAI, Groq) |
| `src/tools.js` | 14 tool definitions — file I/O, search, shell, analysis |
| `src/prompt.js` | 7-section system prompt builder |
| `src/session.js` | Conversation session manager with disk persistence |
| `src/agent.js` | Core agent loop — tool calling, reasoning, response synthesis |
| `src/cli.js` | Interactive CLI interface |
| `src/index.js` | HTTP server (port 3102) with health check and message endpoints |
| File | Lines | Purpose |
|------|-------|---------|
| `src/tools.js` | 542 | 14 tool definitions — file read/write, search, shell exec, code analysis |
| `src/hooks.js` | 334 | Lifecycle hooks — pre/post tool execution, response filtering |
| `src/cli.js` | 205 | Interactive CLI with streaming output |
| `src/agent.js` | 196 | Core agent loop — tool calling, reasoning, response synthesis |
| `src/prompt.js` | 174 | 7-section system prompt builder |
| `src/index.js` | 156 | HTTP server (port 3102), health check, message endpoints |
| `src/session.js` | 141 | Session manager with disk persistence |
| `src/providers.js` | 122 | LLM provider abstraction (Anthropic, OpenAI, Groq adapters) |
## Running
@ -32,6 +36,13 @@ pm2 start src/index.js --name alfred-agent
# Health: curl http://127.0.0.1:3102/health
```
## Design Decisions
- **No framework**: Pure Node.js, no Express, no LangChain, no abstractions-for-abstractions
- **Provider-agnostic**: Same agent loop works with any OpenAI-compatible API
- **Stateful sessions**: Every conversation persists to `data/sessions/` — no lost context
- **Tool-first**: Agent reasons about WHAT to do, tools handle HOW
## License
AGPL-3.0 — GoSiteMe Inc.