jarv 0.1.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.
- jarv-0.1.0/PKG-INFO +186 -0
- jarv-0.1.0/README.md +161 -0
- jarv-0.1.0/jarv/__init__.py +3 -0
- jarv-0.1.0/jarv/agent.py +522 -0
- jarv-0.1.0/jarv/artifacts.py +74 -0
- jarv-0.1.0/jarv/cli.py +156 -0
- jarv-0.1.0/jarv/commands.py +2042 -0
- jarv-0.1.0/jarv/config.py +97 -0
- jarv-0.1.0/jarv/display.py +53 -0
- jarv-0.1.0/jarv/history.py +248 -0
- jarv-0.1.0/jarv/orchestrator.py +376 -0
- jarv-0.1.0/jarv/shell.py +121 -0
- jarv-0.1.0/jarv/usage.py +474 -0
- jarv-0.1.0/jarv.egg-info/PKG-INFO +186 -0
- jarv-0.1.0/jarv.egg-info/SOURCES.txt +19 -0
- jarv-0.1.0/jarv.egg-info/dependency_links.txt +1 -0
- jarv-0.1.0/jarv.egg-info/entry_points.txt +2 -0
- jarv-0.1.0/jarv.egg-info/requires.txt +3 -0
- jarv-0.1.0/jarv.egg-info/top_level.txt +1 -0
- jarv-0.1.0/pyproject.toml +36 -0
- jarv-0.1.0/setup.cfg +4 -0
jarv-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: jarv
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A simple OpenAI-powered CLI agent
|
|
5
|
+
Author: James W Homer
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/JamesWHomer/jarv
|
|
8
|
+
Project-URL: Repository, https://github.com/JamesWHomer/jarv
|
|
9
|
+
Project-URL: Issues, https://github.com/JamesWHomer/jarv/issues
|
|
10
|
+
Keywords: cli,agent,openai,assistant
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: Utilities
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
Requires-Dist: litellm>=1.0
|
|
23
|
+
Requires-Dist: openai>=1.0
|
|
24
|
+
Requires-Dist: rich>=13.0
|
|
25
|
+
|
|
26
|
+
# jarv
|
|
27
|
+
|
|
28
|
+
An OpenAI-powered CLI agent that can run shell commands, fan out work to parallel subagents, and keep track of conversation history across terminal sessions.
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
jarv # start an interactive session
|
|
32
|
+
jarv whats the meaning of life? # one-shot question
|
|
33
|
+
jarv commit all these files # let it run commands to do the job
|
|
34
|
+
jarv refactor the auth module # complex tasks get split across subagents
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Install
|
|
38
|
+
|
|
39
|
+
Requires **Python 3.10+** and an **OpenAI API key**.
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
pip install git+https://github.com/JamesWHomer/jarv.git
|
|
43
|
+
jarv /set api_key YOUR_OPENAI_API_KEY
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Or clone and install locally:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
git clone https://github.com/JamesWHomer/jarv.git
|
|
50
|
+
cd jarv
|
|
51
|
+
pip install -e .
|
|
52
|
+
jarv /set api_key YOUR_OPENAI_API_KEY
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
The API key can also be set via the `OPENAI_API_KEY` environment variable.
|
|
56
|
+
|
|
57
|
+
To upgrade:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
jarv /update
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Usage
|
|
64
|
+
|
|
65
|
+
### One-shot mode
|
|
66
|
+
|
|
67
|
+
Pass a prompt as arguments. Jarv answers (running commands if needed) and exits.
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
jarv what process is using port 8080?
|
|
71
|
+
jarv find all TODO comments in src/
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Heads-up mode
|
|
75
|
+
|
|
76
|
+
Run `jarv` with no arguments to enter an interactive prompt loop.
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
jarv> what files changed today?
|
|
80
|
+
jarv> now run the tests
|
|
81
|
+
jarv> /history
|
|
82
|
+
jarv> /clear
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
- Type a prompt and press Enter.
|
|
86
|
+
- Slash commands start with `/` — type `/help` to list them.
|
|
87
|
+
- Exit with `exit`, `quit`, `/exit`, or Ctrl+C.
|
|
88
|
+
|
|
89
|
+
## How it works
|
|
90
|
+
|
|
91
|
+
Jarv wraps the OpenAI Responses API with a tool-calling agent loop. The model can call three tools:
|
|
92
|
+
|
|
93
|
+
| Tool | Purpose |
|
|
94
|
+
| --- | --- |
|
|
95
|
+
| `run_command` | Execute a shell command and return stdout, stderr, and exit code |
|
|
96
|
+
| `spawn` | Fan out work to parallel subagents, each with their own tool access |
|
|
97
|
+
| `read_artifact` | Retrieve the full output of a completed subagent |
|
|
98
|
+
|
|
99
|
+
On Windows, commands run through PowerShell. On other platforms, they run through the system shell.
|
|
100
|
+
|
|
101
|
+
### Subagent orchestration
|
|
102
|
+
|
|
103
|
+
When the model calls `spawn`, Jarv runs N child agents in parallel. Each child operates independently — running commands, reasoning through subtasks — and terminates by calling `finish` with a detailed report and a short summary. The parent agent can then read any child's full output via `read_artifact`.
|
|
104
|
+
|
|
105
|
+
- **Parallel by default** — all children in a `spawn` call run concurrently in a thread pool.
|
|
106
|
+
- **Artifacts** — each child's output is stored as a named artifact. The parent (or siblings that declare a dependency) can fetch the full content.
|
|
107
|
+
- **Recursive** — children can themselves spawn further children, up to `max_subagent_depth` levels deep (default 4). Children are sterile by default; the parent must explicitly allow further spawning.
|
|
108
|
+
- **Scoped per query** — the artifact store resets with each new top-level prompt.
|
|
109
|
+
|
|
110
|
+
The terminal shows a live progress panel as children run, with a green checkmark or red cross as each finishes.
|
|
111
|
+
|
|
112
|
+
## Commands
|
|
113
|
+
|
|
114
|
+
| Command | Description |
|
|
115
|
+
| --- | --- |
|
|
116
|
+
| `/help` | Show all commands |
|
|
117
|
+
| `/about` | Detailed info and examples |
|
|
118
|
+
| `/set <key> <value>` | Set a config value |
|
|
119
|
+
| `/unset <key>` | Reset a config key to default |
|
|
120
|
+
| `/config` | Show current settings |
|
|
121
|
+
| `/clear` | Archive the current session and start fresh |
|
|
122
|
+
| `/archive` | Archive session history and artifacts |
|
|
123
|
+
| `/sessions` | Browse sessions (interactive when in a TTY) |
|
|
124
|
+
| `/sessions <id>` | Load a specific session by ID prefix |
|
|
125
|
+
| `/load` | Load the most recently used session |
|
|
126
|
+
| `/load <id>` | Load a specific session |
|
|
127
|
+
| `/history` | Show recent conversation history |
|
|
128
|
+
| `/undo [n]` | Remove last *n* exchanges (default 1) |
|
|
129
|
+
| `/redo [n]` | Restore last *n* undone exchanges (default 1) |
|
|
130
|
+
| `/usage` | Show token usage, cost, and context breakdown |
|
|
131
|
+
| `/update` | Update Jarv to the latest version |
|
|
132
|
+
|
|
133
|
+
All commands work both as `jarv /command` (one-shot) and inside heads-up mode.
|
|
134
|
+
|
|
135
|
+
## Sessions
|
|
136
|
+
|
|
137
|
+
Each terminal is automatically bound to its own session. Jarv identifies terminals using environment variables (`WT_SESSION`, `TERM_SESSION_ID`, `TMUX`, `STY`) with a parent-process fallback, so history persists across runs in the same terminal.
|
|
138
|
+
|
|
139
|
+
- `/clear` archives the current session and starts fresh on the next prompt.
|
|
140
|
+
- `/sessions` opens an interactive browser (arrow keys to navigate, Enter to load, `a` to archive, `d` to delete, `p` to preview, `Tab` to switch views, Ctrl+F to search).
|
|
141
|
+
- `/undo` and `/redo` let you step through recent exchanges.
|
|
142
|
+
|
|
143
|
+
## Config
|
|
144
|
+
|
|
145
|
+
Settings live in `~/.jarv/config.json` (created on first run). Edit the file directly or use `/set` and `/unset`.
|
|
146
|
+
|
|
147
|
+
| Key | Default | Description |
|
|
148
|
+
| --- | --- | --- |
|
|
149
|
+
| `api_key` | `""` | OpenAI API key. Falls back to `OPENAI_API_KEY` env var if empty. |
|
|
150
|
+
| `model` | `"gpt-5.4-mini"` | Model name passed to the API. |
|
|
151
|
+
| `reasoning_effort` | `""` | Reasoning effort level. Leave empty to disable. |
|
|
152
|
+
| `max_history` | `40` | Number of recent messages kept as context. |
|
|
153
|
+
| `command_timeout` | `60` | Seconds before a shell command is killed. |
|
|
154
|
+
| `max_subagent_depth` | `4` | Maximum nesting depth for spawned subagents. |
|
|
155
|
+
| `subagent_thread_pool_max_workers` | `8` | Max parallel subagents per `spawn` call. |
|
|
156
|
+
| `check_updates` | `true` | Background update check on startup (non-blocking, throttled to once per 24h). |
|
|
157
|
+
| `system_prompt` | `"You are Jarv..."` | System instructions sent with each request. |
|
|
158
|
+
|
|
159
|
+
## Local files
|
|
160
|
+
|
|
161
|
+
All state is stored in `~/.jarv/` (on Windows, `%USERPROFILE%\.jarv\`):
|
|
162
|
+
|
|
163
|
+
```
|
|
164
|
+
~/.jarv/
|
|
165
|
+
├── config.json # settings and optional API key
|
|
166
|
+
├── sessions.json # terminal → session mappings
|
|
167
|
+
├── last_sha.txt # last seen GitHub SHA for update checks
|
|
168
|
+
├── sessions/
|
|
169
|
+
│ ├── history-<hash>.json # conversation history
|
|
170
|
+
│ ├── artifacts-<hash>.json # subagent artifacts
|
|
171
|
+
│ ├── usage-<hash>.json # token usage totals
|
|
172
|
+
│ └── redo-<hash>.json # undo/redo stack
|
|
173
|
+
└── archive/ # archived sessions
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## Dependencies
|
|
177
|
+
|
|
178
|
+
| Package | Role |
|
|
179
|
+
| --- | --- |
|
|
180
|
+
| [openai](https://pypi.org/project/openai/) | Responses API client |
|
|
181
|
+
| [rich](https://pypi.org/project/rich/) | Terminal styling, live rendering, markdown |
|
|
182
|
+
| [litellm](https://pypi.org/project/litellm/) | Token counting, model pricing, context window metadata |
|
|
183
|
+
|
|
184
|
+
## License
|
|
185
|
+
|
|
186
|
+
MIT
|
jarv-0.1.0/README.md
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
# jarv
|
|
2
|
+
|
|
3
|
+
An OpenAI-powered CLI agent that can run shell commands, fan out work to parallel subagents, and keep track of conversation history across terminal sessions.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
jarv # start an interactive session
|
|
7
|
+
jarv whats the meaning of life? # one-shot question
|
|
8
|
+
jarv commit all these files # let it run commands to do the job
|
|
9
|
+
jarv refactor the auth module # complex tasks get split across subagents
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
Requires **Python 3.10+** and an **OpenAI API key**.
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
pip install git+https://github.com/JamesWHomer/jarv.git
|
|
18
|
+
jarv /set api_key YOUR_OPENAI_API_KEY
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Or clone and install locally:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
git clone https://github.com/JamesWHomer/jarv.git
|
|
25
|
+
cd jarv
|
|
26
|
+
pip install -e .
|
|
27
|
+
jarv /set api_key YOUR_OPENAI_API_KEY
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
The API key can also be set via the `OPENAI_API_KEY` environment variable.
|
|
31
|
+
|
|
32
|
+
To upgrade:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
jarv /update
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Usage
|
|
39
|
+
|
|
40
|
+
### One-shot mode
|
|
41
|
+
|
|
42
|
+
Pass a prompt as arguments. Jarv answers (running commands if needed) and exits.
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
jarv what process is using port 8080?
|
|
46
|
+
jarv find all TODO comments in src/
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Heads-up mode
|
|
50
|
+
|
|
51
|
+
Run `jarv` with no arguments to enter an interactive prompt loop.
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
jarv> what files changed today?
|
|
55
|
+
jarv> now run the tests
|
|
56
|
+
jarv> /history
|
|
57
|
+
jarv> /clear
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
- Type a prompt and press Enter.
|
|
61
|
+
- Slash commands start with `/` — type `/help` to list them.
|
|
62
|
+
- Exit with `exit`, `quit`, `/exit`, or Ctrl+C.
|
|
63
|
+
|
|
64
|
+
## How it works
|
|
65
|
+
|
|
66
|
+
Jarv wraps the OpenAI Responses API with a tool-calling agent loop. The model can call three tools:
|
|
67
|
+
|
|
68
|
+
| Tool | Purpose |
|
|
69
|
+
| --- | --- |
|
|
70
|
+
| `run_command` | Execute a shell command and return stdout, stderr, and exit code |
|
|
71
|
+
| `spawn` | Fan out work to parallel subagents, each with their own tool access |
|
|
72
|
+
| `read_artifact` | Retrieve the full output of a completed subagent |
|
|
73
|
+
|
|
74
|
+
On Windows, commands run through PowerShell. On other platforms, they run through the system shell.
|
|
75
|
+
|
|
76
|
+
### Subagent orchestration
|
|
77
|
+
|
|
78
|
+
When the model calls `spawn`, Jarv runs N child agents in parallel. Each child operates independently — running commands, reasoning through subtasks — and terminates by calling `finish` with a detailed report and a short summary. The parent agent can then read any child's full output via `read_artifact`.
|
|
79
|
+
|
|
80
|
+
- **Parallel by default** — all children in a `spawn` call run concurrently in a thread pool.
|
|
81
|
+
- **Artifacts** — each child's output is stored as a named artifact. The parent (or siblings that declare a dependency) can fetch the full content.
|
|
82
|
+
- **Recursive** — children can themselves spawn further children, up to `max_subagent_depth` levels deep (default 4). Children are sterile by default; the parent must explicitly allow further spawning.
|
|
83
|
+
- **Scoped per query** — the artifact store resets with each new top-level prompt.
|
|
84
|
+
|
|
85
|
+
The terminal shows a live progress panel as children run, with a green checkmark or red cross as each finishes.
|
|
86
|
+
|
|
87
|
+
## Commands
|
|
88
|
+
|
|
89
|
+
| Command | Description |
|
|
90
|
+
| --- | --- |
|
|
91
|
+
| `/help` | Show all commands |
|
|
92
|
+
| `/about` | Detailed info and examples |
|
|
93
|
+
| `/set <key> <value>` | Set a config value |
|
|
94
|
+
| `/unset <key>` | Reset a config key to default |
|
|
95
|
+
| `/config` | Show current settings |
|
|
96
|
+
| `/clear` | Archive the current session and start fresh |
|
|
97
|
+
| `/archive` | Archive session history and artifacts |
|
|
98
|
+
| `/sessions` | Browse sessions (interactive when in a TTY) |
|
|
99
|
+
| `/sessions <id>` | Load a specific session by ID prefix |
|
|
100
|
+
| `/load` | Load the most recently used session |
|
|
101
|
+
| `/load <id>` | Load a specific session |
|
|
102
|
+
| `/history` | Show recent conversation history |
|
|
103
|
+
| `/undo [n]` | Remove last *n* exchanges (default 1) |
|
|
104
|
+
| `/redo [n]` | Restore last *n* undone exchanges (default 1) |
|
|
105
|
+
| `/usage` | Show token usage, cost, and context breakdown |
|
|
106
|
+
| `/update` | Update Jarv to the latest version |
|
|
107
|
+
|
|
108
|
+
All commands work both as `jarv /command` (one-shot) and inside heads-up mode.
|
|
109
|
+
|
|
110
|
+
## Sessions
|
|
111
|
+
|
|
112
|
+
Each terminal is automatically bound to its own session. Jarv identifies terminals using environment variables (`WT_SESSION`, `TERM_SESSION_ID`, `TMUX`, `STY`) with a parent-process fallback, so history persists across runs in the same terminal.
|
|
113
|
+
|
|
114
|
+
- `/clear` archives the current session and starts fresh on the next prompt.
|
|
115
|
+
- `/sessions` opens an interactive browser (arrow keys to navigate, Enter to load, `a` to archive, `d` to delete, `p` to preview, `Tab` to switch views, Ctrl+F to search).
|
|
116
|
+
- `/undo` and `/redo` let you step through recent exchanges.
|
|
117
|
+
|
|
118
|
+
## Config
|
|
119
|
+
|
|
120
|
+
Settings live in `~/.jarv/config.json` (created on first run). Edit the file directly or use `/set` and `/unset`.
|
|
121
|
+
|
|
122
|
+
| Key | Default | Description |
|
|
123
|
+
| --- | --- | --- |
|
|
124
|
+
| `api_key` | `""` | OpenAI API key. Falls back to `OPENAI_API_KEY` env var if empty. |
|
|
125
|
+
| `model` | `"gpt-5.4-mini"` | Model name passed to the API. |
|
|
126
|
+
| `reasoning_effort` | `""` | Reasoning effort level. Leave empty to disable. |
|
|
127
|
+
| `max_history` | `40` | Number of recent messages kept as context. |
|
|
128
|
+
| `command_timeout` | `60` | Seconds before a shell command is killed. |
|
|
129
|
+
| `max_subagent_depth` | `4` | Maximum nesting depth for spawned subagents. |
|
|
130
|
+
| `subagent_thread_pool_max_workers` | `8` | Max parallel subagents per `spawn` call. |
|
|
131
|
+
| `check_updates` | `true` | Background update check on startup (non-blocking, throttled to once per 24h). |
|
|
132
|
+
| `system_prompt` | `"You are Jarv..."` | System instructions sent with each request. |
|
|
133
|
+
|
|
134
|
+
## Local files
|
|
135
|
+
|
|
136
|
+
All state is stored in `~/.jarv/` (on Windows, `%USERPROFILE%\.jarv\`):
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
~/.jarv/
|
|
140
|
+
├── config.json # settings and optional API key
|
|
141
|
+
├── sessions.json # terminal → session mappings
|
|
142
|
+
├── last_sha.txt # last seen GitHub SHA for update checks
|
|
143
|
+
├── sessions/
|
|
144
|
+
│ ├── history-<hash>.json # conversation history
|
|
145
|
+
│ ├── artifacts-<hash>.json # subagent artifacts
|
|
146
|
+
│ ├── usage-<hash>.json # token usage totals
|
|
147
|
+
│ └── redo-<hash>.json # undo/redo stack
|
|
148
|
+
└── archive/ # archived sessions
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## Dependencies
|
|
152
|
+
|
|
153
|
+
| Package | Role |
|
|
154
|
+
| --- | --- |
|
|
155
|
+
| [openai](https://pypi.org/project/openai/) | Responses API client |
|
|
156
|
+
| [rich](https://pypi.org/project/rich/) | Terminal styling, live rendering, markdown |
|
|
157
|
+
| [litellm](https://pypi.org/project/litellm/) | Token counting, model pricing, context window metadata |
|
|
158
|
+
|
|
159
|
+
## License
|
|
160
|
+
|
|
161
|
+
MIT
|