Skip to content

Commit a562929

Browse files
Implemented the next parity slice.
New runtime/code: - src/ask_user_runtime.py - src/team_runtime.py New real tools in src/agent_tools.py: - ask_user_question - team_create - team_delete - team_list - team_get - send_message - team_messages - notebook_edit
1 parent a54c90b commit a562929

21 files changed

Lines changed: 1886 additions & 24 deletions

PARITY_CHECKLIST.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -299,10 +299,12 @@ Done:
299299
- [x] `web_search`
300300
- [x] `tool_search`
301301
- [x] `sleep`
302+
- [x] `ask_user_question`
302303
- [x] `account_status`
303304
- [x] `account_list_profiles`
304305
- [x] `account_login`
305306
- [x] `account_logout`
307+
- [x] `notebook_edit`
306308
- [x] `mcp_list_resources`
307309
- [x] `mcp_read_resource`
308310
- [x] `mcp_list_tools`
@@ -328,20 +330,22 @@ Done:
328330
- [x] `task_block`
329331
- [x] `task_cancel`
330332
- [x] `todo_write`
333+
- [x] `team_list`
334+
- [x] `team_get`
335+
- [x] `team_create`
336+
- [x] `team_delete`
337+
- [x] `send_message`
338+
- [x] `team_messages`
331339

332340
Missing:
333341

334342
- [ ] Agent spawning tool parity beyond the current `delegate_agent` runtime tool
335343
- [ ] Skill tool
336-
- [ ] Notebook edit tool
337344
- [ ] Web fetch parity beyond the current local text-fetch implementation
338345
- [ ] Web search parity beyond the current provider-backed implementation
339-
- [ ] Ask-user-question tool
340346
- [ ] LSP tool
341347
- [ ] Tool search parity beyond the current local registry search
342348
- [ ] Config tool
343-
- [ ] Team create/delete tools
344-
- [ ] Send-message tool
345349
- [ ] Terminal capture tool
346350
- [ ] Browser tool
347351
- [ ] Workflow tool
@@ -364,13 +368,15 @@ Done:
364368
- [x] Local dependency-aware task execution flow with next-task selection and blocked/unblocked state
365369
- [x] Local remote profile/runtime flow with persisted connect/disconnect state
366370
- [x] Local background task management for agent worker sessions
371+
- [x] Local ask-user runtime with queued answers, history, and slash/CLI inspection flows
372+
- [x] Local team runtime with persisted teams, messages, and slash/CLI inspection flows
367373

368374
Missing:
369375

370376
- [ ] Real implementation of the larger upstream command tree
371377
- [ ] Task orchestration system beyond the current local dependency-aware task runtime
372378
- [ ] Planner / task execution parity beyond the current local plan persistence, sync, and next-task flow
373-
- [ ] Team / collaboration command flows
379+
- [ ] Team / collaboration command flows beyond the current local team runtime and message recording flows
374380
- [ ] Command-specific session behaviors
375381
- [ ] Full `src/commands/*` parity
376382
- [ ] Full `src/tasks/*` parity
@@ -532,12 +538,8 @@ Mirrored inventory / scaffold areas that still need real implementation work:
532538
- [ ] `src/tools.py`
533539
- [ ] `src/query_engine.py`
534540
- [ ] `src/runtime.py`
535-
- [ ] `src/services/*`
536-
- [ ] `src/plugins/*`
537-
- [ ] `src/remote/*`
538-
- [ ] `src/voice/*`
539-
- [ ] `src/vim/*`
540-
- [ ] Large parts of the rest of the mirrored package tree
541+
- [ ] Remaining mirrored inventory surfaces still represented mainly by snapshot data under `src/reference_data/*`
542+
- [ ] Command/task/plugin/skill/service/editor subsystems that exist upstream but do not yet have real Python modules after the tree cleanup
541543

542544
## 15. High-Priority Next Steps
543545

@@ -546,7 +548,6 @@ Mirrored inventory / scaffold areas that still need real implementation work:
546548
- [ ] Expand MCP parity beyond the current stdio resource/tool transport support
547549
- [ ] Expand hooks and policy parity beyond the current manifest/runtime implementation
548550
- [ ] Build a real interactive REPL / TUI
549-
- [ ] Add tokenizer-accurate context accounting
550551
- [ ] Expand background session parity beyond the current local worker/log/attach model
551552
- [ ] Add real remote session transport and shared remote state beyond the current local remote-profile runtime
552553
- [ ] Port more of the command/task system

README.md

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@
4646
| 🆕 | **MCP Transport** | Real stdio MCP transport for `initialize`, resource listing/reading, and tool listing/calling |
4747
| 🆕 | **Search Runtime** | Provider-backed `web_search` with local manifests, activation state, and `/search` flows |
4848
| 🆕 | **Config & Account Runtime** | Local config/settings mutation plus manifest-backed account profiles and login/logout state |
49+
| 🆕 | **Ask-User Runtime** | Queued or interactive local ask-user flow with history, slash commands, and agent tool support |
50+
| 🆕 | **Team Runtime** | Persisted local teams and message history with team/message tools and slash/CLI inspection |
51+
| 🆕 | **Notebook Edit Tool** | Native `.ipynb` cell editing through the real agent tool registry |
4952
| 🆕 | **Tokenizer-Aware Context** | Cached tokenizer backends with heuristic fallback for `/context`, `/status`, and compaction |
5053
| 🆕 | **Daemon Commands** | Local `daemon start/ps/logs/attach/kill` wrapper over background agent sessions |
5154
| 🆕 | **Background Sessions** | Local `agent-bg`, `agent-ps`, `agent-logs`, `agent-attach`, and `agent-kill` flows |
@@ -86,6 +89,9 @@ Built on the public porting workspace from [instructkr/claw-code](https://github
8689
| 🛰️ **MCP Runtime** | Local MCP manifests plus real stdio MCP transport for resources and tools |
8790
| 🔎 **Search Runtime** | Provider-backed `web_search` plus provider activation and status reporting |
8891
| ⚙️ **Config & Account Runtime** | Local config mutation, settings inspection, account profiles, and login/logout state |
92+
| 🙋 **Ask-User Runtime** | Queued answer or interactive user-question flow with history tracking |
93+
| 👥 **Team Runtime** | Persisted local teams plus message history, handoff notes, and collaboration metadata |
94+
| 📓 **Notebook Editing** | Native Jupyter notebook cell editing through `notebook_edit` |
8995
| 🪝 **Hook & Policy Runtime** | Trust reporting, safe env, managed settings, tool blocking, and budget overrides |
9096
| 🧠 **Context Engine** | Automatic context building with CLAUDE.md discovery, compaction, and snipping |
9197
| 🔢 **Tokenizer-Aware Accounting** | Model-aware token counting with cached tokenizer backends and fallback heuristics |
@@ -137,9 +143,12 @@ Built on the public porting workspace from [instructkr/claw-code](https://github
137143
- [x] Local hook and policy runtime with trust reporting, safe env, tool blocking, and budget overrides
138144
- [x] Local config runtime: config discovery, effective settings, source inspection, and config mutation
139145
- [x] Local account runtime: profile discovery, login/logout state, and account CLI/slash flows
146+
- [x] Local ask-user runtime: queued answers, history, and ask-user CLI/slash flows
147+
- [x] Local team runtime: persisted teams, team messages, and team CLI/slash flows
140148
- [x] Local search runtime with provider discovery, activation, and provider-backed `web_search`
141149
- [x] Local MCP runtime: manifest resources, stdio transport, MCP resources, and MCP tool calls
142150
- [x] Local task and plan runtimes with plan sync and dependency-aware task execution
151+
- [x] Notebook edit tool in the real Python tool registry
143152
- [x] Tokenizer-aware context accounting with cached tokenizer backends and heuristic fallback
144153
- [x] Plugin runtime: manifest discovery, hooks, aliases, virtual tools, tool blocking
145154
- [x] Plugin lifecycle hooks: resume, persist, delegate phases
@@ -175,7 +184,7 @@ claw-code/
175184
├── .gitignore
176185
├── images/
177186
│ └── logo.png
178-
├── src/ # Python implementation (75+ modules)
187+
├── src/ # Python implementation
179188
│ ├── main.py # CLI entry point & argument parsing
180189
│ ├── agent_runtime.py # Core agent loop (LocalCodingAgent)
181190
│ ├── agent_tools.py # Tool definitions & execution engine
@@ -197,21 +206,20 @@ claw-code/
197206
│ ├── remote_runtime.py # Local remote profiles, connect/disconnect state, remote CLI support
198207
│ ├── background_runtime.py # Local background sessions and daemon support
199208
│ ├── account_runtime.py # Local account profiles, login/logout state, account CLI support
209+
│ ├── ask_user_runtime.py # Local ask-user queued answers and interaction history
200210
│ ├── config_runtime.py # Local workspace config/settings discovery and mutation
201211
│ ├── plan_runtime.py # Persistent plan runtime and plan sync
202212
│ ├── task_runtime.py # Persistent task runtime and task execution
203213
│ ├── task.py # Task state model and task dataclasses
214+
│ ├── team_runtime.py # Local teams, messages, and collaboration metadata
204215
│ ├── hook_policy.py # Hook/policy manifests, trust, and safe env handling
205216
│ ├── tokenizer_runtime.py # Tokenizer-aware context accounting backends
206217
│ ├── permissions.py # Tool permission filtering
207218
│ ├── cost_tracker.py # Cost & budget enforcement
208-
│ ├── tools.py # Mirrored tool inventory
209219
│ ├── commands.py # Mirrored command inventory
210-
│ ├── plugins/ # Plugin subsystem
211-
│ ├── hooks/ # Hook system (WIP)
212-
│ ├── remote/ # Remote runtime modes (WIP)
213-
│ ├── voice/ # Voice mode (WIP)
214-
│ └── vim/ # VIM mode (WIP)
220+
│ ├── tools.py # Mirrored tool inventory
221+
│ ├── runtime.py # Mirrored runtime facade
222+
│ └── reference_data/ # Mirrored inventory snapshots
215223
└── tests/ # Unit tests
216224
├── test_agent_runtime.py
217225
├── test_agent_context.py

TESTING_GUIDE.md

Lines changed: 148 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ export OPENAI_API_KEY=anything
7171
export OPENAI_MODEL=ollama/qwen3
7272
```
7373

74+
If your cluster wraps `python3`, use an explicit interpreter path such as `/usr/bin/python3.9 -m ...` for the commands below.
75+
7476
### 1.5 Run the full unit test suite
7577

7678
```bash
@@ -90,6 +92,8 @@ python3 -m unittest tests.test_background_runtime -v
9092
python3 -m unittest tests.test_remote_runtime -v
9193
python3 -m unittest tests.test_config_runtime -v
9294
python3 -m unittest tests.test_account_runtime -v
95+
python3 -m unittest tests.test_ask_user_runtime -v
96+
python3 -m unittest tests.test_team_runtime -v
9397
python3 -m unittest tests.test_tokenizer_runtime -v
9498
python3 -m unittest tests.test_extended_tools -v
9599
python3 -m unittest tests.test_porting_workspace -v
@@ -191,6 +195,7 @@ mkdir -p ./test_cases_budget
191195
mkdir -p ./test_cases_plugins/plugins/demo
192196
mkdir -p ./test_cases_mcp
193197
mkdir -p ./test_cases_tasks
198+
mkdir -p ./test_cases_notebooks
194199
```
195200

196201
### 4.1 Config fixtures
@@ -243,6 +248,67 @@ cat > ./test_cases/.claw-account.json <<'EOF'
243248
EOF
244249
```
245250

251+
### 4.2b Ask-user fixtures
252+
253+
```bash
254+
cat > ./test_cases/.claw-ask-user.json <<'EOF'
255+
{
256+
"answers": [
257+
{
258+
"question": "Approve deploy?",
259+
"answer": "yes"
260+
},
261+
{
262+
"question": "Choose rollout mode",
263+
"answer": "safe"
264+
}
265+
]
266+
}
267+
EOF
268+
```
269+
270+
### 4.2c Team fixtures
271+
272+
```bash
273+
cat > ./test_cases/.claw-teams.json <<'EOF'
274+
{
275+
"teams": [
276+
{
277+
"name": "reviewers",
278+
"description": "Code review group",
279+
"members": ["alice", "bob"]
280+
},
281+
{
282+
"name": "release",
283+
"description": "Release coordination group",
284+
"members": ["ops", "qa"]
285+
}
286+
]
287+
}
288+
EOF
289+
```
290+
291+
### 4.2d Notebook fixture
292+
293+
```bash
294+
cat > ./test_cases_notebooks/demo.ipynb <<'EOF'
295+
{
296+
"cells": [
297+
{
298+
"cell_type": "code",
299+
"metadata": {},
300+
"source": ["print(1)\n"],
301+
"outputs": [],
302+
"execution_count": null
303+
}
304+
],
305+
"metadata": {},
306+
"nbformat": 4,
307+
"nbformat_minor": 5
308+
}
309+
EOF
310+
```
311+
246312
### 4.3 Remote fixtures
247313

248314
```bash
@@ -528,11 +594,13 @@ python3 -m src.main agent "/settings" --cwd ./test_cases
528594
python3 -m src.main agent "/account" --cwd ./test_cases
529595
python3 -m src.main agent "/account profiles" --cwd ./test_cases
530596
python3 -m src.main agent "/account profile local" --cwd ./test_cases
597+
python3 -m src.main agent "/ask" --cwd ./test_cases
598+
python3 -m src.main agent "/ask history" --cwd ./test_cases
531599
python3 -m src.main agent "/login local" --cwd ./test_cases
532600
python3 -m src.main agent "/logout" --cwd ./test_cases
533601
```
534602

535-
### 5.3 Remote, search, task, and plan slash commands
603+
### 5.3 Remote, search, team, task, and plan slash commands
536604

537605
```bash
538606
python3 -m src.main agent "/remote" --cwd ./test_cases
@@ -549,6 +617,10 @@ python3 -m src.main agent "/search providers" --cwd ./test_cases
549617
python3 -m src.main agent "/search provider local-search" --cwd ./test_cases
550618
python3 -m src.main agent "/search use local-search" --cwd ./test_cases
551619
python3 -m src.main agent "/search python argparse tutorial" --cwd ./test_cases
620+
python3 -m src.main agent "/teams" --cwd ./test_cases
621+
python3 -m src.main agent "/team reviewers" --cwd ./test_cases
622+
python3 -m src.main agent "/messages" --cwd ./test_cases
623+
python3 -m src.main agent "/messages reviewers" --cwd ./test_cases
552624
python3 -m src.main agent "/plan" --cwd ./test_cases_tasks
553625
python3 -m src.main agent "/planner" --cwd ./test_cases_tasks
554626
python3 -m src.main agent "/tasks" --cwd ./test_cases_tasks
@@ -1156,6 +1228,31 @@ python3 -m src.main agent \
11561228
--show-transcript
11571229
```
11581230

1231+
## 14A. Ask-user Runtime
1232+
1233+
### 14A.1 CLI status and history
1234+
1235+
```bash
1236+
python3 -m src.main ask-status --cwd ./test_cases
1237+
python3 -m src.main ask-history --cwd ./test_cases
1238+
```
1239+
1240+
### 14A.2 Slash commands
1241+
1242+
```bash
1243+
python3 -m src.main agent "/ask" --cwd ./test_cases
1244+
python3 -m src.main agent "/ask history" --cwd ./test_cases
1245+
```
1246+
1247+
### 14A.3 Real tool loop
1248+
1249+
```bash
1250+
python3 -m src.main agent \
1251+
"Use ask_user_question to answer 'Approve deploy?' and then summarize the decision." \
1252+
--cwd ./test_cases \
1253+
--show-transcript
1254+
```
1255+
11591256
## 15. Search Runtime And Real Web Search
11601257

11611258
### 15.1 Provider status and activation
@@ -1303,6 +1400,56 @@ python3 -m src.main agent-context-raw --cwd ./test_cases_tasks
13031400
python3 -m src.main agent-prompt --cwd ./test_cases_tasks
13041401
```
13051402

1403+
## 18A. Team Runtime
1404+
1405+
### 18A.1 CLI status and inspection
1406+
1407+
```bash
1408+
python3 -m src.main team-status --cwd ./test_cases
1409+
python3 -m src.main team-list --cwd ./test_cases
1410+
python3 -m src.main team-get reviewers --cwd ./test_cases
1411+
python3 -m src.main team-messages --cwd ./test_cases
1412+
```
1413+
1414+
### 18A.2 Create and delete teams
1415+
1416+
```bash
1417+
python3 -m src.main team-create docs --member alice --member bob --cwd ./test_cases
1418+
python3 -m src.main team-list --cwd ./test_cases
1419+
python3 -m src.main team-delete docs --cwd ./test_cases
1420+
```
1421+
1422+
### 18A.3 Slash commands
1423+
1424+
```bash
1425+
python3 -m src.main agent "/teams" --cwd ./test_cases
1426+
python3 -m src.main agent "/team reviewers" --cwd ./test_cases
1427+
python3 -m src.main agent "/messages" --cwd ./test_cases
1428+
python3 -m src.main agent "/messages reviewers" --cwd ./test_cases
1429+
```
1430+
1431+
### 18A.4 Real tool loop
1432+
1433+
```bash
1434+
python3 -m src.main agent \
1435+
"Create a local team called docs with members alice and bob, send a message to that team asking for notebook review, then show the team messages." \
1436+
--cwd ./test_cases \
1437+
--allow-write \
1438+
--show-transcript
1439+
```
1440+
1441+
## 18B. Notebook Edit Tool
1442+
1443+
### 18B.1 Direct notebook edit through the agent loop
1444+
1445+
```bash
1446+
python3 -m src.main agent \
1447+
"Use notebook_edit to update demo.ipynb cell 0 so it prints 2, then read back the notebook file and summarize the change." \
1448+
--cwd ./test_cases_notebooks \
1449+
--allow-write \
1450+
--show-transcript
1451+
```
1452+
13061453
### 18.2 Create and inspect tasks
13071454

13081455
```bash

0 commit comments

Comments
 (0)