agent-brain-cli 2.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- agent_brain_cli-2.0.0/PKG-INFO +170 -0
- agent_brain_cli-2.0.0/README.md +144 -0
- agent_brain_cli-2.0.0/agent_brain_cli/__init__.py +3 -0
- agent_brain_cli-2.0.0/agent_brain_cli/cli.py +102 -0
- agent_brain_cli-2.0.0/agent_brain_cli/client/__init__.py +5 -0
- agent_brain_cli-2.0.0/agent_brain_cli/client/api_client.py +334 -0
- agent_brain_cli-2.0.0/agent_brain_cli/commands/__init__.py +21 -0
- agent_brain_cli-2.0.0/agent_brain_cli/commands/index.py +161 -0
- agent_brain_cli-2.0.0/agent_brain_cli/commands/init.py +207 -0
- agent_brain_cli-2.0.0/agent_brain_cli/commands/list_cmd.py +231 -0
- agent_brain_cli-2.0.0/agent_brain_cli/commands/query.py +213 -0
- agent_brain_cli-2.0.0/agent_brain_cli/commands/reset.py +80 -0
- agent_brain_cli-2.0.0/agent_brain_cli/commands/start.py +469 -0
- agent_brain_cli-2.0.0/agent_brain_cli/commands/status.py +128 -0
- agent_brain_cli-2.0.0/agent_brain_cli/commands/stop.py +388 -0
- agent_brain_cli-2.0.0/pyproject.toml +61 -0
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: agent-brain-cli
|
|
3
|
+
Version: 2.0.0
|
|
4
|
+
Summary: Agent Brain CLI - Command-line interface for managing AI agent memory and knowledge retrieval
|
|
5
|
+
License: MIT
|
|
6
|
+
Keywords: agent-brain,rag,cli,ai-memory,llm-memory,semantic-search,ai-agent,claude-code,agent-memory
|
|
7
|
+
Author: Spillwave Solutions
|
|
8
|
+
Requires-Python: >=3.10,<4.0
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: Environment :: Console
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Requires-Dist: click (>=8.1.0,<9.0.0)
|
|
19
|
+
Requires-Dist: httpx (>=0.28.0,<0.29.0)
|
|
20
|
+
Requires-Dist: rich (>=13.9.0,<14.0.0)
|
|
21
|
+
Project-URL: Documentation, https://github.com/SpillwaveSolutions/agent-brain/wiki
|
|
22
|
+
Project-URL: Homepage, https://github.com/SpillwaveSolutions/agent-brain
|
|
23
|
+
Project-URL: Repository, https://github.com/SpillwaveSolutions/agent-brain
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
|
|
26
|
+
# Agent Brain CLI
|
|
27
|
+
|
|
28
|
+
> Command-line interface for managing AI agent memory and knowledge retrieval with the **Agent Brain** RAG server.
|
|
29
|
+
|
|
30
|
+
**Agent Brain** (formerly doc-serve) is an intelligent document indexing and semantic search system designed to give AI agents long-term memory. This CLI provides a convenient way to manage your Agent Brain server and knowledge base.
|
|
31
|
+
|
|
32
|
+
[](https://pypi.org/project/agent-brain-cli/)
|
|
33
|
+
[](https://www.python.org/downloads/)
|
|
34
|
+
[](https://opensource.org/licenses/MIT)
|
|
35
|
+
|
|
36
|
+
## Why Agent Brain?
|
|
37
|
+
|
|
38
|
+
AI agents need persistent memory to be truly useful. Agent Brain provides the retrieval infrastructure that enables context-aware, knowledge-grounded AI interactions.
|
|
39
|
+
|
|
40
|
+
### Search Capabilities
|
|
41
|
+
|
|
42
|
+
| Search Type | Description | Best For |
|
|
43
|
+
|-------------|-------------|----------|
|
|
44
|
+
| **Semantic Search** | Natural language queries using OpenAI embeddings | Conceptual questions, related content |
|
|
45
|
+
| **Keyword Search (BM25)** | Traditional keyword matching with TF-IDF ranking | Exact matches, technical terms |
|
|
46
|
+
| **Hybrid Search** | Combines vector + BM25 approaches | General-purpose queries |
|
|
47
|
+
| **GraphRAG** | Knowledge graph retrieval | Understanding relationships |
|
|
48
|
+
|
|
49
|
+
## Installation
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
pip install agent-brain-cli
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Quick Start
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
agent-brain init # Initialize project
|
|
59
|
+
agent-brain start # Start server
|
|
60
|
+
agent-brain index ./docs # Index documents
|
|
61
|
+
agent-brain query "search term"
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
> **Note**: The legacy command `doc-svr-ctl` is still available but deprecated. Please use `agent-brain` for new installations.
|
|
65
|
+
|
|
66
|
+
## Development Installation
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
cd agent-brain-cli
|
|
70
|
+
poetry install
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Usage
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# Check server status
|
|
77
|
+
agent-brain status
|
|
78
|
+
|
|
79
|
+
# Search documents
|
|
80
|
+
agent-brain query "how to use python"
|
|
81
|
+
|
|
82
|
+
# Index documents from a folder
|
|
83
|
+
agent-brain index ./docs
|
|
84
|
+
|
|
85
|
+
# Reset/clear the index
|
|
86
|
+
agent-brain reset --yes
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Configuration
|
|
90
|
+
|
|
91
|
+
Set the server URL via environment variable:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
export AGENT_BRAIN_URL=http://localhost:8000
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Or use the `--url` flag:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
agent-brain --url http://localhost:8000 status
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
> **Note**: The legacy environment variable `DOC_SERVE_URL` is still supported for backwards compatibility.
|
|
104
|
+
|
|
105
|
+
## Commands
|
|
106
|
+
|
|
107
|
+
### Server Management
|
|
108
|
+
|
|
109
|
+
| Command | Description |
|
|
110
|
+
|---------|-------------|
|
|
111
|
+
| `init` | Initialize project for Agent Brain (creates `.claude/doc-serve/`) |
|
|
112
|
+
| `start` | Start the Agent Brain server for current project |
|
|
113
|
+
| `stop` | Stop the running server |
|
|
114
|
+
| `list` | List all running Agent Brain instances |
|
|
115
|
+
| `status` | Check server health and indexing status |
|
|
116
|
+
|
|
117
|
+
### Data Management
|
|
118
|
+
|
|
119
|
+
| Command | Description |
|
|
120
|
+
|---------|-------------|
|
|
121
|
+
| `query` | Search indexed documents |
|
|
122
|
+
| `index` | Start indexing documents from a folder |
|
|
123
|
+
| `reset` | Clear all indexed documents |
|
|
124
|
+
|
|
125
|
+
## Options
|
|
126
|
+
|
|
127
|
+
All commands support:
|
|
128
|
+
- `--url` - Server URL (or `AGENT_BRAIN_URL` / `DOC_SERVE_URL` env var)
|
|
129
|
+
- `--json` - Output as JSON for scripting
|
|
130
|
+
|
|
131
|
+
## Example Workflow
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
# 1. Initialize a new project
|
|
135
|
+
cd my-project
|
|
136
|
+
agent-brain init
|
|
137
|
+
|
|
138
|
+
# 2. Start the server
|
|
139
|
+
agent-brain start
|
|
140
|
+
|
|
141
|
+
# 3. Index your documentation
|
|
142
|
+
agent-brain index ./docs ./src
|
|
143
|
+
|
|
144
|
+
# 4. Query your knowledge base
|
|
145
|
+
agent-brain query "How does authentication work?"
|
|
146
|
+
|
|
147
|
+
# 5. Stop when done
|
|
148
|
+
agent-brain stop
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## Documentation
|
|
152
|
+
|
|
153
|
+
- [User Guide](https://github.com/SpillwaveSolutions/agent-brain/wiki/User-Guide) - Getting started and usage
|
|
154
|
+
- [Developer Guide](https://github.com/SpillwaveSolutions/agent-brain/wiki/Developer-Guide) - Contributing and development
|
|
155
|
+
- [API Reference](https://github.com/SpillwaveSolutions/agent-brain/wiki/API-Reference) - Full API documentation
|
|
156
|
+
|
|
157
|
+
## Release Information
|
|
158
|
+
|
|
159
|
+
- **Current Version**: See [pyproject.toml](./pyproject.toml)
|
|
160
|
+
- **Release Notes**: [GitHub Releases](https://github.com/SpillwaveSolutions/agent-brain/releases)
|
|
161
|
+
- **Changelog**: [Latest Release](https://github.com/SpillwaveSolutions/agent-brain/releases/latest)
|
|
162
|
+
|
|
163
|
+
## Related Packages
|
|
164
|
+
|
|
165
|
+
- [agent-brain-rag](https://pypi.org/project/agent-brain-rag/) - The RAG server that powers Agent Brain
|
|
166
|
+
|
|
167
|
+
## License
|
|
168
|
+
|
|
169
|
+
MIT
|
|
170
|
+
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
# Agent Brain CLI
|
|
2
|
+
|
|
3
|
+
> Command-line interface for managing AI agent memory and knowledge retrieval with the **Agent Brain** RAG server.
|
|
4
|
+
|
|
5
|
+
**Agent Brain** (formerly doc-serve) is an intelligent document indexing and semantic search system designed to give AI agents long-term memory. This CLI provides a convenient way to manage your Agent Brain server and knowledge base.
|
|
6
|
+
|
|
7
|
+
[](https://pypi.org/project/agent-brain-cli/)
|
|
8
|
+
[](https://www.python.org/downloads/)
|
|
9
|
+
[](https://opensource.org/licenses/MIT)
|
|
10
|
+
|
|
11
|
+
## Why Agent Brain?
|
|
12
|
+
|
|
13
|
+
AI agents need persistent memory to be truly useful. Agent Brain provides the retrieval infrastructure that enables context-aware, knowledge-grounded AI interactions.
|
|
14
|
+
|
|
15
|
+
### Search Capabilities
|
|
16
|
+
|
|
17
|
+
| Search Type | Description | Best For |
|
|
18
|
+
|-------------|-------------|----------|
|
|
19
|
+
| **Semantic Search** | Natural language queries using OpenAI embeddings | Conceptual questions, related content |
|
|
20
|
+
| **Keyword Search (BM25)** | Traditional keyword matching with TF-IDF ranking | Exact matches, technical terms |
|
|
21
|
+
| **Hybrid Search** | Combines vector + BM25 approaches | General-purpose queries |
|
|
22
|
+
| **GraphRAG** | Knowledge graph retrieval | Understanding relationships |
|
|
23
|
+
|
|
24
|
+
## Installation
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
pip install agent-brain-cli
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Quick Start
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
agent-brain init # Initialize project
|
|
34
|
+
agent-brain start # Start server
|
|
35
|
+
agent-brain index ./docs # Index documents
|
|
36
|
+
agent-brain query "search term"
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
> **Note**: The legacy command `doc-svr-ctl` is still available but deprecated. Please use `agent-brain` for new installations.
|
|
40
|
+
|
|
41
|
+
## Development Installation
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
cd agent-brain-cli
|
|
45
|
+
poetry install
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Usage
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
# Check server status
|
|
52
|
+
agent-brain status
|
|
53
|
+
|
|
54
|
+
# Search documents
|
|
55
|
+
agent-brain query "how to use python"
|
|
56
|
+
|
|
57
|
+
# Index documents from a folder
|
|
58
|
+
agent-brain index ./docs
|
|
59
|
+
|
|
60
|
+
# Reset/clear the index
|
|
61
|
+
agent-brain reset --yes
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Configuration
|
|
65
|
+
|
|
66
|
+
Set the server URL via environment variable:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
export AGENT_BRAIN_URL=http://localhost:8000
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Or use the `--url` flag:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
agent-brain --url http://localhost:8000 status
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
> **Note**: The legacy environment variable `DOC_SERVE_URL` is still supported for backwards compatibility.
|
|
79
|
+
|
|
80
|
+
## Commands
|
|
81
|
+
|
|
82
|
+
### Server Management
|
|
83
|
+
|
|
84
|
+
| Command | Description |
|
|
85
|
+
|---------|-------------|
|
|
86
|
+
| `init` | Initialize project for Agent Brain (creates `.claude/doc-serve/`) |
|
|
87
|
+
| `start` | Start the Agent Brain server for current project |
|
|
88
|
+
| `stop` | Stop the running server |
|
|
89
|
+
| `list` | List all running Agent Brain instances |
|
|
90
|
+
| `status` | Check server health and indexing status |
|
|
91
|
+
|
|
92
|
+
### Data Management
|
|
93
|
+
|
|
94
|
+
| Command | Description |
|
|
95
|
+
|---------|-------------|
|
|
96
|
+
| `query` | Search indexed documents |
|
|
97
|
+
| `index` | Start indexing documents from a folder |
|
|
98
|
+
| `reset` | Clear all indexed documents |
|
|
99
|
+
|
|
100
|
+
## Options
|
|
101
|
+
|
|
102
|
+
All commands support:
|
|
103
|
+
- `--url` - Server URL (or `AGENT_BRAIN_URL` / `DOC_SERVE_URL` env var)
|
|
104
|
+
- `--json` - Output as JSON for scripting
|
|
105
|
+
|
|
106
|
+
## Example Workflow
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
# 1. Initialize a new project
|
|
110
|
+
cd my-project
|
|
111
|
+
agent-brain init
|
|
112
|
+
|
|
113
|
+
# 2. Start the server
|
|
114
|
+
agent-brain start
|
|
115
|
+
|
|
116
|
+
# 3. Index your documentation
|
|
117
|
+
agent-brain index ./docs ./src
|
|
118
|
+
|
|
119
|
+
# 4. Query your knowledge base
|
|
120
|
+
agent-brain query "How does authentication work?"
|
|
121
|
+
|
|
122
|
+
# 5. Stop when done
|
|
123
|
+
agent-brain stop
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Documentation
|
|
127
|
+
|
|
128
|
+
- [User Guide](https://github.com/SpillwaveSolutions/agent-brain/wiki/User-Guide) - Getting started and usage
|
|
129
|
+
- [Developer Guide](https://github.com/SpillwaveSolutions/agent-brain/wiki/Developer-Guide) - Contributing and development
|
|
130
|
+
- [API Reference](https://github.com/SpillwaveSolutions/agent-brain/wiki/API-Reference) - Full API documentation
|
|
131
|
+
|
|
132
|
+
## Release Information
|
|
133
|
+
|
|
134
|
+
- **Current Version**: See [pyproject.toml](./pyproject.toml)
|
|
135
|
+
- **Release Notes**: [GitHub Releases](https://github.com/SpillwaveSolutions/agent-brain/releases)
|
|
136
|
+
- **Changelog**: [Latest Release](https://github.com/SpillwaveSolutions/agent-brain/releases/latest)
|
|
137
|
+
|
|
138
|
+
## Related Packages
|
|
139
|
+
|
|
140
|
+
- [agent-brain-rag](https://pypi.org/project/agent-brain-rag/) - The RAG server that powers Agent Brain
|
|
141
|
+
|
|
142
|
+
## License
|
|
143
|
+
|
|
144
|
+
MIT
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"""Main CLI entry point for agent-brain CLI.
|
|
2
|
+
|
|
3
|
+
This module provides the command-line interface for managing and querying
|
|
4
|
+
the Agent Brain RAG server. The primary entry point is `agent-brain`,
|
|
5
|
+
with `doc-svr-ctl` provided for backward compatibility.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import sys
|
|
9
|
+
import warnings
|
|
10
|
+
|
|
11
|
+
import click
|
|
12
|
+
|
|
13
|
+
from . import __version__
|
|
14
|
+
from .commands import (
|
|
15
|
+
index_command,
|
|
16
|
+
init_command,
|
|
17
|
+
list_command,
|
|
18
|
+
query_command,
|
|
19
|
+
reset_command,
|
|
20
|
+
start_command,
|
|
21
|
+
status_command,
|
|
22
|
+
stop_command,
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@click.group()
|
|
27
|
+
@click.version_option(version=__version__, prog_name="agent-brain")
|
|
28
|
+
def cli() -> None:
|
|
29
|
+
"""Agent Brain CLI - Manage and query the Agent Brain RAG server.
|
|
30
|
+
|
|
31
|
+
A command-line interface for interacting with the Agent Brain document
|
|
32
|
+
indexing and semantic search API.
|
|
33
|
+
|
|
34
|
+
\b
|
|
35
|
+
Project Commands:
|
|
36
|
+
init Initialize a new agent-brain project
|
|
37
|
+
start Start the server for this project
|
|
38
|
+
stop Stop the server for this project
|
|
39
|
+
list List all running agent-brain instances
|
|
40
|
+
|
|
41
|
+
\b
|
|
42
|
+
Server Commands:
|
|
43
|
+
status Check server status
|
|
44
|
+
query Search documents
|
|
45
|
+
index Index documents from a folder
|
|
46
|
+
reset Clear all indexed documents
|
|
47
|
+
|
|
48
|
+
\b
|
|
49
|
+
Examples:
|
|
50
|
+
agent-brain init # Initialize project
|
|
51
|
+
agent-brain start # Start server
|
|
52
|
+
agent-brain status # Check server status
|
|
53
|
+
agent-brain query "how to use python" # Search documents
|
|
54
|
+
agent-brain index ./docs # Index documents
|
|
55
|
+
agent-brain stop # Stop server
|
|
56
|
+
|
|
57
|
+
\b
|
|
58
|
+
Environment Variables:
|
|
59
|
+
DOC_SERVE_URL Server URL (default: http://127.0.0.1:8000)
|
|
60
|
+
"""
|
|
61
|
+
pass
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def cli_deprecated() -> None:
|
|
65
|
+
"""Deprecated entry point for doc-svr-ctl command.
|
|
66
|
+
|
|
67
|
+
Shows a deprecation warning and then runs the main CLI.
|
|
68
|
+
"""
|
|
69
|
+
warnings.warn(
|
|
70
|
+
"\n"
|
|
71
|
+
"WARNING: 'doc-svr-ctl' is deprecated and will be removed in v2.0.\n"
|
|
72
|
+
"Please use 'agent-brain' instead.\n"
|
|
73
|
+
"\n"
|
|
74
|
+
"Migration guide: docs/MIGRATION.md\n"
|
|
75
|
+
"Online: https://github.com/SpillwaveSolutions/agent-brain/blob/main/docs/MIGRATION.md\n",
|
|
76
|
+
DeprecationWarning,
|
|
77
|
+
stacklevel=1,
|
|
78
|
+
)
|
|
79
|
+
# Print to stderr for visibility since warnings may be filtered
|
|
80
|
+
print(
|
|
81
|
+
"\033[93mWARNING: 'doc-svr-ctl' is deprecated. "
|
|
82
|
+
"Use 'agent-brain' instead. See docs/MIGRATION.md\033[0m",
|
|
83
|
+
file=sys.stderr,
|
|
84
|
+
)
|
|
85
|
+
cli()
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
# Register project management commands
|
|
89
|
+
cli.add_command(init_command, name="init")
|
|
90
|
+
cli.add_command(start_command, name="start")
|
|
91
|
+
cli.add_command(stop_command, name="stop")
|
|
92
|
+
cli.add_command(list_command, name="list")
|
|
93
|
+
|
|
94
|
+
# Register server interaction commands
|
|
95
|
+
cli.add_command(status_command, name="status")
|
|
96
|
+
cli.add_command(query_command, name="query")
|
|
97
|
+
cli.add_command(index_command, name="index")
|
|
98
|
+
cli.add_command(reset_command, name="reset")
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
if __name__ == "__main__":
|
|
102
|
+
cli()
|