@codedology/code-forge 0.1.0

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.
Files changed (184) hide show
  1. package/CHANGELOG.md +64 -0
  2. package/LICENSE +21 -0
  3. package/README.md +127 -0
  4. package/bin/code-forge.mjs +145 -0
  5. package/docs/README.md +37 -0
  6. package/docs/reference/blocks.json +288 -0
  7. package/docs/reference/config.md +162 -0
  8. package/examples/first-use/README.md +11 -0
  9. package/examples/first-use/clamp.acceptance.yml +8 -0
  10. package/examples/first-use/clamp.brief.md +16 -0
  11. package/examples/first-use/coder/src/math.mjs +31 -0
  12. package/examples/first-use/coder/test/clamp.test.mjs +26 -0
  13. package/examples/node-lib/.env.example +3 -0
  14. package/examples/node-lib/.gitattributes +3 -0
  15. package/examples/node-lib/.github/workflows/test.yml +11 -0
  16. package/examples/node-lib/CHANGELOG.md +13 -0
  17. package/examples/node-lib/README.md +17 -0
  18. package/examples/node-lib/gitignore +3 -0
  19. package/examples/node-lib/package.json +19 -0
  20. package/examples/node-lib/src/list.mjs +23 -0
  21. package/examples/node-lib/src/math.mjs +21 -0
  22. package/examples/node-lib/src/strings.mjs +34 -0
  23. package/examples/node-lib/test/list.test.mjs +12 -0
  24. package/examples/node-lib/test/math.test.mjs +13 -0
  25. package/examples/node-lib/test/package.test.mjs +18 -0
  26. package/examples/node-lib/test/strings.test.mjs +28 -0
  27. package/package.json +52 -0
  28. package/schema/code-forge.schema.json +331 -0
  29. package/schema/facts.schema.json +28 -0
  30. package/scripts/first-use.mjs +517 -0
  31. package/scripts/gen-config-doc.mjs +241 -0
  32. package/skill/SKILL.md +79 -0
  33. package/skill/references/adapters/claude-code.md +19 -0
  34. package/skill/references/adapters/solo.md +34 -0
  35. package/skill/references/adapters/subprocess.md +15 -0
  36. package/skill/references/code.md +64 -0
  37. package/skill/references/continuity.md +31 -0
  38. package/skill/references/decisions.md +50 -0
  39. package/skill/references/degraded.md +40 -0
  40. package/skill/references/harden.md +26 -0
  41. package/skill/references/ledger.md +23 -0
  42. package/skill/references/plan.md +43 -0
  43. package/skill/references/proof.md +34 -0
  44. package/skill/references/review.md +42 -0
  45. package/skill/references/rules-core.md +72 -0
  46. package/skill/references/security.md +29 -0
  47. package/skill/scripts/forge +40 -0
  48. package/skill/templates/block-record.md +19 -0
  49. package/skill/templates/facts-sheet.md +22 -0
  50. package/skill/templates/plan.md +53 -0
  51. package/src/cli/author.mjs +87 -0
  52. package/src/cli/block.mjs +262 -0
  53. package/src/cli/doctor.mjs +74 -0
  54. package/src/cli/facts.mjs +124 -0
  55. package/src/cli/gates.mjs +280 -0
  56. package/src/cli/help.mjs +48 -0
  57. package/src/cli/init.mjs +14 -0
  58. package/src/cli/jev.mjs +175 -0
  59. package/src/cli/keys.mjs +170 -0
  60. package/src/cli/ledger.mjs +160 -0
  61. package/src/cli/list.mjs +68 -0
  62. package/src/cli/models.mjs +131 -0
  63. package/src/cli/plan.mjs +70 -0
  64. package/src/cli/proof.mjs +316 -0
  65. package/src/cli/remove.mjs +76 -0
  66. package/src/cli/report.mjs +73 -0
  67. package/src/cli/resolve.mjs +79 -0
  68. package/src/cli/review-file.mjs +152 -0
  69. package/src/cli/run.mjs +159 -0
  70. package/src/cli/s2.mjs +93 -0
  71. package/src/cli/spawn.mjs +104 -0
  72. package/src/cli/upgrade.mjs +103 -0
  73. package/src/cli/validate.mjs +108 -0
  74. package/src/cli/version.mjs +18 -0
  75. package/src/cli/worker.mjs +76 -0
  76. package/src/config/defaults/anthropic.mjs +18 -0
  77. package/src/config/defaults/index.mjs +24 -0
  78. package/src/config/defaults/openai.mjs +16 -0
  79. package/src/config/defaults/xai.mjs +18 -0
  80. package/src/config/known-ids.mjs +171 -0
  81. package/src/config/load.mjs +135 -0
  82. package/src/config/migrate.mjs +46 -0
  83. package/src/config/refresh.mjs +276 -0
  84. package/src/config/schema-compile.mjs +211 -0
  85. package/src/config/schema-paths.mjs +84 -0
  86. package/src/config/secret-patterns.mjs +85 -0
  87. package/src/config/validate.mjs +694 -0
  88. package/src/decide/author-loop.mjs +90 -0
  89. package/src/decide/escalation.mjs +262 -0
  90. package/src/decide/fallback-rules.mjs +172 -0
  91. package/src/decide/jev-client.mjs +216 -0
  92. package/src/decide/questions.mjs +161 -0
  93. package/src/decide/thresholds.mjs +199 -0
  94. package/src/doctor/index.mjs +105 -0
  95. package/src/doctor/local.mjs +162 -0
  96. package/src/doctor/probes.mjs +358 -0
  97. package/src/doctor/rows.mjs +51 -0
  98. package/src/doctor/worker-probe.mjs +125 -0
  99. package/src/engines/alias-map.mjs +78 -0
  100. package/src/engines/builders/claude.mjs +224 -0
  101. package/src/engines/builders/codex.mjs +242 -0
  102. package/src/engines/builders/grok.mjs +132 -0
  103. package/src/engines/builders/index.mjs +35 -0
  104. package/src/engines/builders/validate-params.mjs +34 -0
  105. package/src/engines/codex-home.mjs +230 -0
  106. package/src/engines/isolation.mjs +84 -0
  107. package/src/engines/probe.mjs +116 -0
  108. package/src/engines/provider-cli.mjs +24 -0
  109. package/src/engines/render-rules.mjs +41 -0
  110. package/src/engines/sentinel.mjs +133 -0
  111. package/src/engines/usage-parse.mjs +149 -0
  112. package/src/gates/acceptance.mjs +95 -0
  113. package/src/gates/detect.mjs +187 -0
  114. package/src/gates/invariants.mjs +43 -0
  115. package/src/gates/run.mjs +72 -0
  116. package/src/gates/safe-edit.mjs +266 -0
  117. package/src/gates/scope.mjs +154 -0
  118. package/src/gates/secret-scan.mjs +79 -0
  119. package/src/gates/transcript-grep.mjs +27 -0
  120. package/src/install/agent-env.mjs +76 -0
  121. package/src/install/detect.mjs +121 -0
  122. package/src/install/harnesses.mjs +131 -0
  123. package/src/install/link.mjs +463 -0
  124. package/src/install/wizard/answers.mjs +389 -0
  125. package/src/install/wizard/flags.mjs +248 -0
  126. package/src/install/wizard/project-file.mjs +128 -0
  127. package/src/install/wizard/run.mjs +366 -0
  128. package/src/install/wizard/steps.mjs +201 -0
  129. package/src/keys/backends/constants.mjs +7 -0
  130. package/src/keys/backends/file.mjs +99 -0
  131. package/src/keys/backends/keychain.mjs +81 -0
  132. package/src/keys/backends/security-cli.mjs +105 -0
  133. package/src/keys/onepassword.mjs +46 -0
  134. package/src/keys/store.mjs +347 -0
  135. package/src/ledger/calibration.mjs +109 -0
  136. package/src/ledger/export.mjs +52 -0
  137. package/src/ledger/outcome.mjs +397 -0
  138. package/src/ledger/paths.mjs +30 -0
  139. package/src/ledger/prices.mjs +49 -0
  140. package/src/ledger/report.mjs +250 -0
  141. package/src/ledger/write.mjs +279 -0
  142. package/src/proof/export.mjs +358 -0
  143. package/src/proof/lock.mjs +138 -0
  144. package/src/proof/red-green.mjs +519 -0
  145. package/src/proof/red-parse.mjs +103 -0
  146. package/src/proof/tiers.mjs +62 -0
  147. package/src/review/budget.mjs +241 -0
  148. package/src/review/context.mjs +156 -0
  149. package/src/review/engine.mjs +264 -0
  150. package/src/review/finding.schema.json +47 -0
  151. package/src/review/fixloop.mjs +467 -0
  152. package/src/review/gate-check.mjs +249 -0
  153. package/src/review/lenses/A.md +22 -0
  154. package/src/review/lenses/B.md +23 -0
  155. package/src/review/lenses/full.md +23 -0
  156. package/src/review/lenses/judge.md +21 -0
  157. package/src/review/lenses/quick.md +21 -0
  158. package/src/review/lenses/recheck.md +23 -0
  159. package/src/review/packet.mjs +355 -0
  160. package/src/review/triage.mjs +149 -0
  161. package/src/review/validate-review.mjs +70 -0
  162. package/src/session/author.mjs +228 -0
  163. package/src/session/facts.mjs +855 -0
  164. package/src/session/plan-check.mjs +294 -0
  165. package/src/session/s2.mjs +164 -0
  166. package/src/session/spawn.mjs +610 -0
  167. package/src/state/block.mjs +289 -0
  168. package/src/state/cli-args.mjs +67 -0
  169. package/src/state/paths.mjs +92 -0
  170. package/src/state/registry.mjs +189 -0
  171. package/src/state/run.mjs +266 -0
  172. package/src/state/signer.mjs +132 -0
  173. package/src/util/exec.mjs +315 -0
  174. package/src/util/forbidden.mjs +787 -0
  175. package/src/util/git.mjs +381 -0
  176. package/src/util/log.mjs +100 -0
  177. package/src/util/reaper.mjs +300 -0
  178. package/src/util/redact.mjs +212 -0
  179. package/src/util/tmp.mjs +409 -0
  180. package/src/worker/engine.mjs +338 -0
  181. package/src/worker/loop.mjs +392 -0
  182. package/src/worker/queue.mjs +186 -0
  183. package/src/worker/review-state.mjs +145 -0
  184. package/src/worker/ticket.mjs +195 -0
@@ -0,0 +1,21 @@
1
+ /** Small number helpers. */
2
+
3
+ /** @param {number} a @param {number} b @returns {number} */
4
+ export function add(a, b) {
5
+ return a + b;
6
+ }
7
+
8
+ /** @param {number} a @param {number} b @returns {number} */
9
+ export function sub(a, b) {
10
+ return a - b;
11
+ }
12
+
13
+ /**
14
+ * @param {number[]} values
15
+ * @returns {number} the arithmetic mean
16
+ * @throws {RangeError} on an empty list
17
+ */
18
+ export function mean(values) {
19
+ if (values.length === 0) throw new RangeError('mean of an empty list');
20
+ return values.reduce(add, 0) / values.length;
21
+ }
@@ -0,0 +1,34 @@
1
+ /** Small string helpers. */
2
+
3
+ import { readFileSync } from 'node:fs';
4
+
5
+ /**
6
+ * @param {string} text @param {number} width @param {{side?: 'left' | 'right', fill?: string}} [opts]
7
+ * @returns {string} `text` padded to `width` characters
8
+ */
9
+ export function pad(text, width, { side = 'left', fill = ' ' } = {}) {
10
+ return side === 'left' ? text.padStart(width, fill) : text.padEnd(width, fill);
11
+ }
12
+
13
+ /** @param {string} text @returns {string} */
14
+ export function capitalize(text) {
15
+ return text.length === 0 ? text : text[0].toUpperCase() + text.slice(1);
16
+ }
17
+
18
+ /**
19
+ * `GREETING` from a dotenv-style file (default `.env` in the current directory), or `hi`.
20
+ * @param {string} name @param {string} [envFile]
21
+ * @returns {string}
22
+ */
23
+ export function greet(name, envFile = '.env') {
24
+ let word = 'hi';
25
+ try {
26
+ const line = readFileSync(envFile, 'utf8')
27
+ .split('\n')
28
+ .find((l) => l.startsWith('GREETING='));
29
+ if (line) word = line.slice('GREETING='.length).trim();
30
+ } catch {
31
+ // no env file: the default greeting
32
+ }
33
+ return `${capitalize(word)}, ${name}!`;
34
+ }
@@ -0,0 +1,12 @@
1
+ import assert from 'node:assert/strict';
2
+ import { test } from 'node:test';
3
+ import { chunk, unique } from '../src/list.mjs';
4
+
5
+ test('chunk splits into slices of at most size items', () => {
6
+ assert.deepEqual(chunk([1, 2, 3, 4, 5], 2), [[1, 2], [3, 4], [5]]);
7
+ assert.throws(() => chunk([1], 0), RangeError);
8
+ });
9
+
10
+ test('unique keeps the first occurrence, in order', () => {
11
+ assert.deepEqual(unique([3, 1, 3, 2, 1]), [3, 1, 2]);
12
+ });
@@ -0,0 +1,13 @@
1
+ import assert from 'node:assert/strict';
2
+ import { test } from 'node:test';
3
+ import { add, mean, sub } from '../src/math.mjs';
4
+
5
+ test('add and sub', () => {
6
+ assert.equal(add(2, 3), 5);
7
+ assert.equal(sub(2, 3), -1);
8
+ });
9
+
10
+ test('mean of three values, and of none', () => {
11
+ assert.equal(mean([1, 2, 6]), 3);
12
+ assert.throws(() => mean([]), RangeError);
13
+ });
@@ -0,0 +1,18 @@
1
+ // The release files a measurement export must restore: `.gitattributes` marks both export-ignore.
2
+ import assert from 'node:assert/strict';
3
+ import { readFileSync } from 'node:fs';
4
+ import { test } from 'node:test';
5
+
6
+ const root = new URL('../', import.meta.url);
7
+ const read = (/** @type {string} */ rel) => readFileSync(new URL(rel, root), 'utf8');
8
+
9
+ test('CHANGELOG.md has a section for the package version', () => {
10
+ const { version } = JSON.parse(read('package.json'));
11
+ assert.equal(read('CHANGELOG.md').includes(`\n## ${version}\n`), true);
12
+ });
13
+
14
+ test('the CI workflow runs npm test on Node 22', () => {
15
+ const workflow = read('.github/workflows/test.yml');
16
+ assert.equal(workflow.includes('node-version: 22'), true);
17
+ assert.equal(workflow.includes('- run: npm test'), true);
18
+ });
@@ -0,0 +1,28 @@
1
+ import assert from 'node:assert/strict';
2
+ import { mkdtempSync, rmSync, writeFileSync } from 'node:fs';
3
+ import os from 'node:os';
4
+ import path from 'node:path';
5
+ import { test } from 'node:test';
6
+ import { capitalize, greet, pad } from '../src/strings.mjs';
7
+
8
+ test('pad on either side', () => {
9
+ assert.equal(pad('7', 3), ' 7');
10
+ assert.equal(pad('7', 3, { side: 'right', fill: '.' }), '7..');
11
+ });
12
+
13
+ test('capitalize keeps the empty string', () => {
14
+ assert.equal(capitalize('ada'), 'Ada');
15
+ assert.equal(capitalize(''), '');
16
+ });
17
+
18
+ test('greet reads GREETING from the env file, else says hi', () => {
19
+ const dir = mkdtempSync(path.join(os.tmpdir(), 'node-lib-'));
20
+ try {
21
+ const file = path.join(dir, '.env');
22
+ writeFileSync(file, 'GREETING=hello\n');
23
+ assert.equal(greet('Ada', file), 'Hello, Ada!');
24
+ assert.equal(greet('Ada', path.join(dir, 'missing.env')), 'Hi, Ada!');
25
+ } finally {
26
+ rmSync(dir, { recursive: true, force: true });
27
+ }
28
+ });
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "@codedology/code-forge",
3
+ "version": "0.1.0",
4
+ "description": "Plan/harden/code/review orchestration CLI and Agent Skill for cross-model, parallel, evidence-gated feature delivery.",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/ricardov03/code-forge.git"
8
+ },
9
+ "homepage": "https://github.com/ricardov03/code-forge#readme",
10
+ "bugs": {
11
+ "url": "https://github.com/ricardov03/code-forge/issues"
12
+ },
13
+ "license": "MIT",
14
+ "type": "module",
15
+ "publishConfig": {
16
+ "access": "public"
17
+ },
18
+ "engines": {
19
+ "node": ">=22"
20
+ },
21
+ "bin": {
22
+ "code-forge": "bin/code-forge.mjs"
23
+ },
24
+ "files": [
25
+ "bin",
26
+ "src",
27
+ "schema",
28
+ "skill",
29
+ "docs/reference",
30
+ "examples",
31
+ "scripts",
32
+ "README.md",
33
+ "CHANGELOG.md",
34
+ "LICENSE"
35
+ ],
36
+ "scripts": {
37
+ "test": "CODE_FORGE_NO_LEAK=snapshot node --import ./test/helpers/isolate.mjs --test test/no-leak.test.mjs && node --import ./test/helpers/isolate.mjs --experimental-test-module-mocks --test 'test/**/*.test.mjs' && CODE_FORGE_NO_LEAK=final node --import ./test/helpers/isolate.mjs --test test/no-leak.test.mjs",
38
+ "typecheck": "tsc --checkJs --noEmit"
39
+ },
40
+ "dependencies": {
41
+ "@clack/prompts": "1.8.1",
42
+ "ajv": "8.20.0",
43
+ "yaml": "2.9.1"
44
+ },
45
+ "optionalDependencies": {
46
+ "@napi-rs/keyring": "2.1.0"
47
+ },
48
+ "devDependencies": {
49
+ "@types/node": "22.20.4",
50
+ "typescript": "7.0.2"
51
+ }
52
+ }
@@ -0,0 +1,331 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://code-forge.dev/schema/code-forge.schema.json",
4
+ "title": "code-forge project configuration (.code-forge.yml)",
5
+ "description": "Plan v1.2 §1.3 — every key any section of the plan reads must appear here. additionalProperties: false everywhere a key set is fixed; a typed additionalProperties schema (never bare true) marks the handful of genuinely open-ended maps (thresholds.<question>, system1.criteria_extra, known_extra, keys, review.second_levels — the last restricted to L0..L3 keys only via propertyNames). v1.3 (B1.1) amendment: review.max_rounds_per_file/recheck_scope/late_findings (§4.11), budget.block_cases (§10.7), caps.coders re-defaulted to 2 (R10), tmp.root (§9.6/§1.2, V12).",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": ["version", "provider", "levels"],
9
+ "$comment": "version/provider/levels are REQUIRED with NO schema-level default (a config omitting them is refused here) — `migrate.mjs` fills a MISSING `version` to CURRENT_VERSION before this schema ever runs (so an on-disk file may omit `version`), but `provider` has no such auto-fill anywhere and must be present in the loaded document.",
10
+ "properties": {
11
+ "version": { "type": "integer", "const": 1 },
12
+ "project": {
13
+ "type": "object",
14
+ "additionalProperties": false,
15
+ "properties": {
16
+ "name": { "type": "string" },
17
+ "slug": { "type": "string" },
18
+ "plans_dir": { "type": "string" },
19
+ "languages": {
20
+ "type": "object",
21
+ "additionalProperties": false,
22
+ "properties": {
23
+ "chat": { "type": "string" },
24
+ "ui": { "type": "string" },
25
+ "pr": { "type": "string" }
26
+ }
27
+ }
28
+ }
29
+ },
30
+ "provider": { "$ref": "#/$defs/provider" },
31
+ "levels": {
32
+ "type": "object",
33
+ "additionalProperties": false,
34
+ "required": ["L0", "L1", "L2", "L3"],
35
+ "properties": {
36
+ "L0": { "$ref": "#/$defs/level" },
37
+ "L1": { "$ref": "#/$defs/level" },
38
+ "L2": { "$ref": "#/$defs/level" },
39
+ "L3": { "$ref": "#/$defs/level" }
40
+ }
41
+ },
42
+ "orchestrator": { "$ref": "#/$defs/levelName" },
43
+ "system1": {
44
+ "type": "object",
45
+ "additionalProperties": false,
46
+ "properties": {
47
+ "provider": { "$ref": "#/$defs/provider" },
48
+ "model": { "type": "string" },
49
+ "key": { "type": "string" },
50
+ "fallback": { "type": "string", "enum": ["rules", "s2", "stop"], "default": "rules" },
51
+ "criteria_extra": {
52
+ "type": "object",
53
+ "additionalProperties": {
54
+ "type": "object",
55
+ "additionalProperties": false,
56
+ "properties": {
57
+ "instructions": { "type": "string" },
58
+ "criteria": { "type": "object", "additionalProperties": { "type": "string" } }
59
+ }
60
+ }
61
+ },
62
+ "disable": { "type": "array", "items": { "type": "string" } }
63
+ }
64
+ },
65
+ "thresholds": {
66
+ "type": "object",
67
+ "additionalProperties": { "$ref": "#/$defs/thresholdBand" },
68
+ "properties": {
69
+ "default": { "$ref": "#/$defs/thresholdBand" },
70
+ "findings": {
71
+ "type": "object",
72
+ "additionalProperties": false,
73
+ "properties": {
74
+ "fix": { "type": "number", "minimum": 0, "maximum": 1, "default": 0.9 },
75
+ "nit": { "type": "number", "minimum": 0, "maximum": 1, "default": 0.4 },
76
+ "resolved": { "type": "number", "minimum": 0, "maximum": 1, "default": 0.9 }
77
+ }
78
+ }
79
+ }
80
+ },
81
+ "escalation": {
82
+ "type": "object",
83
+ "additionalProperties": false,
84
+ "properties": {
85
+ "retries_per_level": { "type": "integer", "minimum": 0, "default": 2 },
86
+ "review_rounds_per_level": { "type": "integer", "minimum": 0, "default": 2 },
87
+ "stop_at": { "type": "string", "const": "L3", "default": "L3" },
88
+ "l3_mode": { "type": "string", "enum": ["patch", "code"], "default": "patch" }
89
+ }
90
+ },
91
+ "review": {
92
+ "type": "object",
93
+ "additionalProperties": false,
94
+ "properties": {
95
+ "multimodel": { "type": "boolean", "default": false },
96
+ "second_provider": { "anyOf": [{ "$ref": "#/$defs/provider" }, { "type": "null" }], "default": null },
97
+ "second_levels": {
98
+ "anyOf": [
99
+ { "type": "null" },
100
+ {
101
+ "type": "object",
102
+ "propertyNames": { "$ref": "#/$defs/levelName" },
103
+ "additionalProperties": { "$ref": "#/$defs/level" }
104
+ }
105
+ ],
106
+ "default": null
107
+ },
108
+ "closed_book": { "type": "boolean", "const": true, "default": true },
109
+ "judge_sees_diff": { "type": "boolean", "default": false },
110
+ "budgets": {
111
+ "type": "object",
112
+ "additionalProperties": false,
113
+ "properties": {
114
+ "quick_in": { "type": "integer", "minimum": 1, "default": 6000 },
115
+ "full_in": { "type": "integer", "minimum": 1, "default": 12000 },
116
+ "judge_in": { "type": "integer", "minimum": 1, "default": 8000 },
117
+ "out": { "type": "integer", "minimum": 1, "default": 1200 }
118
+ }
119
+ },
120
+ "context": {
121
+ "type": "object",
122
+ "additionalProperties": false,
123
+ "properties": {
124
+ "whole_file_max_lines": { "type": "integer", "minimum": 0, "default": 400 },
125
+ "hunk_context_lines": { "type": "integer", "minimum": 0, "default": 40 },
126
+ "min_context_lines": { "type": "integer", "minimum": 0, "default": 10 }
127
+ }
128
+ },
129
+ "block_budget_tokens": { "type": "integer", "minimum": 1, "default": 150000 },
130
+ "block_budget_usd": {
131
+ "anyOf": [{ "type": "number", "exclusiveMinimum": 0 }, { "type": "null" }],
132
+ "default": null
133
+ },
134
+ "min_tokens_out": { "type": "integer", "minimum": 1, "default": 120 },
135
+ "batch_small_files": { "type": "boolean", "default": true },
136
+ "session_timeout_s": { "type": "integer", "minimum": 1, "default": 600 },
137
+ "max_rounds_per_file": { "type": "integer", "minimum": 2, "maximum": 6, "default": 4 },
138
+ "recheck_scope": { "type": "string", "enum": ["fix_hunks", "file"], "default": "fix_hunks" },
139
+ "late_findings": { "type": "string", "enum": ["sweep", "block"], "default": "sweep" }
140
+ }
141
+ },
142
+ "engine": { "type": "string", "enum": ["auto", "solo", "harness", "subprocess"], "default": "auto" },
143
+ "harnesses": { "type": "array", "items": { "type": "string" } },
144
+ "harness": {
145
+ "type": "object",
146
+ "additionalProperties": false,
147
+ "properties": {
148
+ "claude": {
149
+ "type": "object",
150
+ "additionalProperties": false,
151
+ "properties": { "worktree": { "type": "boolean", "default": false } }
152
+ },
153
+ "solo": {
154
+ "type": "object",
155
+ "additionalProperties": false,
156
+ "properties": { "interactive_harden": { "type": "boolean", "default": false } }
157
+ }
158
+ }
159
+ },
160
+ "caps": {
161
+ "type": "object",
162
+ "additionalProperties": false,
163
+ "properties": { "coders": { "type": "integer", "minimum": 1, "default": 2 } }
164
+ },
165
+ "gates": {
166
+ "type": "object",
167
+ "additionalProperties": false,
168
+ "properties": {
169
+ "test": { "$ref": "#/$defs/argvOrNull" },
170
+ "lint": { "$ref": "#/$defs/argvOrNull" },
171
+ "types": { "$ref": "#/$defs/argvOrNull" },
172
+ "format": { "$ref": "#/$defs/argvOrNull" },
173
+ "extra": {
174
+ "type": "object",
175
+ "additionalProperties": false,
176
+ "properties": {
177
+ "secret_scan": { "type": "boolean", "default": true },
178
+ "safe_edit": { "type": "boolean", "default": true },
179
+ "invariants": { "type": "string" }
180
+ }
181
+ },
182
+ "full_suite_threshold_files": { "type": "integer", "minimum": 1, "default": 10 }
183
+ }
184
+ },
185
+ "proof": {
186
+ "type": "object",
187
+ "additionalProperties": false,
188
+ "properties": {
189
+ "tiers": {
190
+ "type": "object",
191
+ "additionalProperties": false,
192
+ "properties": {
193
+ "high": {
194
+ "type": "object",
195
+ "additionalProperties": false,
196
+ "properties": {
197
+ "paths": { "type": "array", "items": { "type": "string" } }
198
+ }
199
+ },
200
+ "light": { "type": "object", "additionalProperties": false, "properties": {} }
201
+ }
202
+ },
203
+ "extra": { "type": "array", "items": { "type": "string" } },
204
+ "isolation": { "type": "string", "enum": ["export", "lock"], "default": "export" },
205
+ "export": {
206
+ "type": "object",
207
+ "additionalProperties": false,
208
+ "properties": {
209
+ "link_dirs": {
210
+ "type": "array",
211
+ "items": { "type": "string" },
212
+ "default": ["vendor", "node_modules"]
213
+ },
214
+ "copy_untracked": {
215
+ "type": "array",
216
+ "items": { "type": "string" },
217
+ "default": [".env", ".env.testing"]
218
+ }
219
+ }
220
+ }
221
+ }
222
+ },
223
+ "budget": {
224
+ "type": "object",
225
+ "additionalProperties": false,
226
+ "properties": {
227
+ "block_lines": { "type": "integer", "minimum": 1, "default": 600 },
228
+ "block_tokens_soft": { "type": "integer", "minimum": 1 },
229
+ "block_tokens_hard": { "type": "integer", "minimum": 1 },
230
+ "run_usd_soft": { "type": "number", "minimum": 0 },
231
+ "block_cases": { "type": "integer", "minimum": 10, "default": 80 }
232
+ }
233
+ },
234
+ "autonomy": {
235
+ "type": "object",
236
+ "additionalProperties": false,
237
+ "properties": {
238
+ "coder_may_open_draft_pr": { "type": "boolean", "default": true },
239
+ "coder_may_push": { "type": "boolean", "default": true }
240
+ }
241
+ },
242
+ "commit": {
243
+ "type": "object",
244
+ "additionalProperties": false,
245
+ "properties": {
246
+ "trailers": { "type": "string", "enum": ["none", "harness"], "default": "none" }
247
+ }
248
+ },
249
+ "wip": {
250
+ "type": "object",
251
+ "additionalProperties": false,
252
+ "properties": { "ready_prs": { "type": "integer", "minimum": 1, "default": 1 } }
253
+ },
254
+ "production": {
255
+ "type": "object",
256
+ "additionalProperties": false,
257
+ "properties": {
258
+ "markers": { "type": "array", "items": { "type": "string" } },
259
+ "names": { "type": "array", "items": { "type": "string" } }
260
+ }
261
+ },
262
+ "known_extra": {
263
+ "type": "object",
264
+ "additionalProperties": { "type": "array", "items": { "type": "string" } }
265
+ },
266
+ "calibration": {
267
+ "type": "object",
268
+ "additionalProperties": false,
269
+ "properties": {
270
+ "shadow_rate": { "type": "number", "minimum": 0, "maximum": 0.5, "default": 0 }
271
+ }
272
+ },
273
+ "keys": {
274
+ "type": "object",
275
+ "additionalProperties": { "type": "string" }
276
+ },
277
+ "tmp": {
278
+ "type": "object",
279
+ "additionalProperties": false,
280
+ "properties": {
281
+ "root": {
282
+ "anyOf": [{ "type": "string", "minLength": 1 }, { "type": "null" }],
283
+ "default": null
284
+ }
285
+ }
286
+ },
287
+ "telemetry": { "type": "string", "const": "off", "default": "off" }
288
+ },
289
+ "$defs": {
290
+ "provider": { "type": "string", "enum": ["anthropic", "openai", "xai"] },
291
+ "levelName": { "type": "string", "enum": ["L0", "L1", "L2", "L3"] },
292
+ "level": {
293
+ "type": "object",
294
+ "additionalProperties": false,
295
+ "required": ["model"],
296
+ "properties": {
297
+ "model": { "type": "string", "minLength": 1 },
298
+ "effort": { "type": "string" },
299
+ "provider": { "$ref": "#/$defs/provider" },
300
+ "fallback": {
301
+ "type": "array",
302
+ "items": {
303
+ "type": "object",
304
+ "additionalProperties": false,
305
+ "required": ["provider", "model"],
306
+ "properties": {
307
+ "provider": { "$ref": "#/$defs/provider" },
308
+ "model": { "type": "string", "minLength": 1 },
309
+ "effort": { "type": "string" }
310
+ }
311
+ }
312
+ }
313
+ }
314
+ },
315
+ "thresholdBand": {
316
+ "type": "object",
317
+ "additionalProperties": false,
318
+ "properties": {
319
+ "act": { "type": "number", "minimum": 0, "maximum": 1 },
320
+ "check": { "type": "number", "minimum": 0, "maximum": 1 },
321
+ "close_margin": { "type": "number", "minimum": 0, "maximum": 1 }
322
+ }
323
+ },
324
+ "argvOrNull": {
325
+ "anyOf": [
326
+ { "type": "array", "minItems": 1, "items": { "type": "string", "minLength": 1 } },
327
+ { "type": "null" }
328
+ ]
329
+ }
330
+ }
331
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://code-forge.dev/schema/facts.schema.json",
4
+ "title": "code-forge facts delegate answer",
5
+ "description": "Plan v1.3 §3.8 step 3: the L0 facts delegate's answer. One row per claim token: the read-only command it ran, the output line it quotes, and a tag. A VERIFIED row must quote a non-empty excerpt; `why` says why a claim is UNVERIFIABLE (null otherwise).",
6
+ "type": "object",
7
+ "properties": {
8
+ "facts": {
9
+ "type": "array",
10
+ "items": {
11
+ "type": "object",
12
+ "properties": {
13
+ "fact_id": { "type": "string", "pattern": "^F[0-9]+$" },
14
+ "claim": { "type": "string", "minLength": 1 },
15
+ "kind": { "type": "string", "enum": ["flag", "command", "path", "version", "endpoint", "package", "env"] },
16
+ "command": { "type": "string" },
17
+ "output_excerpt": { "type": "string", "maxLength": 200 },
18
+ "tag": { "type": "string", "enum": ["VERIFIED", "NOT-FOUND", "UNVERIFIABLE"] },
19
+ "why": { "type": ["string", "null"] }
20
+ },
21
+ "required": ["fact_id", "claim", "kind", "command", "output_excerpt", "tag", "why"],
22
+ "additionalProperties": false
23
+ }
24
+ }
25
+ },
26
+ "required": ["facts"],
27
+ "additionalProperties": false
28
+ }