@srobroek/pi-code-challenge 0.0.0-stage → 2.0.3

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 (39) hide show
  1. package/CHANGELOG.md +80 -0
  2. package/LICENSE +202 -0
  3. package/README.md +73 -2
  4. package/agents/code-challenger.md +64 -0
  5. package/agents/refactor-challenger.md +81 -0
  6. package/extensions/index.js +3862 -0
  7. package/formulas/code-challenge.formula.toml +102 -0
  8. package/formulas/mol-challenge-challenge.formula.toml +66 -0
  9. package/formulas/mol-challenge-decide.formula.toml +58 -0
  10. package/formulas/mol-challenge-deliver.formula.toml +70 -0
  11. package/formulas/mol-challenge-intake.formula.toml +68 -0
  12. package/formulas/mol-challenge-lens.formula.toml +59 -0
  13. package/formulas/mol-challenge-refute.formula.toml +77 -0
  14. package/formulas/mol-challenge-research.formula.toml +61 -0
  15. package/formulas/mol-challenge-scan.formula.toml +61 -0
  16. package/package.json +38 -4
  17. package/skills/code-challenge/SKILL.md +83 -0
  18. package/skills/code-challenge/references/decide.md +31 -0
  19. package/skills/code-challenge/references/decisions.schema.json +21 -0
  20. package/skills/code-challenge/references/evidence.md +17 -0
  21. package/skills/code-challenge/references/intake-questions.md +49 -0
  22. package/skills/code-challenge/references/lens-dead-code.md +20 -0
  23. package/skills/code-challenge/references/lens-efficiency.md +21 -0
  24. package/skills/code-challenge/references/lens-hand-rolled-library.md +18 -0
  25. package/skills/code-challenge/references/lens-hand-rolled-stdlib.md +20 -0
  26. package/skills/code-challenge/references/lens-observability.md +20 -0
  27. package/skills/code-challenge/references/lens-optimisation.md +20 -0
  28. package/skills/code-challenge/references/lens-over-engineering.md +21 -0
  29. package/skills/code-challenge/references/lens-performance.md +18 -0
  30. package/skills/code-challenge/references/lens-scope.md +31 -0
  31. package/skills/code-challenge/references/lens-simplification.md +23 -0
  32. package/skills/code-challenge/references/lens-stability.md +21 -0
  33. package/skills/code-challenge/references/lens-structure.md +26 -0
  34. package/skills/code-challenge/references/lens-tests.md +20 -0
  35. package/skills/code-challenge/references/library-scoring.md +54 -0
  36. package/skills/code-challenge/references/report.schema.json +125 -0
  37. package/skills/code-challenge/references/run-storage.md +22 -0
  38. package/skills/code-challenge/references/scan.md +36 -0
  39. package/skills/code-challenge/references/schemas.md +37 -0
@@ -0,0 +1,102 @@
1
+ # code-challenge -- a full run: INTAKE, SCAN, CHALLENGE, RESEARCH, REFUTE, DECIDE, DELIVER
2
+ #
3
+ # Install: run the challenge_setup tool, which copies every code-challenge formula into
4
+ # <repo>/.beads/formulas/, or copy this file there (or into ~/.beads/formulas/).
5
+ # Pour a full run:
6
+ # bd mol pour code-challenge --var target=<paths> --var run_id=<run-id>
7
+ #
8
+ # Each phase is also a formula, mol-challenge-<phase>, that runs alone.
9
+ #
10
+ # PRECONDITION: the skills and agents named here ship in the code-challenge plugin
11
+ # (srobroek.code-challenge). Install it first.
12
+ #
13
+ # Evidence rule: every finding carries a tier -- proven, measured or hypothesis -- and a
14
+ # path:line locator. A speed claim without a measurement is a hypothesis.
15
+ formula = "code-challenge"
16
+ description = "Challenge {{target}} at depth {{depth}} in {{mode}} mode: seven phases from intake to a delivered report (run {{run_id}})"
17
+ type = "workflow"
18
+
19
+ [vars.target]
20
+ required = true
21
+ description = "paths, packages or diff range under challenge"
22
+
23
+ [vars.run_id]
24
+ required = true
25
+ description = "run id; the run directory is <git-dir>/code-challenge/<run-id>/"
26
+
27
+ [vars.depth]
28
+ default = "standard"
29
+ description = "quick, standard or deep"
30
+
31
+ [vars.mode]
32
+ default = "interactive"
33
+ description = "interactive or autonomous"
34
+
35
+ [[steps]]
36
+ id = "intake"
37
+ title = "INTAKE the scope of {{target}}"
38
+ type = "task"
39
+ labels = ["code-challenge", "phase:intake"]
40
+ description = """
41
+ Run the code-challenge skill, phase INTAKE, for run {{run_id}} in {{mode}} mode at depth {{depth}}. Write intake.json and log the pluggability answer and its signal.
42
+ """
43
+
44
+ [[steps]]
45
+ id = "scan"
46
+ title = "SCAN {{target}} with the repository's analyzers"
47
+ type = "task"
48
+ needs = ["intake"]
49
+ labels = ["code-challenge", "phase:scan"]
50
+ description = """
51
+ Run the code-challenge skill, phase SCAN: references/scan.md analyzers, hits tagged by rule_enabled_in_repo, scan.json written. Depth quick skips analyzers that need a build.
52
+ """
53
+
54
+ [[steps]]
55
+ id = "challenge"
56
+ title = "CHALLENGE {{target}} with one lens scout per lens"
57
+ type = "task"
58
+ needs = ["scan"]
59
+ labels = ["code-challenge", "phase:challenge"]
60
+ description = """
61
+ Run the code-challenge skill, phase CHALLENGE: you (the lead) bond mol-challenge-lens once per selected lens, in parallel. When the host caps parallel subagents, group related lenses (simplification, over-engineering and dead-code; scope alone; optimisation, performance and efficiency; the rest by pairs), bond once per group with a comma-separated lens var, and run the groups one after another. Then merge the replies into findings.json with a tier, a locator and test protection on every finding. The scouts only analyse; you spawn them and write the file.
62
+ """
63
+
64
+ [[steps]]
65
+ id = "research"
66
+ title = "RESEARCH library candidates"
67
+ type = "task"
68
+ needs = ["challenge"]
69
+ labels = ["code-challenge", "phase:research"]
70
+ description = """
71
+ Run the code-challenge skill, phase RESEARCH: 2 to 4 candidates per library finding, scored with references/library-scoring.md, gates first. Skip at depth quick and record why.
72
+ """
73
+
74
+ [[steps]]
75
+ id = "refute"
76
+ title = "REFUTE the findings with refactor-challenger"
77
+ type = "task"
78
+ needs = ["research"]
79
+ labels = ["code-challenge", "phase:refute"]
80
+ description = """
81
+ Run the code-challenge skill, phase REFUTE: you (the lead) send refactor-challenger a brief of observable facts only, then write verdicts.json from its reply. The critic only judges; you write the file. Skip at depth quick and record why.
82
+ """
83
+
84
+ [[steps]]
85
+ id = "decide"
86
+ title = "DECIDE which findings to accept"
87
+ type = "task"
88
+ needs = ["refute"]
89
+ labels = ["code-challenge", "phase:decide"]
90
+ description = """
91
+ Run the code-challenge skill, phase DECIDE in {{mode}} mode: question batches of up to 12 when interactive (the tool references/decide.md names); the autonomous rule (kept, proven or measured, low blast radius, contract kept, not a scope finding) otherwise. Every choice goes to decisions.jsonl.
92
+ """
93
+
94
+ [[steps]]
95
+ id = "deliver"
96
+ title = "DELIVER the report for run {{run_id}}"
97
+ type = "task"
98
+ needs = ["decide"]
99
+ labels = ["code-challenge", "phase:deliver"]
100
+ description = """
101
+ Run the code-challenge skill, phase DELIVER: report.json and decisions.jsonl validated against their schemas, the report printed in chat, an epic and child beads for accepted findings at depth standard and deep, the comment drafted and never posted without confirmation.
102
+ """
@@ -0,0 +1,66 @@
1
+ # mol-challenge-challenge -- the CHALLENGE phase of a code-challenge run, runnable alone
2
+ #
3
+ # Install: run the challenge_setup tool, which copies every code-challenge formula into
4
+ # <repo>/.beads/formulas/, or copy this file there (or into ~/.beads/formulas/).
5
+ # Pour one phase:
6
+ # bd mol pour mol-challenge-challenge --var target=<paths> --var run_id=<run-id> --var depth=<depth> --var mode=<mode>
7
+ #
8
+ # The phase needs the earlier phases' files in the run directory; each file is named in the
9
+ # code-challenge skill's references/run-storage.md. The vars have no defaults because bd mol bond
10
+ # does not apply them.
11
+ #
12
+ # PRECONDITION: the skills and agents named here ship in the code-challenge plugin
13
+ # (srobroek.code-challenge). Install it first.
14
+ #
15
+ # Evidence rule: every finding carries a tier -- proven, measured or hypothesis -- and a
16
+ # path:line locator. A speed claim without a measurement is a hypothesis.
17
+ formula = "mol-challenge-challenge"
18
+ description = "Run the CHALLENGE phase for {{target}}: one lens scout per selected lens, merged into findings with evidence"
19
+ type = "workflow"
20
+
21
+ [vars.target]
22
+ required = true
23
+ description = "paths, packages or diff range under challenge"
24
+
25
+ [vars.run_id]
26
+ required = true
27
+ description = "run id; the run directory is <git-dir>/code-challenge/<run-id>/"
28
+
29
+ [vars.depth]
30
+ required = true
31
+ description = "quick, standard or deep"
32
+
33
+ [vars.mode]
34
+ required = true
35
+ description = "interactive or autonomous"
36
+
37
+ [[steps]]
38
+ id = "dispatch-scouts"
39
+ title = "DISPATCH one mol-challenge-lens per lens"
40
+ type = "task"
41
+ labels = ["code-challenge", "sub:challenge", "phase:challenge"]
42
+ description = """
43
+ Run the code-challenge skill, phase CHALLENGE, from run {{run_id}}. You (the lead) do the
44
+ dispatching: for each lens selected in intake.json, bond mol-challenge-lens in parallel with
45
+ --var lens=<lens> --var target={{target}} --var run_id={{run_id}}, and put the scan hits for that
46
+ lens, the frozen surfaces and the benchmark allowance in the bead. The scouts only analyse and
47
+ reply; they spawn nothing and write nothing. When the host caps parallel subagents, group related
48
+ lenses (simplification, over-engineering and dead-code; scope alone; optimisation, performance and efficiency;
49
+ the rest by pairs), bond once per group with a comma-separated --var lens=<lens>,<lens>, and run the
50
+ groups one after another. Log the grouping as a choice line in decisions.jsonl. The scope lens bead
51
+ also carries the design sources from intake.json.
52
+ """
53
+
54
+ [[steps]]
55
+ id = "merge-findings"
56
+ title = "MERGE the scout replies into findings.json"
57
+ type = "task"
58
+ needs = ["dispatch-scouts"]
59
+ labels = ["code-challenge", "sub:challenge", "phase:challenge"]
60
+ description = """
61
+ You (the lead) write findings.json from the scout replies. Collapse one root cause into one finding with a recurrence count. Every finding carries a lens,
62
+ a path:line locator, an impact, a blast radius, an evidence tier (proven, measured or hypothesis)
63
+ and, for simplification, library and structure findings, test protection (protected, partial or
64
+ unprotected). Apply the abstraction-seam rule: no pluggability signal means extra abstraction is
65
+ an over-engineering finding. Never upgrade a tier because lenses agree. Write findings.json.
66
+ """
@@ -0,0 +1,58 @@
1
+ # mol-challenge-decide -- the DECIDE phase of a code-challenge run, runnable alone
2
+ #
3
+ # Install: run the challenge_setup tool, which copies every code-challenge formula into
4
+ # <repo>/.beads/formulas/, or copy this file there (or into ~/.beads/formulas/).
5
+ # Pour one phase:
6
+ # bd mol pour mol-challenge-decide --var target=<paths> --var run_id=<run-id> --var depth=<depth> --var mode=<mode>
7
+ #
8
+ # The phase needs the earlier phases' files in the run directory; each file is named in the
9
+ # code-challenge skill's references/run-storage.md. The vars have no defaults because bd mol bond
10
+ # does not apply them.
11
+ #
12
+ # PRECONDITION: the skills and agents named here ship in the code-challenge plugin
13
+ # (srobroek.code-challenge). Install it first.
14
+ #
15
+ # Evidence rule: every finding carries a tier -- proven, measured or hypothesis -- and a
16
+ # path:line locator. A speed claim without a measurement is a hypothesis.
17
+ formula = "mol-challenge-decide"
18
+ description = "Run the DECIDE phase for {{target}}: the user, or the autonomous rule, accepts, defers or rejects each finding"
19
+ type = "workflow"
20
+
21
+ [vars.target]
22
+ required = true
23
+ description = "paths, packages or diff range under challenge"
24
+
25
+ [vars.run_id]
26
+ required = true
27
+ description = "run id; the run directory is <git-dir>/code-challenge/<run-id>/"
28
+
29
+ [vars.depth]
30
+ required = true
31
+ description = "quick, standard or deep"
32
+
33
+ [vars.mode]
34
+ required = true
35
+ description = "interactive or autonomous"
36
+
37
+ [[steps]]
38
+ id = "offer-or-apply-rule"
39
+ title = "DECIDE which findings to accept"
40
+ type = "task"
41
+ labels = ["code-challenge", "sub:decide", "phase:decide"]
42
+ description = """
43
+ Run the code-challenge skill, phase DECIDE, from run {{run_id}}, in {{mode}} mode. Interactive:
44
+ offer the surviving findings to the user with the question tool references/decide.md names, in batches of up to 12, highest impact first.
45
+ Autonomous: accept only a finding that REFUTE kept, whose evidence is proven or measured, whose
46
+ blast radius is low, that keeps its contract and that is not a scope finding; defer the rest. Never ask in autonomous mode.
47
+ """
48
+
49
+ [[steps]]
50
+ id = "log-decisions"
51
+ title = "LOG every decision"
52
+ type = "task"
53
+ needs = ["offer-or-apply-rule"]
54
+ labels = ["code-challenge", "sub:decide", "phase:decide"]
55
+ description = """
56
+ Set status and decided_by on every finding and append one decisions.jsonl line per finding, plus
57
+ a line for every blocker, ambiguity and choice made on the way. The log is append-only.
58
+ """
@@ -0,0 +1,70 @@
1
+ # mol-challenge-deliver -- the DELIVER phase of a code-challenge run, runnable alone
2
+ #
3
+ # Install: run the challenge_setup tool, which copies every code-challenge formula into
4
+ # <repo>/.beads/formulas/, or copy this file there (or into ~/.beads/formulas/).
5
+ # Pour one phase:
6
+ # bd mol pour mol-challenge-deliver --var target=<paths> --var run_id=<run-id> --var depth=<depth> --var mode=<mode>
7
+ #
8
+ # The phase needs the earlier phases' files in the run directory; each file is named in the
9
+ # code-challenge skill's references/run-storage.md. The vars have no defaults because bd mol bond
10
+ # does not apply them.
11
+ #
12
+ # PRECONDITION: the skills and agents named here ship in the code-challenge plugin
13
+ # (srobroek.code-challenge). Install it first.
14
+ #
15
+ # Evidence rule: every finding carries a tier -- proven, measured or hypothesis -- and a
16
+ # path:line locator. A speed claim without a measurement is a hypothesis.
17
+ formula = "mol-challenge-deliver"
18
+ description = "Run the DELIVER phase for {{target}}: report, decisions log, beads for accepted findings, a drafted comment"
19
+ type = "workflow"
20
+
21
+ [vars.target]
22
+ required = true
23
+ description = "paths, packages or diff range under challenge"
24
+
25
+ [vars.run_id]
26
+ required = true
27
+ description = "run id; the run directory is <git-dir>/code-challenge/<run-id>/"
28
+
29
+ [vars.depth]
30
+ required = true
31
+ description = "quick, standard or deep"
32
+
33
+ [vars.mode]
34
+ required = true
35
+ description = "interactive or autonomous"
36
+
37
+ [[steps]]
38
+ id = "write-report"
39
+ title = "WRITE report.json and report.md"
40
+ type = "task"
41
+ labels = ["code-challenge", "sub:deliver", "phase:deliver"]
42
+ description = """
43
+ Run the code-challenge skill, phase DELIVER, from run {{run_id}}. Write report.json and validate it
44
+ against references/report.schema.json; validate every decisions.jsonl line against
45
+ references/decisions.schema.json. Print report.md in chat with the run directory path. List every
46
+ gap: missing analyzers, benchmarks not run, areas not read.
47
+ """
48
+
49
+ [[steps]]
50
+ id = "file-beads"
51
+ title = "FILE the epic and one child bead per accepted finding"
52
+ type = "task"
53
+ needs = ["write-report"]
54
+ labels = ["code-challenge", "sub:deliver", "phase:deliver"]
55
+ description = """
56
+ At depth standard and deep, create one epic bead for run {{run_id}} and one child per accepted
57
+ finding with its evidence, proposal and test protection. Without bd, say so in the report gaps.
58
+ This skill changes no source file: the coder takes the beads after approval.
59
+ """
60
+
61
+ [[steps]]
62
+ id = "draft-comment"
63
+ title = "DRAFT the PR or MR comment"
64
+ type = "task"
65
+ needs = ["file-beads"]
66
+ labels = ["code-challenge", "sub:deliver", "phase:deliver"]
67
+ description = """
68
+ Draft the comment when the target is a branch with an open PR. Post it only after the user
69
+ confirms. Autonomous mode never posts: leave the draft in report.json.
70
+ """
@@ -0,0 +1,68 @@
1
+ # mol-challenge-intake -- the INTAKE phase of a code-challenge run, runnable alone
2
+ #
3
+ # Install: run the challenge_setup tool, which copies every code-challenge formula into
4
+ # <repo>/.beads/formulas/, or copy this file there (or into ~/.beads/formulas/).
5
+ # Pour one phase:
6
+ # bd mol pour mol-challenge-intake --var target=<paths> --var run_id=<run-id> --var depth=<depth> --var mode=<mode>
7
+ #
8
+ # The phase needs the earlier phases' files in the run directory; each file is named in the
9
+ # code-challenge skill's references/run-storage.md. The vars have no defaults because bd mol bond
10
+ # does not apply them.
11
+ #
12
+ # PRECONDITION: the skills and agents named here ship in the code-challenge plugin
13
+ # (srobroek.code-challenge). Install it first.
14
+ #
15
+ # Evidence rule: every finding carries a tier -- proven, measured or hypothesis -- and a
16
+ # path:line locator. A speed claim without a measurement is a hypothesis.
17
+ formula = "mol-challenge-intake"
18
+ description = "Run the INTAKE phase for {{target}}: ask or infer the scope, depth, lenses, pluggability and frozen surfaces"
19
+ type = "workflow"
20
+
21
+ [vars.target]
22
+ required = true
23
+ description = "paths, packages or diff range under challenge"
24
+
25
+ [vars.run_id]
26
+ required = true
27
+ description = "run id; the run directory is <git-dir>/code-challenge/<run-id>/"
28
+
29
+ [vars.depth]
30
+ required = true
31
+ description = "quick, standard or deep"
32
+
33
+ [vars.mode]
34
+ required = true
35
+ description = "interactive or autonomous"
36
+
37
+ [[steps]]
38
+ id = "ask-or-infer"
39
+ title = "ASK or INFER the intake answers for {{target}}"
40
+ type = "task"
41
+ labels = ["code-challenge", "sub:intake", "phase:intake"]
42
+ description = """
43
+ Run the code-challenge skill, phase INTAKE, in {{mode}} mode at depth {{depth}}. Interactive:
44
+ ask the batch in references/intake-questions.md through parley_ask, falling back to the host's ask
45
+ tool (`question` in OpenCode), each question with a recommended answer. Autonomous: infer every answer from the arguments
46
+ and the repository, and ask only for a missing target or depth.
47
+
48
+ Question 4 (is pluggability expected) decides how the structure and over-engineering lenses
49
+ treat abstraction seams. Autonomous mode answers it from the signals listed in the reference and
50
+ logs the signal it used. With no signal the answer is no.
51
+
52
+ Question 9 (design sources) feeds the scope lens. Autonomous mode collects the specs, docs, ADRs,
53
+ bead fields and PR description that cover the target, logs each one, and answers "none" when it
54
+ finds none.
55
+ """
56
+
57
+ [[steps]]
58
+ id = "record-intake"
59
+ title = "RECORD intake.json for run {{run_id}}"
60
+ type = "task"
61
+ needs = ["ask-or-infer"]
62
+ labels = ["code-challenge", "sub:intake", "phase:intake"]
63
+ description = """
64
+ Resolve the run directory with git rev-parse --git-dir, create
65
+ <git-dir>/code-challenge/{{run_id}}/ and write intake.json: target, depth, lenses, pluggable with its
66
+ signal, frozen surfaces, benchmark allowance, test command, delivery choices and design sources. Append one
67
+ decisions.jsonl line per inference or user answer, with the phase INTAKE.
68
+ """
@@ -0,0 +1,59 @@
1
+ # mol-challenge-lens -- one lens of the CHALLENGE phase, bonded once per lens by mol-challenge-challenge
2
+ #
3
+ # Install: run the challenge_setup tool, which copies every code-challenge formula into
4
+ # <repo>/.beads/formulas/, or copy this file there (or into ~/.beads/formulas/).
5
+ # Pour one phase:
6
+ # bd mol pour mol-challenge-lens --var lens=<lens> --var target=<paths> --var run_id=<run-id>
7
+ #
8
+ # The phase needs the earlier phases' files in the run directory; each file is named in the
9
+ # code-challenge skill's references/run-storage.md. The vars have no defaults because bd mol bond
10
+ # does not apply them.
11
+ #
12
+ # PRECONDITION: the skills and agents named here ship in the code-challenge plugin
13
+ # (srobroek.code-challenge). Install it first.
14
+ #
15
+ # Evidence rule: every finding carries a tier -- proven, measured or hypothesis -- and a
16
+ # path:line locator. A speed claim without a measurement is a hypothesis.
17
+ formula = "mol-challenge-lens"
18
+ description = "Analyse {{target}} through the {{lens}} lens for run {{run_id}}: a read-only scout replies with findings, the lead records them"
19
+ type = "workflow"
20
+
21
+ [vars.lens]
22
+ required = true
23
+ description = "one lens id, for example simplification or hand-rolled-library, or a comma-separated group of lens ids when scouts are grouped"
24
+
25
+ [vars.target]
26
+ required = true
27
+ description = "paths, packages or diff range under challenge"
28
+
29
+ [vars.run_id]
30
+ required = true
31
+ description = "run id; the run directory is <git-dir>/code-challenge/<run-id>/"
32
+
33
+ [[steps]]
34
+ id = "analyse-lens"
35
+ title = "ANALYSE {{target}} through the {{lens}} lens"
36
+ type = "task"
37
+ labels = ["code-challenge", "sub:challenge", "phase:challenge"]
38
+ description = """
39
+ Read the references/lens-<lens>.md file of the code-challenge skill for each lens in {{lens}}, and the steering skills each
40
+ names. Read the target {{target}} and the scan hits in this bead. Reply with findings, one per root
41
+ cause: lens, path:line, claim, evidence tier and detail, impact, blast radius and test protection.
42
+ End the reply with a `References read:` line listing the absolute paths you read first. Read only: return the findings in your reply and leave recording them to the lead.
43
+ """
44
+
45
+ [steps.metadata]
46
+ execution_agent_type = "code-challenger"
47
+ execution_mode = "subagent"
48
+ requires_actions = "read, grep, glob, skill:code-challenge, skill:quality-code-policy"
49
+
50
+ [[steps]]
51
+ id = "record-findings"
52
+ title = "RECORD the {{lens}} findings"
53
+ type = "task"
54
+ needs = ["analyse-lens"]
55
+ labels = ["code-challenge", "sub:challenge", "phase:challenge"]
56
+ description = """
57
+ You (the lead) append the scout's findings for {{lens}} to the CHALLENGE working set, and log a
58
+ decisions.jsonl line for every ambiguity the scout reported.
59
+ """
@@ -0,0 +1,77 @@
1
+ # mol-challenge-refute -- the REFUTE phase of a code-challenge run, runnable alone
2
+ #
3
+ # Install: run the challenge_setup tool, which copies every code-challenge formula into
4
+ # <repo>/.beads/formulas/, or copy this file there (or into ~/.beads/formulas/).
5
+ # Pour one phase:
6
+ # bd mol pour mol-challenge-refute --var target=<paths> --var run_id=<run-id> --var depth=<depth> --var mode=<mode>
7
+ #
8
+ # The phase needs the earlier phases' files in the run directory; each file is named in the
9
+ # code-challenge skill's references/run-storage.md. The vars have no defaults because bd mol bond
10
+ # does not apply them.
11
+ #
12
+ # PRECONDITION: the skills and agents named here ship in the code-challenge plugin
13
+ # (srobroek.code-challenge). Install it first.
14
+ #
15
+ # Evidence rule: every finding carries a tier -- proven, measured or hypothesis -- and a
16
+ # path:line locator. A speed claim without a measurement is a hypothesis.
17
+ formula = "mol-challenge-refute"
18
+ description = "Run the REFUTE phase for {{target}}: a reviewer-tier critic attacks every finding"
19
+ type = "workflow"
20
+
21
+ [vars.target]
22
+ required = true
23
+ description = "paths, packages or diff range under challenge"
24
+
25
+ [vars.run_id]
26
+ required = true
27
+ description = "run id; the run directory is <git-dir>/code-challenge/<run-id>/"
28
+
29
+ [vars.depth]
30
+ required = true
31
+ description = "quick, standard or deep"
32
+
33
+ [vars.mode]
34
+ required = true
35
+ description = "interactive or autonomous"
36
+
37
+ [[steps]]
38
+ id = "brief-critic"
39
+ title = "BRIEF the critic"
40
+ type = "task"
41
+ labels = ["code-challenge", "sub:refute", "phase:refute"]
42
+ description = """
43
+ Run the code-challenge skill, phase REFUTE, from run {{run_id}}. You (the lead) put a brief of
44
+ observable facts only into the attack-findings bead: no conclusions of your own. Skip this phase at
45
+ depth quick. Do not question the user.
46
+ """
47
+
48
+ [[steps]]
49
+ id = "attack-findings"
50
+ title = "ATTACK each finding with refactor-challenger"
51
+ type = "task"
52
+ needs = ["brief-critic"]
53
+ labels = ["code-challenge", "sub:refute", "phase:refute"]
54
+ description = """
55
+ Read the brief in this bead: per finding the id, lens, locator, claim, tool or reading,
56
+ evidence, test protection and proposal, plus the scored candidates for library findings. Attack
57
+ each finding with the refactor-challenger protocol and reply with the verdict table. Read only;
58
+ the lead records your reply.
59
+ """
60
+
61
+ [steps.metadata]
62
+ execution_agent_type = "refactor-challenger"
63
+ execution_mode = "subagent"
64
+ requires_actions = "read, grep, glob, skill:code-challenge, skill:quality-code-policy"
65
+
66
+ [[steps]]
67
+ id = "apply-verdicts"
68
+ title = "APPLY the verdicts to findings.json"
69
+ type = "task"
70
+ needs = ["attack-findings"]
71
+ labels = ["code-challenge", "sub:refute", "phase:refute"]
72
+ description = """
73
+ You (the lead) write verdicts.json from the critic's reply with KEEP, DOWNGRADE or DROP and the cited rationale per finding. A DROP
74
+ leaves the offer list and is reported as dropped. A DOWNGRADE lowers impact or evidence tier as the
75
+ critic states. Record the critic's tier, blast_radius and changes_contract per finding; DECIDE reads those
76
+ in place of the scout's. Never override a verdict without a logged decisions.jsonl line.
77
+ """
@@ -0,0 +1,61 @@
1
+ # mol-challenge-research -- the RESEARCH phase of a code-challenge run, runnable alone
2
+ #
3
+ # Install: run the challenge_setup tool, which copies every code-challenge formula into
4
+ # <repo>/.beads/formulas/, or copy this file there (or into ~/.beads/formulas/).
5
+ # Pour one phase:
6
+ # bd mol pour mol-challenge-research --var target=<paths> --var run_id=<run-id> --var depth=<depth> --var mode=<mode>
7
+ #
8
+ # The phase needs the earlier phases' files in the run directory; each file is named in the
9
+ # code-challenge skill's references/run-storage.md. The vars have no defaults because bd mol bond
10
+ # does not apply them.
11
+ #
12
+ # PRECONDITION: the skills and agents named here ship in the code-challenge plugin
13
+ # (srobroek.code-challenge). Install it first.
14
+ #
15
+ # Evidence rule: every finding carries a tier -- proven, measured or hypothesis -- and a
16
+ # path:line locator. A speed claim without a measurement is a hypothesis.
17
+ formula = "mol-challenge-research"
18
+ description = "Run the RESEARCH phase for {{target}}: score 2 to 4 candidates per library finding with the weights and gates"
19
+ type = "workflow"
20
+
21
+ [vars.target]
22
+ required = true
23
+ description = "paths, packages or diff range under challenge"
24
+
25
+ [vars.run_id]
26
+ required = true
27
+ description = "run id; the run directory is <git-dir>/code-challenge/<run-id>/"
28
+
29
+ [vars.depth]
30
+ required = true
31
+ description = "quick, standard or deep"
32
+
33
+ [vars.mode]
34
+ required = true
35
+ description = "interactive or autonomous"
36
+
37
+ [[steps]]
38
+ id = "gather-facts"
39
+ title = "GATHER library facts for each library finding"
40
+ type = "task"
41
+ labels = ["code-challenge", "sub:research", "phase:research"]
42
+ description = """
43
+ Run the code-challenge skill, phase RESEARCH, from run {{run_id}}. For every hand-rolled-library
44
+ finding, and at depth deep for every direct dependency used for one or two functions, pick 2 to 4
45
+ candidates plus "keep what exists". Collect facts with challenge_lib_facts when it is in the tool
46
+ list (it ships in a later PR); otherwise fetch the registry page and the OSV record (`read` in OMP) and
47
+ cite each URL. Use context7 for API coverage. Skip this phase at depth quick.
48
+ """
49
+
50
+ [[steps]]
51
+ id = "score-candidates"
52
+ title = "SCORE the candidates and write research.json"
53
+ type = "task"
54
+ needs = ["gather-facts"]
55
+ labels = ["code-challenge", "sub:research", "phase:research"]
56
+ description = """
57
+ Apply references/library-scoring.md: the two hard gates (an unpatched CVE, an incompatible
58
+ licence), then the weights fit, compat, stability, maintained, popularity, footprint and migration.
59
+ Maintenance is a weighted signal, never a gate. Evaluate partial adoption plus an extension. Record
60
+ per-criterion values, gate results and the baseline score of the existing code.
61
+ """
@@ -0,0 +1,61 @@
1
+ # mol-challenge-scan -- the SCAN phase of a code-challenge run, runnable alone
2
+ #
3
+ # Install: run the challenge_setup tool, which copies every code-challenge formula into
4
+ # <repo>/.beads/formulas/, or copy this file there (or into ~/.beads/formulas/).
5
+ # Pour one phase:
6
+ # bd mol pour mol-challenge-scan --var target=<paths> --var run_id=<run-id> --var depth=<depth> --var mode=<mode>
7
+ #
8
+ # The phase needs the earlier phases' files in the run directory; each file is named in the
9
+ # code-challenge skill's references/run-storage.md. The vars have no defaults because bd mol bond
10
+ # does not apply them.
11
+ #
12
+ # PRECONDITION: the skills and agents named here ship in the code-challenge plugin
13
+ # (srobroek.code-challenge). Install it first.
14
+ #
15
+ # Evidence rule: every finding carries a tier -- proven, measured or hypothesis -- and a
16
+ # path:line locator. A speed claim without a measurement is a hypothesis.
17
+ formula = "mol-challenge-scan"
18
+ description = "Run the SCAN phase for {{target}}: existing analyzers only, hits tagged by whether the repository enables the rule"
19
+ type = "workflow"
20
+
21
+ [vars.target]
22
+ required = true
23
+ description = "paths, packages or diff range under challenge"
24
+
25
+ [vars.run_id]
26
+ required = true
27
+ description = "run id; the run directory is <git-dir>/code-challenge/<run-id>/"
28
+
29
+ [vars.depth]
30
+ required = true
31
+ description = "quick, standard or deep"
32
+
33
+ [vars.mode]
34
+ required = true
35
+ description = "interactive or autonomous"
36
+
37
+ [[steps]]
38
+ id = "run-analyzers"
39
+ title = "RUN the analyzers for {{target}}"
40
+ type = "task"
41
+ labels = ["code-challenge", "sub:scan", "phase:scan"]
42
+ description = """
43
+ Run the code-challenge skill, phase SCAN, from run {{run_id}}. Read intake.json, then run the
44
+ analyzers in references/scan.md for each language in the target, with an isolated lens profile
45
+ that respects the repository's suppressions. At depth quick skip every analyzer that needs a
46
+ build. Run them with challenge_scan. It runs recipes that execute repository or downloaded code only
47
+ with allowCode: true; pass it only for a repository the user trusts or after asking them, and
48
+ otherwise report those recipes as gaps. A missing analyzer is a gap; never install anything.
49
+ """
50
+
51
+ [[steps]]
52
+ id = "write-scan"
53
+ title = "WRITE scan.json"
54
+ type = "task"
55
+ needs = ["run-analyzers"]
56
+ labels = ["code-challenge", "sub:scan", "phase:scan"]
57
+ description = """
58
+ Normalise every hit to tool, rule, path:line, message and rule_enabled_in_repo (false hits are
59
+ tagged "rule not enabled in repo"). List each analyzer that could not run as a gap. A hit is a lead
60
+ for CHALLENGE, never a finding.
61
+ """
package/package.json CHANGED
@@ -1,6 +1,40 @@
1
1
  {
2
2
  "name": "@srobroek/pi-code-challenge",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "2.0.3",
4
+ "description": "Challenge code for simplification, performance, stability, hand-rolled code and structure, with evidence for every finding.",
5
+ "keywords": [
6
+ "pi-package"
7
+ ],
8
+ "license": "Apache-2.0",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/srobroek/harness-plugins.git",
12
+ "directory": "plugins/code-challenge/pi"
13
+ },
14
+ "files": [
15
+ "CHANGELOG.md",
16
+ "LICENSE",
17
+ "README.md",
18
+ "agents",
19
+ "extensions",
20
+ "formulas",
21
+ "skills"
22
+ ],
23
+ "publishConfig": {
24
+ "access": "public",
25
+ "provenance": true
26
+ },
27
+ "pi": {
28
+ "extensions": [
29
+ "./extensions/index.js"
30
+ ],
31
+ "skills": [
32
+ "./skills"
33
+ ],
34
+ "subagents": {
35
+ "agents": [
36
+ "./agents"
37
+ ]
38
+ }
39
+ }
40
+ }