@gonzih/cc-agent 0.15.11 → 0.15.16

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.
package/LICENSE ADDED
@@ -0,0 +1,203 @@
1
+ Copyright 2026 Maksim Soltan
2
+
3
+ Apache License
4
+ Version 2.0, January 2004
5
+ http://www.apache.org/licenses/
6
+
7
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8
+
9
+ 1. Definitions.
10
+
11
+ "License" shall mean the terms and conditions for use, reproduction,
12
+ and distribution as defined by Sections 1 through 9 of this document.
13
+
14
+ "Licensor" shall mean the copyright owner or entity authorized by
15
+ the copyright owner that is granting the License.
16
+
17
+ "Legal Entity" shall mean the union of the acting entity and all
18
+ other entities that control, are controlled by, or are under common
19
+ control with that entity. For the purposes of this definition,
20
+ "control" means (i) the power, direct or indirect, to cause the
21
+ direction or management of such entity, whether by contract or
22
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
23
+ outstanding shares, or (iii) beneficial ownership of such entity.
24
+
25
+ "You" (or "Your") shall mean an individual or Legal Entity
26
+ exercising permissions granted by this License.
27
+
28
+ "Source" form shall mean the preferred form for making modifications,
29
+ including but not limited to software source code, documentation
30
+ source, and configuration files.
31
+
32
+ "Object" form shall mean any form resulting from mechanical
33
+ transformation or translation of a Source form, including but
34
+ not limited to compiled object code, generated documentation,
35
+ and conversions to other media types.
36
+
37
+ "Work" shall mean the work of authorship, whether in Source or
38
+ Object form, made available under the License, as indicated by a
39
+ copyright notice that is included in or attached to the work
40
+ (an example is provided in the Appendix below).
41
+
42
+ "Derivative Works" shall mean any work, whether in Source or Object
43
+ form, that is based on (or derived from) the Work and for which the
44
+ editorial revisions, annotations, elaborations, or other modifications
45
+ represent, as a whole, an original work of authorship. For the purposes
46
+ of this License, Derivative Works shall not include works that remain
47
+ separable from, or merely link (or bind by name) to the interfaces of,
48
+ the Work and Derivative Works thereof.
49
+
50
+ "Contribution" shall mean any work of authorship, including
51
+ the original version of the Work and any modifications or additions
52
+ to that Work or Derivative Works thereof, that is intentionally
53
+ submitted to Licensor for inclusion in the Work by the copyright owner
54
+ or by an individual or Legal Entity authorized to submit on behalf of
55
+ the copyright owner. For the purposes of this definition, "submitted"
56
+ means any form of electronic, verbal, or written communication sent
57
+ to the Licensor or its representatives, including but not limited to
58
+ communication on electronic mailing lists, source code control systems,
59
+ and issue tracking systems that are managed by, or on behalf of, the
60
+ Licensor for the purpose of discussing and improving the Work, but
61
+ excluding communication that is conspicuously marked or otherwise
62
+ designated in writing by the copyright owner as "Not a Contribution."
63
+
64
+ "Contributor" shall mean Licensor and any individual or Legal Entity
65
+ on behalf of whom a Contribution has been received by Licensor and
66
+ subsequently incorporated within the Work.
67
+
68
+ 2. Grant of Copyright License. Subject to the terms and conditions of
69
+ this License, each Contributor hereby grants to You a perpetual,
70
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
71
+ copyright license to reproduce, prepare Derivative Works of,
72
+ publicly display, publicly perform, sublicense, and distribute the
73
+ Work and such Derivative Works in Source or Object form.
74
+
75
+ 3. Grant of Patent License. Subject to the terms and conditions of
76
+ this License, each Contributor hereby grants to You a perpetual,
77
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
78
+ (except as stated in this section) patent license to make, have made,
79
+ use, offer to sell, sell, import, and otherwise transfer the Work,
80
+ where such license applies only to those patent claims licensable
81
+ by such Contributor that are necessarily infringed by their
82
+ Contribution(s) alone or by combination of their Contribution(s)
83
+ with the Work to which such Contribution(s) was submitted. If You
84
+ institute patent litigation against any entity (including a
85
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
86
+ or a Contribution incorporated within the Work constitutes direct
87
+ or contributory patent infringement, then any patent licenses
88
+ granted to You under this License for that Work shall terminate
89
+ as of the date such litigation is filed.
90
+
91
+ 4. Redistribution. You may reproduce and distribute copies of the
92
+ Work or Derivative Works thereof in any medium, with or without
93
+ modifications, and in Source or Object form, provided that You
94
+ meet the following conditions:
95
+
96
+ (a) You must give any other recipients of the Work or
97
+ Derivative Works a copy of this License; and
98
+
99
+ (b) You must cause any modified files to carry prominent notices
100
+ stating that You changed the files; and
101
+
102
+ (c) You must retain, in the Source form of any Derivative Works
103
+ that You distribute, all copyright, patent, trademark, and
104
+ attribution notices from the Source form of the Work,
105
+ excluding those notices that do not pertain to any part of
106
+ the Derivative Works; and
107
+
108
+ (d) If the Work includes a "NOTICE" text file as part of its
109
+ distribution, then any Derivative Works that You distribute must
110
+ include a readable copy of the attribution notices contained
111
+ within such NOTICE file, excluding those notices that do not
112
+ pertain to any part of the Derivative Works, in at least one
113
+ of the following places: within a NOTICE text file distributed
114
+ as part of the Derivative Works; within the Source form or
115
+ documentation, if provided along with the Derivative Works; or,
116
+ within a display generated by the Derivative Works, if and
117
+ wherever such third-party notices normally appear. The contents
118
+ of the NOTICE file are for informational purposes only and
119
+ do not modify the License. You may add Your own attribution
120
+ notices within Derivative Works that You distribute, alongside
121
+ or as an addendum to the NOTICE text from the Work, provided
122
+ that such additional attribution notices cannot be construed
123
+ as modifying the License.
124
+
125
+ You may add Your own copyright statement to Your modifications and
126
+ may provide additional or different license terms and conditions
127
+ for use, reproduction, or distribution of Your modifications, or
128
+ for any such Derivative Works as a whole, provided Your use,
129
+ reproduction, and distribution of the Work otherwise complies with
130
+ the conditions stated in this License.
131
+
132
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
133
+ any Contribution intentionally submitted for inclusion in the Work
134
+ by You to the Licensor shall be under the terms and conditions of
135
+ this License, without any additional terms or conditions.
136
+ Notwithstanding the above, nothing herein shall supersede or modify
137
+ the terms of any separate license agreement you may have executed
138
+ with Licensor regarding such Contributions.
139
+
140
+ 6. Trademarks. This License does not grant permission to use the trade
141
+ names, trademarks, service marks, or product names of the Licensor,
142
+ except as required for reasonable and customary use in describing the
143
+ origin of the Work and reproducing the content of the NOTICE file.
144
+
145
+ 7. Disclaimer of Warranty. Unless required by applicable law or
146
+ agreed to in writing, Licensor provides the Work (and each
147
+ Contributor provides its Contributions) on an "AS IS" BASIS,
148
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
149
+ implied, including, without limitation, any warranties or conditions
150
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
151
+ PARTICULAR PURPOSE. You are solely responsible for determining the
152
+ appropriateness of using or redistributing the Work and assume any
153
+ risks associated with Your exercise of permissions under this License.
154
+
155
+ 8. Limitation of Liability. In no event and under no legal theory,
156
+ whether in tort (including negligence), contract, or otherwise,
157
+ unless required by applicable law (such as deliberate and grossly
158
+ negligent acts) or agreed to in writing, shall any Contributor be
159
+ liable to You for damages, including any direct, indirect, special,
160
+ incidental, or exemplary damages of any character arising as a
161
+ result of this License or out of the use or inability to use the
162
+ Work (including but not limited to damages for loss of goodwill,
163
+ work stoppage, computer failure or malfunction, or any and all
164
+ other commercial damages or losses), even if such Contributor
165
+ has been advised of the possibility of such damages.
166
+
167
+ 9. Accepting Warranty or Additional Liability. While redistributing
168
+ the Work or Derivative Works thereof, You may choose to offer,
169
+ and charge a fee for, acceptance of support, warranty, indemnity,
170
+ or other liability obligations and/or rights consistent with this
171
+ License. However, in accepting such obligations, You may act only
172
+ on Your own behalf and on Your sole responsibility, not on behalf
173
+ of any other Contributor, and only if You agree to indemnify,
174
+ defend, and hold each Contributor harmless for any liability
175
+ incurred by, or claims asserted against, such Contributor by reason
176
+ of your accepting any such warranty or additional liability.
177
+
178
+ END OF TERMS AND CONDITIONS
179
+
180
+ APPENDIX: How to apply the Apache License to your work.
181
+
182
+ To apply the Apache License to your work, attach the following
183
+ boilerplate notice, with the fields enclosed by brackets "[]"
184
+ replaced with your own identifying information. (Don't include
185
+ the brackets!) The text should be enclosed in the appropriate
186
+ comment syntax for the file format. We also recommend that a
187
+ file or class name and description of purpose be included on the
188
+ same "printed page" as the copyright notice for easier
189
+ identification within third-party archives.
190
+
191
+ Copyright [yyyy] [name of copyright owner]
192
+
193
+ Licensed under the Apache License, Version 2.0 (the "License");
194
+ you may not use this file except in compliance with the License.
195
+ You may obtain a copy of the License at
196
+
197
+ http://www.apache.org/licenses/LICENSE-2.0
198
+
199
+ Unless required by applicable law or agreed to in writing, software
200
+ distributed under the License is distributed on an "AS IS" BASIS,
201
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
202
+ See the License for the specific language governing permissions and
203
+ limitations under the License.
package/README.md CHANGED
@@ -4,6 +4,8 @@
4
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/@gonzih/cc-agent?label=@gonzih/cc-agent)](https://www.npmjs.com/package/@gonzih/cc-agent)
6
6
 
7
+ **Distill and delegate.**
8
+
7
9
  MCP server for spawning Claude Code agents in GitHub repos. Give Claude Code the ability to **branch itself** — clone a repo and kick off a sub-agent to work on it autonomously, with persistent state across MCP restarts.
8
10
 
9
11
  Built by [@Gonzih](https://github.com/Gonzih).
@@ -1 +1 @@
1
- {"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,YAAY,EAA6B,MAAM,YAAY,CAAC;AA4C3F,eAAO,MAAM,eAAe,ugBAW3B,CAAC;AAkBF,yEAAyE;AACzE,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,SAAS,GAAG,MAAM,CAAC,GAAG;IAAE,cAAc,CAAC,EAAE,OAAO,CAAC;IAAC,eAAe,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAoBtI;AA6DD;;;GAGG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAI/C;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAYpD;AAED,mFAAmF;AACnF,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAG9E;AAED,2E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M,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI;IAQpD,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IA6C3B,OAAO,CAAC,OAAO;CAahB"}
package/dist/agent.js CHANGED
@@ -409,7 +409,7 @@ export class JobManager {
409
409
  }
410
410
  }
411
411
  if (orphanCount > 0) {
412
- logger.info(`[cc-agent] Marked ${orphanCount} orphaned running jobs as interrupted`);
412
+ logger.info(`[job] init: marked ${orphanCount} orphaned running jobs as interrupted`);
413
413
  }
414
414
  // Persist any status corrections back to store
415
415
  for (const updated of updates) {
@@ -448,7 +448,7 @@ export class JobManager {
448
448
  const resolved = fromRecord(current);
449
449
  this.jobs.set(id, resolved);
450
450
  this.restoredJobs.delete(id);
451
- logger.info("job:synced-from-redis", { id, status: current.status });
451
+ logger.info("[job] synced-from-redis", { id, status: current.status });
452
452
  return;
453
453
  }
454
454
  }
@@ -458,7 +458,7 @@ export class JobManager {
458
458
  job.finishedAt = new Date();
459
459
  job.interruptedAt = job.interruptedAt ?? new Date();
460
460
  job.error = (job.error ? job.error + "; " : "") + "Process exited after MCP restart";
461
- logger.warn("job:process-died", { id, pid: job.pid });
461
+ logger.warn("[job] process-died", { id, pid: job.pid });
462
462
  this.persistJob(job);
463
463
  this.addOutput(job, "[cc-agent] Process no longer alive after MCP restart");
464
464
  })().catch(() => { });
@@ -495,11 +495,11 @@ export class JobManager {
495
495
  await redis.xtrim('cca:event-stream', 'MAXLEN', '~', '500');
496
496
  }
497
497
  catch (streamErr) {
498
- logger.warn('job:stream-write-failed', { id: job.id, err: String(streamErr) });
498
+ logger.warn('[job] stream-write-failed', { id: job.id, err: String(streamErr) });
499
499
  }
500
500
  }
501
501
  catch (err) {
502
- logger.warn('job:event-publish-failed', { id: job.id, err: String(err) });
502
+ logger.warn('[job] event-publish-failed', { id: job.id, err: String(err) });
503
503
  }
504
504
  })();
505
505
  }
@@ -536,10 +536,10 @@ export class JobManager {
536
536
  await redis.lpush(queueKey, payload);
537
537
  await redis.expire(queueKey, 7 * 24 * 60 * 60); // 7-day TTL matching job record
538
538
  }
539
- logger.info('job:done-published', { id: job.id, status: job.status, channel });
539
+ logger.info('[job] done-published', { id: job.id, status: job.status, channel });
540
540
  }
541
541
  catch (err) {
542
- logger.warn('job:done-publish-failed', { id: job.id, err: String(err) });
542
+ logger.warn('[job] done-publish-failed', { id: job.id, err: String(err) });
543
543
  }
544
544
  })();
545
545
  }
@@ -628,7 +628,7 @@ export class JobManager {
628
628
  };
629
629
  this.jobs.set(id, job);
630
630
  this.persistJob(job);
631
- logger.info("job:spawned", { id, status: job.status, repoUrl: opts.repoUrl });
631
+ logger.info("[job] created", { id, status: job.status, repoUrl: opts.repoUrl, branch: opts.branch, task: opts.task.slice(0, 200) });
632
632
  // Warn if the raw task is large — user may want to decompose it via create_plan
633
633
  if (opts.task.length > 800) {
634
634
  this.addOutput(job, `[cc-agent:warn] Task is large (${opts.task.length} chars). Consider using create_plan to decompose into atomic steps for more reliable execution.`);
@@ -673,7 +673,7 @@ export class JobManager {
673
673
  job.status = "rejected";
674
674
  job.finishedAt = new Date();
675
675
  job.error = "Approval timed out after 24 hours";
676
- logger.info("job:approval-timeout", { id: job.id });
676
+ logger.info("[job] approval-timeout", { id: job.id });
677
677
  this.addOutput(job, "[cc-agent] Approval timed out after 24 hours. Job rejected.");
678
678
  this.persistJob(job);
679
679
  this.publishJobEvent(job);
@@ -700,7 +700,7 @@ export class JobManager {
700
700
  this.approvalPollers.set(job.id, { intervalId, startTime });
701
701
  }
702
702
  doApprove(job) {
703
- logger.info("job:approved", { id: job.id });
703
+ logger.info("[job] approved", { id: job.id });
704
704
  this.addOutput(job, "[cc-agent] Approved. Starting job...");
705
705
  const runWithToken = async () => {
706
706
  const token = (job.claudeToken ?? await getCurrentToken()) || this.defaultToken;
@@ -733,7 +733,7 @@ export class JobManager {
733
733
  // Docker isolation mode: run the entire agent inside a fresh container
734
734
  if (job.dockerIsolation) {
735
735
  if (shouldSkipDocker(job)) {
736
- logger.info("[cc-agent] Skipping Docker isolation — native macOS/ML workload detected", { id: job.id });
736
+ logger.info("[job] docker-skipped — native macOS/ML workload detected", { id: job.id });
737
737
  this.addOutput(job, "[cc-agent] Skipping Docker isolation — native macOS/ML workload detected");
738
738
  // Fall through to host mode without mutating job.dockerIsolation
739
739
  }
@@ -753,7 +753,7 @@ export class JobManager {
753
753
  // 1. Clone
754
754
  workDir = await mkdtemp(join(tmpdir(), `cc-agent-${job.id.slice(0, 8)}-`));
755
755
  job.workDir = workDir;
756
- logger.info("job:cloning", { id: job.id, repoUrl: job.repoUrl });
756
+ logger.info("[job] cloning", { id: job.id, repoUrl: job.repoUrl, branch: job.branch });
757
757
  this.addOutput(job, `[cc-agent] Cloning ${job.repoUrl}...`);
758
758
  const cloneArgs = ["clone", "--depth", "1"];
759
759
  // Only checkout an existing branch during clone; if we're creating a new
@@ -793,7 +793,7 @@ export class JobManager {
793
793
  job.status = "failed";
794
794
  job.error = `smoke test failed: ${reason}`;
795
795
  job.finishedAt = new Date();
796
- logger.warn("job:smoke-test-failed", { id: job.id, error: job.error });
796
+ logger.warn("[job] smoke-test-failed", { id: job.id, error: job.error });
797
797
  this.addOutput(job, `[cc-agent] Smoke test FAILED: ${job.error}`);
798
798
  this.persistJob(job);
799
799
  this.publishJobEvent(job);
@@ -808,19 +808,19 @@ export class JobManager {
808
808
  if (existsSync(agentsMdPath)) {
809
809
  const content = await readFile(agentsMdPath, 'utf-8');
810
810
  repoContext = `\n\n## Repo Context (from AGENTS.md)\n${content.trim()}\n`;
811
- logger.info("job:agents-md-injected", { id: job.id, bytes: content.length });
811
+ logger.info("[job] agents-md-injected", { id: job.id, bytes: content.length });
812
812
  }
813
813
  else if (existsSync(ccAgentNotesPath)) {
814
814
  const content = await readFile(ccAgentNotesPath, 'utf-8');
815
815
  repoContext = `\n\n## Repo Context (from .cc-agent/notes.md)\n${content.trim()}\n`;
816
- logger.info("job:cc-agent-notes-injected", { id: job.id, bytes: content.length });
816
+ logger.info("[job] cc-agent-notes-injected", { id: job.id, bytes: content.length });
817
817
  }
818
818
  // 4. Run agent via driver
819
819
  job.status = "running";
820
820
  this.persistJob(job);
821
821
  this.publishJobEvent(job);
822
822
  const driverName = job.agentDriver ?? "claude";
823
- logger.info("job:running", { id: job.id, isResume, driver: driverName });
823
+ logger.info("[job] running", { id: job.id, pid: job.pid, isResume, driver: driverName });
824
824
  this.addOutput(job, isResume
825
825
  ? `[cc-agent] Resuming agent after sleep...`
826
826
  : `[cc-agent] Starting agent (${driverName}) with task...`);
@@ -857,6 +857,7 @@ export class JobManager {
857
857
  job.pid = agentProc.pid;
858
858
  this.persistJob(job);
859
859
  }
860
+ logger.info("[spawn] subprocess started", { job_id: job.id, pid: agentProc.pid ?? null, cwd: workDir, driver: driverName });
860
861
  this.kills.set(job.id, () => agentProc.kill());
861
862
  job.stdinStream = null;
862
863
  // --- Wall-clock timeout timer ---
@@ -865,7 +866,7 @@ export class JobManager {
865
866
  const timeoutMs = timeoutMinutes * 60 * 1000;
866
867
  const timeoutTimer = setTimeout(() => {
867
868
  this.timeoutTimers.delete(job.id);
868
- logger.warn(`[cc-agent:timeout] Job exceeded ${timeoutMinutes}m wall clock limit — terminating`, { id: job.id });
869
+ logger.warn(`[job] timeout: exceeded ${timeoutMinutes}m wall clock limit — terminating`, { id: job.id });
869
870
  this.addOutput(job, `[cc-agent:timeout] Job exceeded ${timeoutMinutes}m wall clock limit — terminating`);
870
871
  job.timedOut = true;
871
872
  job.failReason = "timeout";
@@ -958,12 +959,12 @@ export class JobManager {
958
959
  const cost = job.costUsd ?? 0;
959
960
  if (!budgetWarned && cost >= maxBudget * 0.9) {
960
961
  budgetWarned = true;
961
- logger.warn(`[cc-agent:budget] Job at 90% of $${maxBudget} budget`, { id: job.id, costUsd: cost });
962
+ logger.warn(`[job] budget-warning: at 90% of $${maxBudget} budget`, { id: job.id, costUsd: cost });
962
963
  this.addOutput(job, `[cc-agent:budget] Job at 90% of $${maxBudget} budget`);
963
964
  }
964
965
  if (!budgetKillStarted && cost >= maxBudget) {
965
966
  budgetKillStarted = true;
966
- logger.warn(`[cc-agent:budget] Budget $${maxBudget} exceeded — terminating`, { id: job.id, costUsd: cost });
967
+ logger.warn(`[job] budget-exceeded: $${maxBudget} exceeded — terminating`, { id: job.id, costUsd: cost });
967
968
  this.addOutput(job, `[cc-agent:budget] Budget $${maxBudget} exceeded — terminating`);
968
969
  job.failReason = "budget_exceeded";
969
970
  this.persistJob(job);
@@ -986,7 +987,7 @@ export class JobManager {
986
987
  const status = await getTokenStatus();
987
988
  if (!status.allExhausted) {
988
989
  tokenRotationRequested = true;
989
- logger.warn("job:token-rotated", {
990
+ logger.warn("[job] token-rotated", {
990
991
  id: job.id,
991
992
  newIndex: status.index,
992
993
  total: status.total,
@@ -1004,7 +1005,7 @@ export class JobManager {
1004
1005
  job.sleepReason = text.trim().slice(0, 500);
1005
1006
  this.persistJob(job);
1006
1007
  this.publishJobEvent(job);
1007
- logger.warn("job:sleeping", { id: job.id, sleepUntil: job.sleepUntil, triggeringText: text.trim().slice(0, 500) });
1008
+ logger.warn("[job] sleeping", { id: job.id, sleepUntil: job.sleepUntil, triggeringText: text.trim().slice(0, 500) });
1008
1009
  this.addOutput(job, `[cc-agent] All tokens exhausted. Sleeping until ${job.sleepUntil}`);
1009
1010
  agentProc.kill();
1010
1011
  }
@@ -1022,6 +1023,7 @@ export class JobManager {
1022
1023
  this.addOutput(job, `[tool] ${name}`);
1023
1024
  });
1024
1025
  agentProc.on("exit", (code) => {
1026
+ logger.info("[spawn] subprocess exited", { job_id: job.id, pid: job.pid ?? null, exit_code: code });
1025
1027
  // Clear wall-clock timeout timer — job has exited, timer is no longer needed
1026
1028
  const t = this.timeoutTimers.get(job.id);
1027
1029
  if (t) {
@@ -1053,7 +1055,7 @@ export class JobManager {
1053
1055
  const savedContinueSession = job.continueSession;
1054
1056
  job.continueSession = false;
1055
1057
  this.addOutput(job, `[cc-agent:retry] Context overflow detected — retrying with fresh context`);
1056
- logger.info("job:context-overflow-retry", { id: job.id, retryCount: job.retryCount });
1058
+ logger.info("[job] context-overflow-retry", { id: job.id, retryCount: job.retryCount });
1057
1059
  this.persistJob(job);
1058
1060
  await this.run(job, token);
1059
1061
  job.continueSession = savedContinueSession;
@@ -1062,7 +1064,7 @@ export class JobManager {
1062
1064
  if (tokenRotationRequested) {
1063
1065
  // Immediately re-run with the newly rotated token (no sleep)
1064
1066
  const nextToken = (job.claudeToken ?? await getCurrentToken()) || this.defaultToken;
1065
- logger.info("job:token-rotation-restart", { id: job.id, tokenIndex: job.tokenIndex });
1067
+ logger.info("[job] token-rotation-restart", { id: job.id, tokenIndex: job.tokenIndex });
1066
1068
  await this.run(job, nextToken);
1067
1069
  return;
1068
1070
  }
@@ -1078,7 +1080,8 @@ export class JobManager {
1078
1080
  job.scoreSource = source;
1079
1081
  }
1080
1082
  job.status = "done";
1081
- logger.info("job:done", { id: job.id, exitCode: job.exitCode ?? 0, costUsd: job.costUsd, score: job.score, scoreSource: job.scoreSource });
1083
+ const durationSeconds = Math.round((Date.now() - job.startedAt.getTime()) / 1000);
1084
+ logger.info("[job] done", { id: job.id, exit_code: job.exitCode ?? 0, duration_seconds: durationSeconds, output_lines: job.output.length, cost_usd: job.costUsd, score: job.score, score_source: job.scoreSource });
1082
1085
  this.addOutput(job, `[cc-agent] Done. Exit code: ${job.exitCode ?? 0}`);
1083
1086
  this.persistJob(job);
1084
1087
  this.publishJobEvent(job);
@@ -1086,10 +1089,10 @@ export class JobManager {
1086
1089
  if (job.onComplete) {
1087
1090
  const oc = job.onComplete;
1088
1091
  this.spawn({ repoUrl: oc.repo_url, task: oc.task, branch: oc.branch }).then((childId) => {
1089
- logger.info("job:oncomplete-spawned", { parentId: job.id, childId });
1092
+ logger.info("[job] oncomplete-spawned", { parentId: job.id, childId });
1090
1093
  this.addOutput(job, `[cc-agent] onComplete: spawned child job ${childId}`);
1091
1094
  }).catch((err) => {
1092
- logger.warn("job:oncomplete-spawn-failed", { parentId: job.id, err: String(err) });
1095
+ logger.warn("[job] oncomplete-spawn-failed", { parentId: job.id, err: String(err) });
1093
1096
  this.addOutput(job, `[cc-agent] onComplete spawn failed: ${String(err)}`);
1094
1097
  this.publishJobEvent(job);
1095
1098
  });
@@ -1101,9 +1104,9 @@ export class JobManager {
1101
1104
  (async () => {
1102
1105
  await learningsStore.clearLearnings(rk);
1103
1106
  await learningsStore.addLearning(rk, learnings);
1104
- logger.info("learnings:replaced-with-compressed", { id: job.id, repoKey: rk, length: learnings.length });
1107
+ logger.info("[job] learnings-replaced", { id: job.id, repoKey: rk, length: learnings.length });
1105
1108
  })().catch((err) => {
1106
- logger.warn("job:learnings-store-failed", { id: job.id, err: String(err) });
1109
+ logger.warn("[job] learnings-store-failed", { id: job.id, err: String(err) });
1107
1110
  });
1108
1111
  }
1109
1112
  // Read plan artifacts if they exist — attach to job output for coordinator visibility
@@ -1114,7 +1117,7 @@ export class JobManager {
1114
1117
  try {
1115
1118
  const planContent = await readFile(planPath, 'utf-8');
1116
1119
  this.addOutput(job, `[cc-agent] PLAN.md:\n${planContent.trim()}`);
1117
- logger.info("job:plan-artifact-read", { id: job.id, bytes: planContent.length });
1120
+ logger.info("[job] plan-artifact-read", { id: job.id, bytes: planContent.length });
1118
1121
  }
1119
1122
  catch { /* non-fatal */ }
1120
1123
  }
@@ -1122,7 +1125,7 @@ export class JobManager {
1122
1125
  try {
1123
1126
  const todoContent = await readFile(todoPath, 'utf-8');
1124
1127
  this.addOutput(job, `[cc-agent] TODO.md:\n${todoContent.trim()}`);
1125
- logger.info("job:todo-artifact-read", { id: job.id, bytes: todoContent.length });
1128
+ logger.info("[job] todo-artifact-read", { id: job.id, bytes: todoContent.length });
1126
1129
  }
1127
1130
  catch { /* non-fatal */ }
1128
1131
  }
@@ -1145,7 +1148,7 @@ export class JobManager {
1145
1148
  : job.failReason === "budget_exceeded"
1146
1149
  ? `Budget $${job.maxBudgetUsd ?? 20} exceeded`
1147
1150
  : String(err);
1148
- logger.error("job:failed", { id: job.id, error: job.error, failReason: job.failReason });
1151
+ logger.error("[job] failed", { id: job.id, exit_code: job.exitCode, error: (job.error ?? "").slice(0, 200), fail_reason: job.failReason });
1149
1152
  this.addOutput(job, `[cc-agent] FAILED: ${job.error}`);
1150
1153
  this.persistJob(job);
1151
1154
  this.publishJobEvent(job);
@@ -1167,7 +1170,7 @@ export class JobManager {
1167
1170
  async runDockerIsolated(job, token) {
1168
1171
  const dockerAvailable = await isDockerAvailable();
1169
1172
  if (!dockerAvailable) {
1170
- logger.warn("docker:unavailable — falling back to host mode", { id: job.id });
1173
+ logger.warn("[job] docker-unavailable — falling back to host mode", { id: job.id });
1171
1174
  this.addOutput(job, "[cc-agent] Docker unavailable — falling back to host mode");
1172
1175
  job.dockerIsolation = false;
1173
1176
  await this.run(job, token);
@@ -1177,7 +1180,7 @@ export class JobManager {
1177
1180
  this.addOutput(job, `[cc-agent] Docker isolation requested — spawning container ${containerName}`);
1178
1181
  job.status = "running";
1179
1182
  this.persistJob(job);
1180
- logger.info("job:docker-start", { id: job.id, containerName });
1183
+ logger.info("[job] docker-start", { id: job.id, containerName });
1181
1184
  this.addOutput(job, `[cc-agent] Starting Docker container: ${containerName}`);
1182
1185
  const githubToken = process.env.GITHUB_TOKEN ?? process.env.GH_TOKEN;
1183
1186
  const namespace = getNamespace();
@@ -1208,13 +1211,13 @@ export class JobManager {
1208
1211
  });
1209
1212
  });
1210
1213
  job.status = "done";
1211
- logger.info("job:done", { id: job.id, exitCode: job.exitCode ?? 0, mode: "docker" });
1214
+ logger.info("[job] done", { id: job.id, exit_code: job.exitCode ?? 0, mode: "docker" });
1212
1215
  this.addOutput(job, `[cc-agent] Done (Docker). Exit code: ${job.exitCode ?? 0}`);
1213
1216
  }
1214
1217
  catch (err) {
1215
1218
  job.status = "failed";
1216
1219
  job.error = String(err);
1217
- logger.error("job:failed", { id: job.id, error: job.error, mode: "docker" });
1220
+ logger.error("[job] failed", { id: job.id, exit_code: job.exitCode, error: (job.error ?? "").slice(0, 200), mode: "docker" });
1218
1221
  this.addOutput(job, `[cc-agent] FAILED (Docker): ${job.error}`);
1219
1222
  }
1220
1223
  finally {
@@ -1227,10 +1230,10 @@ export class JobManager {
1227
1230
  if (job.status === "done" && job.onComplete) {
1228
1231
  const oc = job.onComplete;
1229
1232
  this.spawn({ repoUrl: oc.repo_url, task: oc.task, branch: oc.branch }).then((childId) => {
1230
- logger.info("job:oncomplete-spawned", { parentId: job.id, childId });
1233
+ logger.info("[job] oncomplete-spawned", { parentId: job.id, childId });
1231
1234
  this.addOutput(job, `[cc-agent] onComplete: spawned child job ${childId}`);
1232
1235
  }).catch((err2) => {
1233
- logger.warn("job:oncomplete-spawn-failed", { parentId: job.id, err: String(err2) });
1236
+ logger.warn("[job] oncomplete-spawn-failed", { parentId: job.id, err: String(err2) });
1234
1237
  this.addOutput(job, `[cc-agent] onComplete spawn failed: ${String(err2)}`);
1235
1238
  });
1236
1239
  }
@@ -1239,7 +1242,7 @@ export class JobManager {
1239
1242
  async cleanupDockerContainers() {
1240
1243
  if (this.activeDockerContainers.size === 0)
1241
1244
  return;
1242
- logger.info("docker:cleanup", { containers: Array.from(this.activeDockerContainers) });
1245
+ logger.info("[job] docker-cleanup", { containers: Array.from(this.activeDockerContainers) });
1243
1246
  const containers = Array.from(this.activeDockerContainers);
1244
1247
  this.activeDockerContainers.clear();
1245
1248
  await Promise.allSettled(containers.map((name) => execFileAsync("docker", ["rm", "-f", name], { env: getDockerEnv() }).catch(() => { })));
@@ -1261,12 +1264,12 @@ export class JobManager {
1261
1264
  notes: null,
1262
1265
  };
1263
1266
  await appendFile(ratingsFile, JSON.stringify(entry) + "\n", "utf-8");
1264
- logger.info("model-rating:written", { job_id: job.id, model: job.ollamaModel });
1267
+ logger.info("[job] model-rating-written", { job_id: job.id, model: job.ollamaModel });
1265
1268
  }
1266
1269
  scheduleWake(job) {
1267
1270
  const sleepUntil = job.sleepUntil ? new Date(job.sleepUntil) : new Date(Date.now() + 60 * 60 * 1000);
1268
1271
  const delay = Math.max(0, sleepUntil.getTime() - Date.now());
1269
- logger.info("job:schedule-wake", { id: job.id, sleepUntil: sleepUntil.toISOString(), delayMs: delay });
1272
+ logger.info("[job] schedule-wake", { id: job.id, sleepUntil: sleepUntil.toISOString(), delayMs: delay });
1270
1273
  const timer = setTimeout(() => {
1271
1274
  this.wakeTimers.delete(job.id);
1272
1275
  this.doWake(job);
@@ -1302,7 +1305,7 @@ export class JobManager {
1302
1305
  doWake(job) {
1303
1306
  if (job.status !== "sleeping")
1304
1307
  return;
1305
- logger.info("job:waking", { id: job.id });
1308
+ logger.info("[job] waking", { id: job.id });
1306
1309
  job.sleepUntil = undefined;
1307
1310
  this.persistJob(job);
1308
1311
  this.addOutput(job, `[cc-agent] Waking up, resuming task...`);
@@ -1350,12 +1353,12 @@ export class JobManager {
1350
1353
  job.status = "failed";
1351
1354
  job.error = "Dependency failed";
1352
1355
  job.finishedAt = new Date();
1353
- logger.warn("job:dep-failed", { id: job.id });
1356
+ logger.warn("[job] dep-failed", { id: job.id });
1354
1357
  this.persistJob(job);
1355
1358
  this.publishJobEvent(job);
1356
1359
  }
1357
1360
  else if (allDone) {
1358
- logger.info("job:promoting", { id: job.id });
1361
+ logger.info("[job] promoting", { id: job.id });
1359
1362
  this.promote(job);
1360
1363
  }
1361
1364
  }
@@ -1479,7 +1482,7 @@ export class JobManager {
1479
1482
  }
1480
1483
  job.status = "cancelled";
1481
1484
  job.finishedAt = new Date();
1482
- logger.info("job:cancelled", { id });
1485
+ logger.info("[job] cancelled", { id });
1483
1486
  this.addOutput(job, "[cc-agent] Cancelled by user.");
1484
1487
  this.persistJob(job);
1485
1488
  this.publishJobEvent(job);