task-agent 0.1.303__tar.gz → 0.1.321__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.
- task_agent-0.1.321/CLAUDE.md +298 -0
- {task_agent-0.1.303 → task_agent-0.1.321}/PKG-INFO +1 -1
- {task_agent-0.1.303 → task_agent-0.1.321}/pyproject.toml +2 -2
- {task_agent-0.1.303 → task_agent-0.1.321}/src/taskagent/cli.py +348 -54
- {task_agent-0.1.303 → task_agent-0.1.321}/src/taskagent/manager.py +129 -2
- {task_agent-0.1.303 → task_agent-0.1.321}/src/taskagent/mcp.py +33 -0
- {task_agent-0.1.303 → task_agent-0.1.321}/tests/test_cli.py +89 -18
- {task_agent-0.1.303 → task_agent-0.1.321}/tests/test_manager.py +31 -0
- {task_agent-0.1.303 → task_agent-0.1.321}/tests/test_mcp.py +41 -0
- {task_agent-0.1.303 → task_agent-0.1.321}/uv.lock +1 -1
- {task_agent-0.1.303 → task_agent-0.1.321}/.env +0 -0
- {task_agent-0.1.303 → task_agent-0.1.321}/.gemini/settings.json +0 -0
- {task_agent-0.1.303 → task_agent-0.1.321}/.github/workflows/ci.yml +0 -0
- {task_agent-0.1.303 → task_agent-0.1.321}/.github/workflows/publish.yml +0 -0
- {task_agent-0.1.303 → task_agent-0.1.321}/.gitignore +0 -0
- {task_agent-0.1.303 → task_agent-0.1.321}/.mise.toml +0 -0
- {task_agent-0.1.303 → task_agent-0.1.321}/.pre-commit-config.yaml +0 -0
- {task_agent-0.1.303 → task_agent-0.1.321}/.python-version +0 -0
- {task_agent-0.1.303 → task_agent-0.1.321}/.ta/agents/gh/meta.toml +0 -0
- {task_agent-0.1.303 → task_agent-0.1.321}/.ta/agents/minimal/meta.toml +0 -0
- {task_agent-0.1.303 → task_agent-0.1.321}/.ta/agents/uat-aws/meta.toml +0 -0
- {task_agent-0.1.303 → task_agent-0.1.321}/.ta/worker +0 -0
- {task_agent-0.1.303 → task_agent-0.1.321}/.task-agent/worktree-config.json +0 -0
- {task_agent-0.1.303 → task_agent-0.1.321}/GEMINI.md +0 -0
- {task_agent-0.1.303 → task_agent-0.1.321}/Makefile +0 -0
- {task_agent-0.1.303 → task_agent-0.1.321}/README.md +0 -0
- {task_agent-0.1.303 → task_agent-0.1.321}/agent.env +0 -0
- {task_agent-0.1.303 → task_agent-0.1.321}/docs/README.md +0 -0
- {task_agent-0.1.303 → task_agent-0.1.321}/docs/architecture/README.md +0 -0
- {task_agent-0.1.303 → task_agent-0.1.321}/docs/chats/gemini-conversation-1773283034591.json +0 -0
- {task_agent-0.1.303 → task_agent-0.1.321}/docs/chats/project-init-to-v0.1.46.md +0 -0
- {task_agent-0.1.303 → task_agent-0.1.321}/docs/cli/README.md +0 -0
- {task_agent-0.1.303 → task_agent-0.1.321}/docs/development/README.md +0 -0
- {task_agent-0.1.303 → task_agent-0.1.321}/docs/task-agents.md +0 -0
- {task_agent-0.1.303 → task_agent-0.1.321}/docs/workflow/README.md +0 -0
- {task_agent-0.1.303 → task_agent-0.1.321}/sidecars/adk-worker/.env.example +0 -0
- {task_agent-0.1.303 → task_agent-0.1.321}/sidecars/adk-worker/README.md +0 -0
- {task_agent-0.1.303 → task_agent-0.1.321}/sidecars/adk-worker/instructions/manager.md +0 -0
- {task_agent-0.1.303 → task_agent-0.1.321}/sidecars/adk-worker/instructions/validator.md +0 -0
- {task_agent-0.1.303 → task_agent-0.1.321}/sidecars/adk-worker/instructions/worker.md +0 -0
- {task_agent-0.1.303 → task_agent-0.1.321}/sidecars/adk-worker/profiles/default.json +0 -0
- {task_agent-0.1.303 → task_agent-0.1.321}/sidecars/adk-worker/pyproject.toml +0 -0
- {task_agent-0.1.303 → task_agent-0.1.321}/sidecars/adk-worker/worker.py +0 -0
- {task_agent-0.1.303 → task_agent-0.1.321}/src/taskagent/__init__.py +0 -0
- {task_agent-0.1.303 → task_agent-0.1.321}/src/taskagent/__main__.py +0 -0
- {task_agent-0.1.303 → task_agent-0.1.321}/src/taskagent/agent.py +0 -0
- {task_agent-0.1.303 → task_agent-0.1.321}/src/taskagent/audit.py +0 -0
- {task_agent-0.1.303 → task_agent-0.1.321}/src/taskagent/config.py +0 -0
- {task_agent-0.1.303 → task_agent-0.1.321}/src/taskagent/discovery.py +0 -0
- {task_agent-0.1.303 → task_agent-0.1.321}/src/taskagent/models/__init__.py +0 -0
- {task_agent-0.1.303 → task_agent-0.1.321}/src/taskagent/models/issue.py +0 -0
- {task_agent-0.1.303 → task_agent-0.1.321}/src/taskagent/models/metric.py +0 -0
- {task_agent-0.1.303 → task_agent-0.1.321}/src/taskagent/plugins/__init__.py +0 -0
- {task_agent-0.1.303 → task_agent-0.1.321}/src/taskagent/plugins/github.py +0 -0
- {task_agent-0.1.303 → task_agent-0.1.321}/src/taskagent/templates.py +0 -0
- {task_agent-0.1.303 → task_agent-0.1.321}/test-dir/opencode.json +0 -0
- {task_agent-0.1.303 → task_agent-0.1.321}/tests/e2e/test_agent_sandboxing.sh +0 -0
- {task_agent-0.1.303 → task_agent-0.1.321}/tests/test_agent.py +0 -0
- {task_agent-0.1.303 → task_agent-0.1.321}/tests/test_cli_windows.py +0 -0
- {task_agent-0.1.303 → task_agent-0.1.321}/tests/test_discovery.py +0 -0
- {task_agent-0.1.303 → task_agent-0.1.321}/tests/test_manager_git.py +0 -0
- {task_agent-0.1.303 → task_agent-0.1.321}/tests/test_metrics.py +0 -0
- {task_agent-0.1.303 → task_agent-0.1.321}/tests/test_migration.py +0 -0
- {task_agent-0.1.303 → task_agent-0.1.321}/tests/test_templates.py +0 -0
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
+
|
|
5
|
+
## What is Task Agent?
|
|
6
|
+
|
|
7
|
+
**Task Agent** (`ta`) is a prioritized, file-based task queue designed for autonomous agentic workers. It manages tasks through a mission file (USV format), transitions them through state directories (pending → draft → active → completed), and provides git worktree isolation and task agent sandboxing for autonomous execution.
|
|
8
|
+
|
|
9
|
+
The system uses a "filesystem-as-database" philosophy: all tasks are stored as Markdown files in `docs/tasks/`, with priority managed by `docs/tasks/.task-agent/mission.usv` (immutable, git-tracked).
|
|
10
|
+
|
|
11
|
+
## Development Setup
|
|
12
|
+
|
|
13
|
+
### Environment
|
|
14
|
+
|
|
15
|
+
- **Python**: 3.12+ (see `pyproject.toml`)
|
|
16
|
+
- **Dependency manager**: `uv` (fast, deterministic)
|
|
17
|
+
- **Toolchain manager**: `mise` (manages Python, uv, etc.)
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
uv sync # Install dependencies
|
|
21
|
+
mise install # Set up toolchain
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Register with Claude Code
|
|
25
|
+
|
|
26
|
+
To use the Task Agent MCP server in Claude Code:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
ta init-mcp --claude
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
This registers the task-agent MCP server with Claude Code's local configuration. Verify it's working:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
claude mcp list # Should show task-agent connected ✔
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Build & Test
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
make build # Build wheel
|
|
42
|
+
make test # Run all tests (runs lint first)
|
|
43
|
+
make lint # Ruff + mypy checks
|
|
44
|
+
make test-e2e # Agent sandboxing tests (requires sudo)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Run a single test:
|
|
48
|
+
```bash
|
|
49
|
+
uv run pytest tests/test_cli.py::test_slugify
|
|
50
|
+
uv run pytest tests/test_manager.py -v
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Project Structure
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
src/taskagent/
|
|
57
|
+
cli.py # Entry point, argparse, subcommand handlers (2700+ lines)
|
|
58
|
+
manager.py # TaskAgent class: queue operations, git/filesystem
|
|
59
|
+
agent.py # Task agent Linux user creation, worktree setup
|
|
60
|
+
models/
|
|
61
|
+
issue.py # Issue dataclass (name, slug, dependencies)
|
|
62
|
+
metric.py # Metrics tracking
|
|
63
|
+
plugins/
|
|
64
|
+
github.py # GitHub issue syncing
|
|
65
|
+
discovery.py # Find task files on disk
|
|
66
|
+
mcp.py # Model Context Protocol server
|
|
67
|
+
templates.py # Agent template rendering
|
|
68
|
+
audit.py # Audit/healing commands
|
|
69
|
+
config.py # Configuration management
|
|
70
|
+
|
|
71
|
+
tests/ # pytest tests
|
|
72
|
+
test_cli.py # CLI command handlers
|
|
73
|
+
test_manager.py # TaskAgent logic
|
|
74
|
+
test_agent.py # Agent sandboxing
|
|
75
|
+
e2e/ # End-to-end agent tests
|
|
76
|
+
|
|
77
|
+
docs/tasks/ # The actual mission files (filesystem-as-db)
|
|
78
|
+
.task-agent/
|
|
79
|
+
mission.usv # Prioritized queue (Unit Separator Value format, immutable)
|
|
80
|
+
datapackage.json # Frictionless Data schema
|
|
81
|
+
pending/ # Tasks ready to start
|
|
82
|
+
draft/ # Tasks being defined
|
|
83
|
+
active/ # Tasks being worked on (by agents or humans)
|
|
84
|
+
completed/ # Finished tasks, archived by year
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Architecture & Key Concepts
|
|
88
|
+
|
|
89
|
+
### 1. Mission File (`docs/tasks/.task-agent/mission.usv`)
|
|
90
|
+
|
|
91
|
+
The source of truth for task priority. Format: `\x1f`-delimited (Unit Separator).
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
Name\x1fSlug\x1fDependencies
|
|
95
|
+
My Task\x1fmy-task\x1fdep1,dep2
|
|
96
|
+
Another Task\x1fanother-task\x1f
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
- Row order = priority
|
|
100
|
+
- Immutable via `chattr +i` (protected from accidental edits)
|
|
101
|
+
- Synced via `ta ingest` (reads filesystem, updates mission)
|
|
102
|
+
- Tasks move through state directories, not in mission file
|
|
103
|
+
|
|
104
|
+
### 2. Task State Transitions
|
|
105
|
+
|
|
106
|
+
Tasks live in subdirectories based on status:
|
|
107
|
+
|
|
108
|
+
- **pending/**: Backlog, waiting to start
|
|
109
|
+
- **draft/**: Being defined, not yet ready
|
|
110
|
+
- **active/**: Worker is processing it
|
|
111
|
+
- **mr/**: Merge request datagrams from autonomous workers
|
|
112
|
+
- **completed/{year}/**: Archived, includes commit hash metadata
|
|
113
|
+
|
|
114
|
+
### 3. Task Agents (Linux User Sandboxing)
|
|
115
|
+
|
|
116
|
+
When `ta start <slug> --agent <template>` runs:
|
|
117
|
+
|
|
118
|
+
1. Git worktree created at `.gwt/<slug>`
|
|
119
|
+
2. Linux user spawned: `agent-{slug}-{hash8}` with home = worktree
|
|
120
|
+
3. Dotfiles templated (SSH key, git config, credentials)
|
|
121
|
+
4. Sudoers drop-in created for passwordless `ta run`
|
|
122
|
+
5. Worker runs as that user via `sudo -u agent-...`
|
|
123
|
+
|
|
124
|
+
Agent cleanup happens in a `finally` block even if commit fails.
|
|
125
|
+
|
|
126
|
+
### 4. CLI Subcommands (Major)
|
|
127
|
+
|
|
128
|
+
The `ta` CLI has 30+ subcommands. Key ones for development:
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
ta next # Show top issue
|
|
132
|
+
ta list # List all tasks with hierarchy
|
|
133
|
+
ta new [-t TITLE] [-b BODY] # Create task
|
|
134
|
+
ta start <slug> # Create worktree + agent user
|
|
135
|
+
ta run <slug> # Execute worker as task agent
|
|
136
|
+
ta done <slug> # Move to completed/, commit, cleanup
|
|
137
|
+
ta tree # Show dependency tree
|
|
138
|
+
ta ingest # Sync filesystem → mission.usv
|
|
139
|
+
ta mcp # Run MCP server
|
|
140
|
+
ta init-mcp [--claude] # Register with Claude Desktop
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Development Patterns
|
|
144
|
+
|
|
145
|
+
### Adding a New Subcommand
|
|
146
|
+
|
|
147
|
+
1. Add handler function: `def cmd_mycommand(console, manager, args)` in `cli.py`
|
|
148
|
+
2. Register in `main()`: `subparsers.add_parser("mycommand", ...)`
|
|
149
|
+
3. Wire up args: `parser.set_defaults(func=cmd_mycommand)`
|
|
150
|
+
4. Test in `tests/test_cli.py`
|
|
151
|
+
|
|
152
|
+
### Modifying Task Logic
|
|
153
|
+
|
|
154
|
+
Most task operations go through `TaskAgent` class in `manager.py`:
|
|
155
|
+
|
|
156
|
+
```python
|
|
157
|
+
manager = TaskAgent(config_dir=None) # Auto-finds docs/tasks/.task-agent/
|
|
158
|
+
manager.load_mission() # Reads mission.usv
|
|
159
|
+
manager.list_issues() # Enumerate tasks
|
|
160
|
+
manager.move_issue(slug, target_dir) # Transition state
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### File Protection
|
|
164
|
+
|
|
165
|
+
Mission files are immutable after writes. Before modifying them:
|
|
166
|
+
|
|
167
|
+
```python
|
|
168
|
+
manager._set_writable(manager.mission_path, writable=True)
|
|
169
|
+
# ... edit ...
|
|
170
|
+
manager._set_writable(manager.mission_path, writable=False)
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
The `ta` CLI handles this automatically; direct edits are rare.
|
|
174
|
+
|
|
175
|
+
## Testing Notes
|
|
176
|
+
|
|
177
|
+
- **Unit tests**: Mock filesystem and git, very fast
|
|
178
|
+
- **Integration tests**: Use temporary `tmp_path` fixtures
|
|
179
|
+
- **E2E tests** (`tests/e2e/`): Require `sudo` for user creation; much slower
|
|
180
|
+
- **Windows compatibility**: Some paths use `shell=(os.name == "nt")` for subprocess
|
|
181
|
+
|
|
182
|
+
Test files organize by module (`test_cli.py`, `test_manager.py`, etc.). Use `pytest -v` for verbose output.
|
|
183
|
+
|
|
184
|
+
## Type Checking
|
|
185
|
+
|
|
186
|
+
The project uses **mypy** for static analysis. Run:
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
make lint # Includes mypy
|
|
190
|
+
uv run mypy src # Just mypy
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
Common issues:
|
|
194
|
+
- `Optional[Path]` for methods that may return `None`
|
|
195
|
+
- `type: ignore` for external libraries without stubs (rare)
|
|
196
|
+
|
|
197
|
+
## Dependencies
|
|
198
|
+
|
|
199
|
+
Key packages (see `pyproject.toml`):
|
|
200
|
+
|
|
201
|
+
- **pydantic**: Data models (Issue, etc.)
|
|
202
|
+
- **rich**: Terminal UI (tables, panels, markdown)
|
|
203
|
+
- **mcp**: Model Context Protocol server
|
|
204
|
+
- **githubkit**: GitHub API client
|
|
205
|
+
- **python-dotenv**: `.env` file support
|
|
206
|
+
- **questionary**: Interactive prompts
|
|
207
|
+
|
|
208
|
+
Dev dependencies:
|
|
209
|
+
- **pytest**: Testing framework
|
|
210
|
+
- **ruff**: Linting and formatting
|
|
211
|
+
- **mypy**: Type checking
|
|
212
|
+
- **bump-my-version**: Version bumping
|
|
213
|
+
- **pre-commit**: Git hooks
|
|
214
|
+
|
|
215
|
+
## Release & Versioning
|
|
216
|
+
|
|
217
|
+
Versions in `pyproject.toml` follow semver. The release workflow is **two commands**:
|
|
218
|
+
|
|
219
|
+
```bash
|
|
220
|
+
ta version promote patch # or minor/major: bumps version AND amends previous commit
|
|
221
|
+
ta version tag # Creates tag AND pushes to trigger CI publish
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### How It Works
|
|
225
|
+
|
|
226
|
+
1. **Commit your work** with a meaningful message (e.g., `feat: add new feature`, `fix: resolve issue`)
|
|
227
|
+
2. **`ta version promote patch`**:
|
|
228
|
+
- Bumps version in `pyproject.toml` and `uv.lock`
|
|
229
|
+
- **Amends previous commit** with `--amend --no-edit` (preserves original message)
|
|
230
|
+
- Version bump is metadata—release notes on PyPI reflect your actual work
|
|
231
|
+
3. **`ta version tag`**:
|
|
232
|
+
- Creates git tag matching the version in code
|
|
233
|
+
- Pushes tag to trigger GitHub Actions publish to PyPI
|
|
234
|
+
|
|
235
|
+
### Critical: Version-Tag Matching
|
|
236
|
+
|
|
237
|
+
The tag **must** point to a commit where `pyproject.toml` has the matching version. The amended commit ensures they always stay in sync.
|
|
238
|
+
|
|
239
|
+
**If publishing fails:**
|
|
240
|
+
- Check PyPI version: `ta version` shows "Latest PyPI version"
|
|
241
|
+
- Verify with: `git show HEAD:pyproject.toml | grep version`
|
|
242
|
+
- If mismatch: delete bad tag (`git tag -d vX.Y.Z`), bump to next version, re-tag
|
|
243
|
+
|
|
244
|
+
## Common Tasks for Claude
|
|
245
|
+
|
|
246
|
+
### Running the CLI locally
|
|
247
|
+
|
|
248
|
+
```bash
|
|
249
|
+
uv run python -m taskagent <subcommand> [args]
|
|
250
|
+
# or directly if installed
|
|
251
|
+
ta <subcommand> [args]
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
### Debugging subprocess calls
|
|
255
|
+
|
|
256
|
+
The codebase heavily uses `subprocess.run()` with `shell=(os.name == "nt")` for cross-platform. When debugging:
|
|
257
|
+
|
|
258
|
+
- Check both `stdout` and `stderr` captures
|
|
259
|
+
- Verify `check=True` / `check=False` behavior
|
|
260
|
+
- Watch for `capture_output=True` vs explicit `stdout=/stderr=`
|
|
261
|
+
|
|
262
|
+
### Mission file immutability issues
|
|
263
|
+
|
|
264
|
+
If tests fail with "cannot modify mission.usv":
|
|
265
|
+
|
|
266
|
+
```bash
|
|
267
|
+
sudo chattr -i docs/tasks/.task-agent/mission.usv
|
|
268
|
+
# ... run tests ...
|
|
269
|
+
# chattr will be re-applied by manager._set_writable()
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
Or grant capability (requires one-time setup):
|
|
273
|
+
|
|
274
|
+
```bash
|
|
275
|
+
sudo setcap cap_linux_immutable+ep $(which ta)
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
### Worktree cleanup
|
|
279
|
+
|
|
280
|
+
If a worktree is left behind:
|
|
281
|
+
|
|
282
|
+
```bash
|
|
283
|
+
git worktree prune
|
|
284
|
+
git branch -D issue/<slug>
|
|
285
|
+
rm -rf .gwt/<slug>
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
## Git Workflow
|
|
289
|
+
|
|
290
|
+
The project uses a single main branch (`master`). For local development:
|
|
291
|
+
|
|
292
|
+
1. Create a task: `ta new -t "My fix"`
|
|
293
|
+
2. Start it: `ta start my-fix`
|
|
294
|
+
3. Make changes in `.gwt/my-fix/`
|
|
295
|
+
4. Commit normally (git worktree is isolated)
|
|
296
|
+
5. Finish: `ta done my-fix` (moves to completed/, commits metadata)
|
|
297
|
+
|
|
298
|
+
The `ta` tool manages branching automatically. Rarely need manual `git` commands.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "task-agent"
|
|
3
|
-
version = "0.1.
|
|
3
|
+
version = "0.1.321"
|
|
4
4
|
description = "A prioritized, file-based task queue for autonomous agentic workers"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.12"
|
|
@@ -39,7 +39,7 @@ dev = [
|
|
|
39
39
|
]
|
|
40
40
|
|
|
41
41
|
[tool.bumpversion]
|
|
42
|
-
current_version = "0.1.
|
|
42
|
+
current_version = "0.1.321"
|
|
43
43
|
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
|
|
44
44
|
serialize = ["{major}.{minor}.{patch}"]
|
|
45
45
|
search = "version = \"{current_version}\""
|