Skip to content

Commit dc61891

Browse files
committed
update agents docs
- Reorganize documentation structure by moving files from `.agents/codebase-summary.md` to `.agents/documentation/codebase-summary.md` and update cross-references in documentation map - Update codebase documentation across all packages to reflect corrected file paths, new packages (agent-smith-plugins, agent-smith-ui, agent-smith-apps, lynx-coder), and updated architecture descriptions - Add documentation for new server routes (apps.ts, tools.ts, settings.ts) and update dependencies and usage information across CLI, Agent, Types, and other package docs
1 parent 2ec8310 commit dc61891

9 files changed

Lines changed: 141 additions & 126 deletions

File tree

.agents/documentation/codebase-summary.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,28 +20,28 @@ Agent Smith is a TypeScript monorepo framework for building local-first AI agent
2020
- `server` uses `core` and `types` to expose agent workflows over HTTP/WebSocket
2121

2222
## Entry Point
23-
- `package.json` (root) — monorepo orchestration script for all packages
2423
- `packages/*/src/index.ts` — public API exports for each package
2524
- `server/src/main.ts` — Koa server bootstrap with route registration
25+
- `packages/cli/bin/cmd/` — CLI entry point for `lm` command
2626

2727
## Key Files
2828
| File | Purpose |
2929
|------|---------|
30-
| `packages/types/src/index.ts` | All shared interfaces: agent, tool, callback, inference, WebSocket protocol |
30+
| `packages/types/src/main.ts` | All shared interfaces: agent, tool, callback, inference, WebSocket protocol |
3131
| `packages/core/src/db/schemas.ts` | SQLite schema definitions (17 tables for features, backends, plugins, etc.) |
3232
| `packages/core/src/conf.ts` | Configuration loading and management from DB |
33-
| `packages/core/src/features/` | Feature discovery: agents, actions, workflows, adaptaters, commands from filesystem |
34-
| `packages/core/src/exec/` | Tool execution engine for actions, agents, workflows, and commands |
33+
| `packages/core/src/features/` | Feature discovery: agents, actions, workflows, adapters, commands from filesystem |
34+
| `packages/core/src/actions/` | Action execution engine for tool calling and plugin invocation |
3535
| `packages/agent/src/agent.ts` | Agent class: recursive tool-calling inference loop with history management |
36-
| `packages/agent/src/lm.ts` | Lm client for OpenAI-compatible HTTP inference with streaming support |
37-
| `packages/smem/src/index.ts` | Semantic memory factory (`useSmem`) using LanceDB vector search |
38-
| `packages/tmem/src/index.ts` | Transient memory factory (`useTmem`) wrapping localForage key-value store |
36+
| `packages/agent/src/main.ts` | Agent runtime exports: Agent, Lm client for OpenAI-compatible HTTP inference |
37+
| `packages/smem/src/useSmem.ts` | Semantic memory factory using LanceDB vector search |
38+
| `packages/tmem/src/tmem.ts` | Transient memory factory wrapping localForage key-value store |
3939
| `packages/cli/bin/cmd/` | Commander.js CLI commands: base, dynamic features, aliases |
4040
| `server/src/routes/` | REST API route handlers — one file per domain (agents, workflows, models, etc.) |
4141
| `server/src/server/` | Koa server setup with WebSocket upgrade and middleware pipeline |
4242

4343
## Architecture
44-
- **Feature-Based Discovery**: Agents, actions, workflows, adaptaters, and commands are defined as YAML/JS files in user directories, discovered from the filesystem, and registered in SQLite for fast lookup.
44+
- **Feature-Based Discovery**: Agents, actions, workflows, adapters, and commands are defined as YAML/JS files in user directories, discovered from the filesystem, and registered in SQLite for fast lookup.
4545
- **Database-Driven Runtime**: Better-sqlite3 stores all configuration (17 tables) including features, backends, plugins, tools, settings, and workspaces — no hardcoded defaults.
4646
- **Tool Abstraction**: Actions, agents, workflows, and commands are unified as `ToolSpec`, callable interchangeably in workflows and agent prompts. Multi-language support (JS ESM, Python, YAML/shell).
4747
- **Reactive State + Callbacks**: Vue's `ref`/`reactive` manages cross-module state; inference events (tokens, thinking, tool calls) flow through callback interfaces for real-time streaming.
@@ -51,6 +51,10 @@ Agent Smith is a TypeScript monorepo framework for building local-first AI agent
5151
- See `@agent-smith/core` — DB-stored agent specs executed by `@agent-smith/agent`
5252
- See `@agent-smith/smem` and `@agent-smith/tmem` — memory backends consumed by the agent loop
5353
- See `server` — exposes agent execution over WebSocket using types from `wscli` and runtime from `core`
54+
- See `agent-smith-plugins` — plugin extensions (git, sqlite, fs, shell, search, video)
55+
- See `agent-smith-ui` — web interface for Agent Smith
56+
- See `agent-smith-apps` — application examples using the framework
57+
- See `lynx-coder` — code generation tool built on Agent Smith
5458

5559
## Documentation
5660

.agents/documentation/documentation-map.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,33 +83,33 @@
8383

8484
## 🤖 Root Agent Documentation
8585

86-
- [`agent-smith/.agents/codebase-summary.md`](agent-smith/.agents/codebase-summary.md)
87-
- [`agent-smith/.agents/documentation-map.md`](agent-smith/.agents/documentation-map.md)
86+
- [`agent-smith/.agents/documentation/codebase-summary.md`](agent-smith/.agents/documentation/codebase-summary.md)
87+
- [`agent-smith/.agents/documentation/documentation-map.md`](agent-smith/.agents/documentation/documentation-map.md)
8888

8989
## 📦 Package: @agent-smith/core
9090

91-
- [`agent-smith/packages/core/.agents/codebase-summary.md`](agent-smith/packages/core/.agents/codebase-summary.md)
91+
- [`agent-smith/packages/core/.agents/documentation/codebase-summary.md`](agent-smith/packages/core/.agents/documentation/codebase-summary.md)
9292

9393
## 📦 Package: @agent-smith/agent
9494

95-
- [`agent-smith/packages/agent/.agents/codebase-summary.md`](agent-smith/packages/agent/.agents/codebase-summary.md)
95+
- [`agent-smith/packages/agent/.agents/documentation/codebase-summary.md`](agent-smith/packages/agent/.agents/documentation/codebase-summary.md)
9696

9797
## 📦 Package: @agent-smith/cli
9898

99-
- [`agent-smith/packages/cli/.agents/codebase-summary.md`](agent-smith/packages/cli/.agents/codebase-summary.md)
99+
- [`agent-smith/packages/cli/.agents/documentation/codebase-summary.md`](agent-smith/packages/cli/.agents/documentation/codebase-summary.md)
100100

101101
## 📦 Package: @agent-smith/wscli
102102

103-
- [`agent-smith/packages/wscli/.agents/codebase-summary.md`](agent-smith/packages/wscli/.agents/codebase-summary.md)
103+
- [`agent-smith/packages/wscli/.agents/documentation/codebase-summary.md`](agent-smith/packages/wscli/.agents/documentation/codebase-summary.md)
104104

105105
## 📦 Package: @agent-smith/types
106106

107-
- [`agent-smith/packages/types/.agents/codebase-summary.md`](agent-smith/packages/types/.agents/codebase-summary.md)
107+
- [`agent-smith/packages/types/.agents/documentation/codebase-summary.md`](agent-smith/packages/types/.agents/documentation/codebase-summary.md)
108108

109109
## 📦 Package: @agent-smith/smem
110110

111-
- [`agent-smith/packages/smem/.agents/codebase-summary.md`](agent-smith/packages/smem/.agents/codebase-summary.md)
111+
- [`agent-smith/packages/smem/.agents/documentation/codebase-summary.md`](agent-smith/packages/smem/.agents/documentation/codebase-summary.md)
112112

113113
## 📦 Package: @agent-smith/tmem
114114

115-
- [`agent-smith/packages/tmem/.agents/codebase-summary.md`](agent-smith/packages/tmem/.agents/codebase-summary.md)
115+
- [`agent-smith/packages/tmem/.agents/documentation/codebase-summary.md`](agent-smith/packages/tmem/.agents/documentation/codebase-summary.md)

packages/agent/.agents/documentation/codebase-summary.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@
44
Agent runtime providing the `Agent` class (inference loop with recursive tool calling) and `Lm` class (OpenAI-compatible HTTP client for streaming inference). Works in Node.js and browsers.
55

66
## Dependencies
7-
- `@agent-smith/types``AgentParams`, `ToolSpec`, `HistoryTurn`, `InferenceCallbacks`, `LmProvider`.
8-
- External: `restmix` (HTTP client), `eventsource-parser` (SSE parsing).
7+
- `@agent-smith/types``AgentParams`, `ToolSpec`, `HistoryTurn`, `InferenceCallbacks`, `LmProvider`, `AgentSpec`.
8+
- External: `restmix` (HTTP client), `eventsource-parser` (SSE streaming parser), `yaml` (YAML spec parsing), `openai` (type definitions for OpenAI API).
99

1010
## Used By
11-
- `@agent-smith/cli` — for agent execution with streaming callbacks.
12-
- `server` — for agent inference over WebSocket connections.
13-
- `@agent-smith/wscli` — uses `Agent`-compatible callback patterns.
11+
- `@agent-smith/cli` — CLI uses agent runtime for interactive agent sessions with streaming.
12+
- `@agent-smith/core` — wraps Agent class with MCP backend selection and config integration.
1413

1514
## Entry Point
1615
- `src/main.ts` — Exports `Agent` and `Lm` classes.
Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,46 @@
11
# @agent-smith/cli
22

33
## Summary
4-
Terminal REPL for Agent Smith. Provides a command-line interface (Commander.js) to interact with AI agents, execute workflows and actions, manage configuration, and run inference. Supports both interactive chat mode and one-shot command mode.
4+
Commander.js CLI (`lm` binary) providing an interactive REPL and one-shot command mode for executing AI agents, workflows, and actions, managing configuration, and running LLM inference with real-time streaming output.
55

66
## Dependencies
7-
- `@agent-smith/core` — DB operations, config, feature loading, agent/workflow/action execution.
8-
- `@agent-smith/types` — shared interfaces.
9-
- External: `commander` (CLI parsing), `@inquirer/prompts` (interactive prompts), `ansi-colors`, `ora` (spinners), `@vue/reactivity`.
7+
- `@agent-smith/core` — DB operations, config management, feature discovery, agent/workflow/action execution.
8+
- `@agent-smith/types` — shared TypeScript type definitions.
9+
- `@agent-smith/agent` — agent inference loop class.
10+
- External: `commander` (CLI argument parsing), `@inquirer/prompts` (interactive prompts), `ora` (terminal spinners), `ansi-colors` (styled output), `@vue/reactivity` (reactive refs), `yaml` (config parsing), `marked-terminal` (markdown rendering), `clipboardy` (clipboard I/O).
1011

1112
## Used By
12-
- End users via the `lm` CLI binary.
13-
- Not imported by other packages (terminal client, not a library).
13+
- End users — terminal interaction via `lm` binary.
14+
- Plugins — feature registration (agents, workflows, actions) discovered at runtime.
1415

1516
## Entry Point
16-
- `bin/index.ts` — CLI entry: parses args, initializes state, builds commands via `buildCmds()`, routes to REPL or command mode.
17+
- `bin/index.ts` — CLI entry: parses CLI args, initializes state/DB, builds commands via `buildCmds()`, routes to REPL (`query`) or one-shot command mode (`parseCmd`).
1718

1819
## Key Files
1920
| File | Purpose |
2021
|------|---------|
21-
| `bin/cli.ts` | Interactive REPL query loop: prompts user, parses input as Commander args, executes commands |
22-
| `bin/state.ts` | Reactive state (Vue `ref`): `runMode` (cmd/cli), `isChatMode`, chat inference params |
23-
| `bin/options.ts` | CLI option definitions: display (verbose/debug), inference (model, temp, top_k, backend), IO (clipboard/file/md) |
24-
| `bin/utils.ts` | Utilities: `parseCommandArgs`, `confirmToolUsage` (interactive prompt), `printToken` (styled output) |
25-
| `bin/cmd/build.ts` | Command builder: assembles base commands + dynamic aliases + user commands from DB features |
26-
| `bin/cmd/base.ts` | Built-in commands: exit, agents, agent, backend, conf, reset, regendb, update |
27-
| `bin/cmd/aliases.ts` | Dynamic commands from DB alias definitions (agent/workflow types with inference options) |
28-
| `bin/cmd/features.ts` | Feature execution: `executeWorkflowCmd`, `executeAgentCmd`, `executeTaskCmd`, `executeActionCmd` |
22+
| `bin/index.ts` | CLI entry point: arg dispatch, state init, command building, REPL/cmd routing |
23+
| `bin/cli.ts` | Interactive REPL loop: prompts user input, parses as Commander args, recurses for continuous interaction |
24+
| `bin/main.ts` | Library entry: re-exports options and utility functions for programmatic use |
25+
| `bin/state.ts` | Reactive state via Vue `ref`: `runMode` (cmd/cli), `isChatMode`, chat inference params |
26+
| `bin/options.ts` | CLI option definitions: display (verbose/debug), inference (model, temp, backend, mcp), IO (clipboard/file/output format) |
27+
| `bin/utils.ts` | Utilities: `parseCommandArgs`, `confirmToolUsage` (interactive tool approval), `printToken` (styled streaming output) |
28+
| `bin/cmd/build.ts` | Command builder: assembles base commands + DB alias commands + dynamic user command features |
29+
| `bin/cmd/base.ts` | Built-in commands: exit, agents, agent, backend, backends, conf, reset, regendb, update |
30+
| `bin/cmd/aliases.ts` | Dynamic command generation from DB aliases (agent and workflow types with inference options) |
31+
| `bin/cmd/features.ts` | Feature execution: `executeWorkflowCmd`, `executeAgentCmd`, `executeActionCmd` |
2932
| `bin/cmd/callbacks.ts` | Inference event callbacks: token streaming, thinking spinner, tool call lifecycle UI |
33+
| `bin/cmd/cmds.ts` | Command handlers: `initUserCmds` (dynamic feature commands), `processAgentsCmd`, `processAgentCmd`, `resetDbCmd`, `recreateDbCmd` |
3034
| `bin/cmd/read_cmds.ts` | Dynamic ESM module loader for user command files via `pathToFileURL` |
35+
| `bin/user_msgs.ts` | Runtime message helpers: `runtimeError`, `runtimeWarning`, `runtimeDataError`, `runtimeInfo` |
3136

3237
## Architecture
33-
- **Dynamic Command Building**: Commands assembled at runtime — base commands + DB aliases + feature-spec user commands.
34-
- **Reactive State**: Vue `ref` tracks mode (cmd vs REPL), chat state, inference params across modules.
35-
- **Hot-Reloadable Features**: Commands generated on-the-fly from DB; features can be added without restart.
36-
- **Callback-Based UI**: Inference callbacks inject token streaming, thinking spinners, tool call progress into the agent executor.
38+
- **Dynamic Command Assembly**: Commands built at startup from three sources — static base commands, DB alias definitions, and feature-spec user commands (hot-reloadable).
39+
- **Reactive State Management**: Vue `ref` objects track `runMode`, `isChatMode`, and inference params across all modules without a centralized store.
40+
- **Callback-Driven UI**: Inference callbacks (`useInferenceCallbacks`) inject real-time token streaming, thinking-phase spinners, and tool call progress into the agent executor output.
41+
- **Two Execution Modes**: REPL mode (`query` loop for interactive chat) and one-shot command mode (`parseCmd` for scriptable invocations).
3742

3843
## Related
39-
- See `packages/core` — cli's execution layer delegates to core for agent/workflow/action running.
40-
- See `packages/agent` — agent class provides the inference loop that cli wraps with callbacks.
44+
- See `packages/core` — cli delegates agent/workflow/action execution to core's executors.
45+
- See `packages/agent` — cli wraps the `Agent` class with inference callbacks for real-time output.
46+
- See `packages/wscli` — alternative WebSocket-based client for remote agent communication.
Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,32 @@
11
# @agent-smith/smem
22

33
## Summary
4-
Semantic memory API for agents: stores, retrieves, and searches data using vector embeddings. Powered by LanceDB (vector database) and Xenova transformers (`all-MiniLM-L6-v2`, 384-dim vectors).
4+
Semantic memory API for agents: stores, retrieves, and searches data using vector embeddings powered by LanceDB and Xenova transformers.
55

66
## Dependencies
7-
- `@agent-smith/types` — shared types.
8-
- External: `@lancedb/lancebd` (vector DB), `@xenova/transformers` (text embeddings).
7+
- `@lancedb/lancebd` — vector database for persistent storage and vector search
8+
- `@xenova/transformers` — text embedding pipeline (`all-MiniLM-L6-v2`, 384-dim vectors)
9+
- `apache-arrow` — schema definition and data format for LanceDB tables
910

1011
## Used By
11-
- `@agent-smith/core` — for semantic memory integration in agent features.
12-
- Agent plugins that require vector search (e.g., filesystem indexing).
12+
- No direct references found in workspace; designed for consumption by CLI and server packages.
1313

1414
## Entry Point
15-
- `src/main.ts` — Exports `useSmem`, `useSnode`, and type definitions (`SmemNodeFieldSchema`, `Smem`).
15+
- `src/main.ts` — Exports `useSmem`, `useSnode`, `SmemNodeFieldSchema`, `SmemNodeSchema`, `SmemNode`, `Smem`
1616

1717
## Key Files
1818
| File | Purpose |
1919
|------|---------|
20-
| `src/useSmem.ts` | Factory `useSmem()`: creates semantic memory instance; `init()` loads embedding pipeline; `node()` creates tables; `embed()` batch text→vector |
21-
| `src/useSnode.ts` | Node interface: `add()`, `upsert()`, `search()` (cosine similarity), `filter()`; auto-opens tables on first use |
22-
| `src/smeminterfaces.ts` | Types: `SmemNode<T>` (generic CRUD/search), `Smem`, `SearchParams`, `SmemNodeFieldSchema` |
20+
| `src/main.ts` | Barrel export: re-exports useSmem, useSnode, and all type definitions |
21+
| `src/useSmem.ts` | Factory `useSmem()`: initializes LanceDB connection and embedding pipeline; `node()` creates typed tables; `embed()` batch text→vector conversion |
22+
| `src/useSnode.ts` | Node interface: `add()`, `upsert()`, `search()`, `filter()`; auto-opens tables on first use; vector embedding at write time |
23+
| `src/smeminterfaces.ts` | Type definitions: `SmemNode<T>`, `Smem`, `SearchParams`, `SmemNodeFieldSchema` |
2324

2425
## Architecture
25-
- **Factory Pattern**: `useSmem()` returns a configured instance; `node()` creates typed table handles.
26-
- **Generic Types**: `SmemNode<T>` for type-safe data operations.
27-
- **Lazy Initialization**: Tables auto-opened on first operation; nodes cached in a registry.
28-
- **Vector Embeddings**: Text auto-embedded via `all-MiniLM-L6-v2` (384-dim vectors stored as FixedSizeList columns).
29-
- **Schema Management**: Auto Arrow schema generation from type defs; supports string/int/float/boolean + vector column.
26+
- **Factory Pattern**: `useSmem()` returns a configured instance with `node()` factory for typed table handles.
27+
- **Generic Types**: `SmemNode<T>` provides type-safe CRUD and vector search operations.
28+
- **Lazy Initialization**: Tables auto-open on first operation; nodes cached in a registry map.
29+
- **Auto-Embedding**: Text source column auto-embedded via `all-MiniLM-L6-v2` at write time; vectors stored as 384-dim FixedSizeList columns.
3030

3131
## Related
32-
- See `packages/tmem` — complementary transient (key-value) memory; smem handles semantic/vector search.
33-
- See `packages/core` — integrates smem for agent feature storage and retrieval.
32+
- See `packages/tmem` — transient (key-value) memory; complements smem's semantic/vector search with ephemeral storage.

0 commit comments

Comments
 (0)