code-delegation-harness 0.2.1__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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Grok Coding Delegate Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,198 @@
1
+ Metadata-Version: 2.4
2
+ Name: code-delegation-harness
3
+ Version: 0.2.1
4
+ Summary: A harness for delegating coding work to LLMs while keeping your main agent clean. Structured artifacts, long-running support, and swappable backends.
5
+ Author-email: Joshua Fielden <joshua@fielden.dev>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/joshuafielden43/code-delegation-harness
8
+ Project-URL: Repository, https://github.com/joshuafielden43/code-delegation-harness
9
+ Keywords: ai,llm,coding,delegation,automation,grok,agent,sidecar,cli
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.9
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Topic :: Software Development :: Code Generators
19
+ Classifier: Topic :: Software Development :: Testing
20
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
+ Requires-Python: >=3.9
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Dynamic: license-file
25
+
26
+ # code-delegation-harness
27
+
28
+ A simple harness for delegating coding work to LLMs while keeping your main agent clean.
29
+
30
+ It gives you structured output + reviewable artifacts (JSON + human report + patch) even on long-running tasks, and lets you swap different backends without rewriting your top-level orchestration.
31
+
32
+ ## Quick Start
33
+
34
+ For normal use:
35
+
36
+ ```bash
37
+ pip install git+https://github.com/joshuafielden43/code-delegation-harness.git@v0.2.1
38
+ gcdh --help
39
+ ```
40
+
41
+ For development or the absolute latest code, see the [full installation guide](docs/installation.md).
42
+
43
+ Works best with Grok right now, but designed to be usable with other models too.
44
+
45
+ ## Why This Exists
46
+
47
+ Most agent setups mix your long-term context, style, and memory with the actual coding work. Over time that gets messy.
48
+
49
+ This tool tries to keep those concerns separate:
50
+ - Your primary agent/persona stays yours.
51
+ - Coding tasks get handed off to a focused execution environment.
52
+ - You get back clean, reviewable results instead of another giant conversation.
53
+
54
+ It also gives you the option to swap the backend harness later without having to change how you orchestrate things at the top level.
55
+
56
+ ## Current Output
57
+
58
+ When you run a task with `--output-file`, you get:
59
+ - `result.json` — structured data
60
+ - `result.report.md` — human-readable review document with diffs and observations
61
+ - `result.patch` — ready-to-apply unified diff (when code changed)
62
+
63
+ The goal is simple: you stay you. The work gets done well. And you only have to review the actual result.
64
+
65
+ ## Current Output (What You Actually Review)
66
+
67
+ When you delegate with `--output-file`, the harness produces:
68
+
69
+ - `result.json` — full structured data (status, files changed, summaries, errors)
70
+ - `result.report.md` — the primary document for reviewing the **end result** (clear status, per-file change descriptions with line stats and diff previews, observations from any analysis, verification steps)
71
+ - `result.patch` (when code was modified) — a ready-to-apply unified diff you can review or apply directly with `git apply`
72
+
73
+ The design goal is that you spend your time reviewing actual delivered work and collaborating on changes, not reviewing incremental proposals.
74
+
75
+ ## Basic Usage
76
+
77
+ From within a Grok / agent session:
78
+
79
+ ```
80
+ Delegate this task using the code-delegation-harness:
81
+
82
+ Task: Add Google-style docstrings and type hints to the `process_batch` function in src/batch.py. Do not change behavior.
83
+
84
+ Target directory: /path/to/your/project
85
+
86
+ Constraints: Follow the existing style in the file. Keep changes minimal.
87
+ ```
88
+
89
+ For the best experience, have the underlying wrapper called with `--output-file` so you receive the full set of review artifacts.
90
+
91
+ ### Professional CLI (`gcdh`)
92
+
93
+ **Recommended today (immediate & reliable):**
94
+
95
+ ```bash
96
+ cd code-delegation-harness
97
+ chmod +x bin/gcdh
98
+ export PATH="$PWD/bin:$PATH"
99
+
100
+ gcdh --help
101
+ gcdh --quiet --task "..." --target-dir /path/to/project --output-file result.json
102
+ ```
103
+
104
+ **Installation**
105
+
106
+ See the [full Installation guide](docs/installation.md) for the recommended path for primary agents versus development use.
107
+
108
+ ## Documentation
109
+
110
+ Full documentation lives in the `docs/` directory:
111
+
112
+ - [Installation](docs/installation.md)
113
+ - [Usage Notes](docs/usage-notes.md)
114
+ - [Examples](docs/examples/)
115
+ - [Dogfooding Case Study](docs/dogfooding-case-study.md)
116
+ - [Complete Proposed Documentation Structure](docs/DOCUMENTATION-STRUCTURE.md) (what we intend to build over time)
117
+
118
+ ### For Agents, Sidecars & Automation (Robot-Useful)
119
+
120
+ The harness was built to be driven by other agents and sidecars:
121
+
122
+ - `--quiet` (`-q`) → minimal, clean output perfect for programmatic consumption.
123
+ - `--output-file` is strongly recommended — it produces the full machine + human artifact set.
124
+ - Structured JSON output is stable and self-describing.
125
+ - `--dry-run` + `--quiet` gives agents a cheap, safe way to preview a task before committing.
126
+ - Persistent status files + `--status` / `--resume` make long-running work observable and resumable from outside.
127
+
128
+ This design makes it a strong primitive for building reliable delegation into larger agent architectures (including future sidecar systems).
129
+
130
+ ### Quiet Mode
131
+
132
+ `--quiet` (`-q`) is one of the most useful flags for both humans and agents. In quiet mode the tool only emits errors and the final artifact paths, making runs much cleaner — especially when combined with `--output-file`.
133
+
134
+ Long-running tasks are well supported:
135
+ - Use `--timeout` (seconds) and `--max-turns` to give big jobs room to breathe.
136
+ - Add `--wait-for-completion --max-wait 14400` (for example) and the wrapper will automatically poll until a background run finishes, then deliver the complete artifacts (full .json + .report.md + .patch + .run-meta.json).
137
+ - Persistent `.cdh-run-<id>.status` files are written for any run using `--run-name` or `--wait-for-completion`. These contain task snippet, run_name, timing, and state (launched / waiting / completed / max_wait_exceeded).
138
+ - Use `--status --target-dir /path` at any time to see both active and completed runs in that tree.
139
+ - Use `--resume <run-id-or-file>` to re-attach to a background run (smart short-circuit if it already finished).
140
+ - All final human review artifacts reflect the full background/resumption story when relevant.
141
+
142
+ See the `docs/` directory for usage notes, examples, and case studies.
143
+
144
+ ### Dry-Run Preview Mode
145
+
146
+ Use `--dry-run` (ideally with `--quiet`) before expensive or long-running delegations. It shows exactly what would happen without executing anything or writing files:
147
+
148
+ - The full prompt that would be sent
149
+ - Resolved configuration and flags
150
+ - Expected output artifacts
151
+
152
+ This is extremely useful for agents and for humans reviewing scope.
153
+
154
+ Combine with `--quiet` for the cleanest preview output.
155
+
156
+ ## Strengths
157
+
158
+ - Produces excellent, self-contained review artifacts by default
159
+ - Strong, reliable support for long-running and background tasks
160
+ - Clean handling of read-only / no-change work
161
+ - Clear error categorization and status reporting
162
+ - Full observability via persistent status files + `--status` / `--resume`
163
+
164
+ ## Current Status (Production Ready)
165
+
166
+ The harness is ready for real, repeated use on production work.
167
+
168
+ It delivers clean, reviewable end results even on long-running tasks:
169
+ - Complete structured JSON
170
+ - High-signal human `.report.md` with checklists and "How to Review This Change" guidance
171
+ - Ready-to-apply `.patch`
172
+ - `.run-meta.json` for reproducibility
173
+ - Persistent status files (`.cdh-run-*.status`) with full launch → wait → completion lifecycle, queryable via `--status`
174
+
175
+ Long-running support is first-class:
176
+ - `--timeout` / `--max-turns`
177
+ - `--wait-for-completion` with automatic background recovery
178
+ - `--status` and smart `--resume` for visibility and control
179
+
180
+ The project maintains two aligned purposes:
181
+ - A practical, MIT-licensed tool for reliable coding delegation
182
+ - The primary dogfooding platform for designing clean delegation patterns for future sidecar architectures
183
+
184
+ The code in this repository is the current production version.
185
+
186
+ ## Development & Contributing
187
+
188
+ Core implementation lives in `src/code_delegation_harness/harness.py` (with shims in `bin/gcdh`; `scripts/grok_delegate.py` is a legacy compatibility shim). You can also run with `python -m code_delegation_harness` after install or with PYTHONPATH=src.
189
+
190
+ See `CHANGELOG.md` for release history. Full development notes live in the upstream development tree.
191
+
192
+ ## License
193
+
194
+ MIT
195
+
196
+ ---
197
+
198
+ Built as a focused coding harness. The priority is useful, low-friction delegation with excellent output — for the person who still has to read, understand, and take responsibility for the final result.
@@ -0,0 +1,173 @@
1
+ # code-delegation-harness
2
+
3
+ A simple harness for delegating coding work to LLMs while keeping your main agent clean.
4
+
5
+ It gives you structured output + reviewable artifacts (JSON + human report + patch) even on long-running tasks, and lets you swap different backends without rewriting your top-level orchestration.
6
+
7
+ ## Quick Start
8
+
9
+ For normal use:
10
+
11
+ ```bash
12
+ pip install git+https://github.com/joshuafielden43/code-delegation-harness.git@v0.2.1
13
+ gcdh --help
14
+ ```
15
+
16
+ For development or the absolute latest code, see the [full installation guide](docs/installation.md).
17
+
18
+ Works best with Grok right now, but designed to be usable with other models too.
19
+
20
+ ## Why This Exists
21
+
22
+ Most agent setups mix your long-term context, style, and memory with the actual coding work. Over time that gets messy.
23
+
24
+ This tool tries to keep those concerns separate:
25
+ - Your primary agent/persona stays yours.
26
+ - Coding tasks get handed off to a focused execution environment.
27
+ - You get back clean, reviewable results instead of another giant conversation.
28
+
29
+ It also gives you the option to swap the backend harness later without having to change how you orchestrate things at the top level.
30
+
31
+ ## Current Output
32
+
33
+ When you run a task with `--output-file`, you get:
34
+ - `result.json` — structured data
35
+ - `result.report.md` — human-readable review document with diffs and observations
36
+ - `result.patch` — ready-to-apply unified diff (when code changed)
37
+
38
+ The goal is simple: you stay you. The work gets done well. And you only have to review the actual result.
39
+
40
+ ## Current Output (What You Actually Review)
41
+
42
+ When you delegate with `--output-file`, the harness produces:
43
+
44
+ - `result.json` — full structured data (status, files changed, summaries, errors)
45
+ - `result.report.md` — the primary document for reviewing the **end result** (clear status, per-file change descriptions with line stats and diff previews, observations from any analysis, verification steps)
46
+ - `result.patch` (when code was modified) — a ready-to-apply unified diff you can review or apply directly with `git apply`
47
+
48
+ The design goal is that you spend your time reviewing actual delivered work and collaborating on changes, not reviewing incremental proposals.
49
+
50
+ ## Basic Usage
51
+
52
+ From within a Grok / agent session:
53
+
54
+ ```
55
+ Delegate this task using the code-delegation-harness:
56
+
57
+ Task: Add Google-style docstrings and type hints to the `process_batch` function in src/batch.py. Do not change behavior.
58
+
59
+ Target directory: /path/to/your/project
60
+
61
+ Constraints: Follow the existing style in the file. Keep changes minimal.
62
+ ```
63
+
64
+ For the best experience, have the underlying wrapper called with `--output-file` so you receive the full set of review artifacts.
65
+
66
+ ### Professional CLI (`gcdh`)
67
+
68
+ **Recommended today (immediate & reliable):**
69
+
70
+ ```bash
71
+ cd code-delegation-harness
72
+ chmod +x bin/gcdh
73
+ export PATH="$PWD/bin:$PATH"
74
+
75
+ gcdh --help
76
+ gcdh --quiet --task "..." --target-dir /path/to/project --output-file result.json
77
+ ```
78
+
79
+ **Installation**
80
+
81
+ See the [full Installation guide](docs/installation.md) for the recommended path for primary agents versus development use.
82
+
83
+ ## Documentation
84
+
85
+ Full documentation lives in the `docs/` directory:
86
+
87
+ - [Installation](docs/installation.md)
88
+ - [Usage Notes](docs/usage-notes.md)
89
+ - [Examples](docs/examples/)
90
+ - [Dogfooding Case Study](docs/dogfooding-case-study.md)
91
+ - [Complete Proposed Documentation Structure](docs/DOCUMENTATION-STRUCTURE.md) (what we intend to build over time)
92
+
93
+ ### For Agents, Sidecars & Automation (Robot-Useful)
94
+
95
+ The harness was built to be driven by other agents and sidecars:
96
+
97
+ - `--quiet` (`-q`) → minimal, clean output perfect for programmatic consumption.
98
+ - `--output-file` is strongly recommended — it produces the full machine + human artifact set.
99
+ - Structured JSON output is stable and self-describing.
100
+ - `--dry-run` + `--quiet` gives agents a cheap, safe way to preview a task before committing.
101
+ - Persistent status files + `--status` / `--resume` make long-running work observable and resumable from outside.
102
+
103
+ This design makes it a strong primitive for building reliable delegation into larger agent architectures (including future sidecar systems).
104
+
105
+ ### Quiet Mode
106
+
107
+ `--quiet` (`-q`) is one of the most useful flags for both humans and agents. In quiet mode the tool only emits errors and the final artifact paths, making runs much cleaner — especially when combined with `--output-file`.
108
+
109
+ Long-running tasks are well supported:
110
+ - Use `--timeout` (seconds) and `--max-turns` to give big jobs room to breathe.
111
+ - Add `--wait-for-completion --max-wait 14400` (for example) and the wrapper will automatically poll until a background run finishes, then deliver the complete artifacts (full .json + .report.md + .patch + .run-meta.json).
112
+ - Persistent `.cdh-run-<id>.status` files are written for any run using `--run-name` or `--wait-for-completion`. These contain task snippet, run_name, timing, and state (launched / waiting / completed / max_wait_exceeded).
113
+ - Use `--status --target-dir /path` at any time to see both active and completed runs in that tree.
114
+ - Use `--resume <run-id-or-file>` to re-attach to a background run (smart short-circuit if it already finished).
115
+ - All final human review artifacts reflect the full background/resumption story when relevant.
116
+
117
+ See the `docs/` directory for usage notes, examples, and case studies.
118
+
119
+ ### Dry-Run Preview Mode
120
+
121
+ Use `--dry-run` (ideally with `--quiet`) before expensive or long-running delegations. It shows exactly what would happen without executing anything or writing files:
122
+
123
+ - The full prompt that would be sent
124
+ - Resolved configuration and flags
125
+ - Expected output artifacts
126
+
127
+ This is extremely useful for agents and for humans reviewing scope.
128
+
129
+ Combine with `--quiet` for the cleanest preview output.
130
+
131
+ ## Strengths
132
+
133
+ - Produces excellent, self-contained review artifacts by default
134
+ - Strong, reliable support for long-running and background tasks
135
+ - Clean handling of read-only / no-change work
136
+ - Clear error categorization and status reporting
137
+ - Full observability via persistent status files + `--status` / `--resume`
138
+
139
+ ## Current Status (Production Ready)
140
+
141
+ The harness is ready for real, repeated use on production work.
142
+
143
+ It delivers clean, reviewable end results even on long-running tasks:
144
+ - Complete structured JSON
145
+ - High-signal human `.report.md` with checklists and "How to Review This Change" guidance
146
+ - Ready-to-apply `.patch`
147
+ - `.run-meta.json` for reproducibility
148
+ - Persistent status files (`.cdh-run-*.status`) with full launch → wait → completion lifecycle, queryable via `--status`
149
+
150
+ Long-running support is first-class:
151
+ - `--timeout` / `--max-turns`
152
+ - `--wait-for-completion` with automatic background recovery
153
+ - `--status` and smart `--resume` for visibility and control
154
+
155
+ The project maintains two aligned purposes:
156
+ - A practical, MIT-licensed tool for reliable coding delegation
157
+ - The primary dogfooding platform for designing clean delegation patterns for future sidecar architectures
158
+
159
+ The code in this repository is the current production version.
160
+
161
+ ## Development & Contributing
162
+
163
+ Core implementation lives in `src/code_delegation_harness/harness.py` (with shims in `bin/gcdh`; `scripts/grok_delegate.py` is a legacy compatibility shim). You can also run with `python -m code_delegation_harness` after install or with PYTHONPATH=src.
164
+
165
+ See `CHANGELOG.md` for release history. Full development notes live in the upstream development tree.
166
+
167
+ ## License
168
+
169
+ MIT
170
+
171
+ ---
172
+
173
+ Built as a focused coding harness. The priority is useful, low-friction delegation with excellent output — for the person who still has to read, understand, and take responsibility for the final result.
@@ -0,0 +1,41 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "code-delegation-harness"
7
+ version = "0.2.1"
8
+ description = "A harness for delegating coding work to LLMs while keeping your main agent clean. Structured artifacts, long-running support, and swappable backends."
9
+ readme = "README.md"
10
+ license = {text = "MIT"}
11
+ requires-python = ">=3.9"
12
+ authors = [
13
+ {name = "Joshua Fielden", email = "joshua@fielden.dev"}
14
+ ]
15
+ keywords = ["ai", "llm", "coding", "delegation", "automation", "grok", "agent", "sidecar", "cli"]
16
+ classifiers = [
17
+ "Development Status :: 4 - Beta",
18
+ "Intended Audience :: Developers",
19
+ "License :: OSI Approved :: MIT License",
20
+ "Programming Language :: Python :: 3",
21
+ "Programming Language :: Python :: 3.9",
22
+ "Programming Language :: Python :: 3.10",
23
+ "Programming Language :: Python :: 3.11",
24
+ "Programming Language :: Python :: 3.12",
25
+ "Topic :: Software Development :: Code Generators",
26
+ "Topic :: Software Development :: Testing",
27
+ "Topic :: Software Development :: Libraries :: Python Modules",
28
+ ]
29
+
30
+ [project.scripts]
31
+ # After `pip install -e .` (or `pip install .`), users get the professional command:
32
+ # gcdh --help
33
+ gcdh = "code_delegation_harness.cli:main"
34
+
35
+ [project.urls]
36
+ Homepage = "https://github.com/joshuafielden43/code-delegation-harness"
37
+ Repository = "https://github.com/joshuafielden43/code-delegation-harness"
38
+
39
+ [tool.setuptools.packages.find]
40
+ where = ["src"]
41
+ exclude = ["tests*"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,34 @@
1
+ """
2
+ Code Delegation Harness
3
+
4
+ Professional packaging for the `gcdh` command.
5
+ """
6
+
7
+ from importlib.metadata import version as _pkg_version, PackageNotFoundError
8
+
9
+ from .harness import (
10
+ main,
11
+ prune_completed_status_files,
12
+ normalize_result,
13
+ render_human_report,
14
+ _determine_status,
15
+ _compute_diffs_and_stats,
16
+ _print_dry_run_preview,
17
+ _make_delegate_status,
18
+ _write_status_file,
19
+ _finalize_delegate_status,
20
+ _wait_for_background_completion,
21
+ )
22
+
23
+ try:
24
+ __version__ = _pkg_version("code-delegation-harness")
25
+ except (PackageNotFoundError, Exception):
26
+ __version__ = "0.2.0"
27
+
28
+ __all__ = [
29
+ "main",
30
+ "prune_completed_status_files",
31
+ "normalize_result",
32
+ "render_human_report",
33
+ "__version__",
34
+ ]
@@ -0,0 +1,4 @@
1
+ from . import main
2
+
3
+ if __name__ == "__main__":
4
+ main()
@@ -0,0 +1,9 @@
1
+ """
2
+ CLI entry point for the `gcdh` command.
3
+
4
+ This module provides the console_script target:
5
+ gcdh = "code_delegation_harness.cli:main"
6
+ """
7
+ from .harness import main
8
+
9
+ __all__ = ["main"]