@phamvuhoang/otto-core 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 (103) hide show
  1. package/README.md +53 -0
  2. package/dist/branch.d.ts +61 -0
  3. package/dist/branch.d.ts.map +1 -0
  4. package/dist/branch.js +215 -0
  5. package/dist/branch.js.map +1 -0
  6. package/dist/cli-help.d.ts +68 -0
  7. package/dist/cli-help.d.ts.map +1 -0
  8. package/dist/cli-help.js +365 -0
  9. package/dist/cli-help.js.map +1 -0
  10. package/dist/detach.d.ts +36 -0
  11. package/dist/detach.d.ts.map +1 -0
  12. package/dist/detach.js +52 -0
  13. package/dist/detach.js.map +1 -0
  14. package/dist/gh-main.d.ts +5 -0
  15. package/dist/gh-main.d.ts.map +1 -0
  16. package/dist/gh-main.js +16 -0
  17. package/dist/gh-main.js.map +1 -0
  18. package/dist/git.d.ts +14 -0
  19. package/dist/git.d.ts.map +1 -0
  20. package/dist/git.js +50 -0
  21. package/dist/git.js.map +1 -0
  22. package/dist/index.d.ts +8 -0
  23. package/dist/index.d.ts.map +1 -0
  24. package/dist/index.js +8 -0
  25. package/dist/index.js.map +1 -0
  26. package/dist/keepalive.d.ts +24 -0
  27. package/dist/keepalive.d.ts.map +1 -0
  28. package/dist/keepalive.js +138 -0
  29. package/dist/keepalive.js.map +1 -0
  30. package/dist/loop.d.ts +42 -0
  31. package/dist/loop.d.ts.map +1 -0
  32. package/dist/loop.js +238 -0
  33. package/dist/loop.js.map +1 -0
  34. package/dist/main.d.ts +5 -0
  35. package/dist/main.d.ts.map +1 -0
  36. package/dist/main.js +16 -0
  37. package/dist/main.js.map +1 -0
  38. package/dist/notify.d.ts +28 -0
  39. package/dist/notify.d.ts.map +1 -0
  40. package/dist/notify.js +119 -0
  41. package/dist/notify.js.map +1 -0
  42. package/dist/pacing.d.ts +8 -0
  43. package/dist/pacing.d.ts.map +1 -0
  44. package/dist/pacing.js +33 -0
  45. package/dist/pacing.js.map +1 -0
  46. package/dist/panel.d.ts +24 -0
  47. package/dist/panel.d.ts.map +1 -0
  48. package/dist/panel.js +202 -0
  49. package/dist/panel.js.map +1 -0
  50. package/dist/rate-limit.d.ts +16 -0
  51. package/dist/rate-limit.d.ts.map +1 -0
  52. package/dist/rate-limit.js +35 -0
  53. package/dist/rate-limit.js.map +1 -0
  54. package/dist/render.d.ts +8 -0
  55. package/dist/render.d.ts.map +1 -0
  56. package/dist/render.js +130 -0
  57. package/dist/render.js.map +1 -0
  58. package/dist/retry.d.ts +17 -0
  59. package/dist/retry.d.ts.map +1 -0
  60. package/dist/retry.js +34 -0
  61. package/dist/retry.js.map +1 -0
  62. package/dist/run-bin.d.ts +35 -0
  63. package/dist/run-bin.d.ts.map +1 -0
  64. package/dist/run-bin.js +241 -0
  65. package/dist/run-bin.js.map +1 -0
  66. package/dist/runner.d.ts +55 -0
  67. package/dist/runner.d.ts.map +1 -0
  68. package/dist/runner.js +297 -0
  69. package/dist/runner.js.map +1 -0
  70. package/dist/stage-exec.d.ts +16 -0
  71. package/dist/stage-exec.d.ts.map +1 -0
  72. package/dist/stage-exec.js +35 -0
  73. package/dist/stage-exec.js.map +1 -0
  74. package/dist/stages.d.ts +38 -0
  75. package/dist/stages.d.ts.map +1 -0
  76. package/dist/stages.js +38 -0
  77. package/dist/stages.js.map +1 -0
  78. package/dist/state.d.ts +25 -0
  79. package/dist/state.d.ts.map +1 -0
  80. package/dist/state.js +30 -0
  81. package/dist/state.js.map +1 -0
  82. package/dist/stream-render.d.ts +68 -0
  83. package/dist/stream-render.d.ts.map +1 -0
  84. package/dist/stream-render.js +162 -0
  85. package/dist/stream-render.js.map +1 -0
  86. package/dist/watch.d.ts +22 -0
  87. package/dist/watch.d.ts.map +1 -0
  88. package/dist/watch.js +93 -0
  89. package/dist/watch.js.map +1 -0
  90. package/package.json +67 -0
  91. package/templates/afk.md +21 -0
  92. package/templates/apply-review.md +71 -0
  93. package/templates/ghafk-issue.md +29 -0
  94. package/templates/ghafk.md +29 -0
  95. package/templates/ghprompt-workflow.md +83 -0
  96. package/templates/ghprompt.md +39 -0
  97. package/templates/prompt.md +97 -0
  98. package/templates/review-lens.md +41 -0
  99. package/templates/review-synth.md +29 -0
  100. package/templates/review-verify.md +52 -0
  101. package/templates/review.md +62 -0
  102. package/templates/superpowers.md +70 -0
  103. package/templates/verify.md +74 -0
@@ -0,0 +1,21 @@
1
+ {{ RESUME }}
2
+
3
+ <commits>
4
+
5
+ !?`git log -n 5 --format="%H%n%ad%n%B---" --date=short|||No commits found`
6
+
7
+ </commits>
8
+
9
+ <learnings>
10
+
11
+ !?`cat ./.otto/LEARNINGS.md|||_No learnings recorded yet._`
12
+
13
+ </learnings>
14
+
15
+ <inputs>
16
+
17
+ {{ INPUTS }}
18
+
19
+ </inputs>
20
+
21
+ @include:prompt.md
@@ -0,0 +1,71 @@
1
+ {{ RESUME }}
2
+
3
+ <commits>
4
+
5
+ !?`git log -n 15 --format="%H%n%ad%n%B---" --date=short|||No commits found`
6
+
7
+ </commits>
8
+
9
+ <learnings>
10
+
11
+ !?`cat ./.otto/LEARNINGS.md|||_No learnings recorded yet._`
12
+
13
+ </learnings>
14
+
15
+ <existing-followups>
16
+
17
+ !?`cat ./.otto/review-followups.md|||_No follow-ups recorded yet._`
18
+
19
+ </existing-followups>
20
+
21
+ <review-doc>
22
+
23
+ {{ INPUTS }}
24
+
25
+ </review-doc>
26
+
27
+ # APPLY REVIEW
28
+
29
+ `<review-doc>` names a code-review document (a file path). `Read` it. It contains findings, usually with severities. Your job is to fix the actionable ones — ONE finding per iteration — and track the rest.
30
+
31
+ When every actionable finding has been addressed (fixed, or already fixed in git, or recorded as a follow-up), output `<promise>NO MORE TASKS</promise>`.
32
+
33
+ # TRIAGE
34
+
35
+ Classify each finding (judge from the review's own language — severity labels, "follow-up", "operational", "cosmetic", "low risk"):
36
+
37
+ - **Actionable** — a safe, in-scope correctness fix or cleanup (e.g. dead code, a clear bug, an incomplete cleanup). Fix it.
38
+ - **Deferred / follow-up** — perf optimisation, operational steps, or anything large/out-of-scope (e.g. "re-reads N days every pull", "backfill mandatory at deploy"). Do NOT implement now; record it (below).
39
+ - **Low / cosmetic / won't-fix** — note it in your commit body / final message with the reason; take no action.
40
+
41
+ # RECONCILE BEFORE FIXING
42
+
43
+ Before fixing a finding, check recent `git log` and the working tree — if it is already fixed, skip it (don't redo committed work). Treat the review as possibly stale.
44
+
45
+ # FIX ONE FINDING
46
+
47
+ Pick the highest-value actionable finding not yet addressed. Implement the fix. Run the feedback loops:
48
+
49
+ ### Frontend / Node
50
+
51
+ - `pnpm run test`, `pnpm run typecheck`
52
+
53
+ ### Backend / Dotnet
54
+
55
+ - `dotnet test`, `dotnet build`
56
+
57
+ # RECORD FOLLOW-UPS
58
+
59
+ For each Deferred / follow-up finding, append a terse entry to `./.otto/review-followups.md` (create it lazily). Use a dated `##` heading for this review, then one bullet per finding with its severity and why it is deferred. This file is git-tracked — commit it WITH the related fix (do not make a separate commit just for it).
60
+
61
+ # COMMIT
62
+
63
+ Make a single `git commit -am` with a short message:
64
+
65
+ - Subject (≤72 chars): `fix(review): <what changed>`
66
+ - Body: which finding (and its review section), key decision, and a one-line note of any follow-ups recorded.
67
+ - No file lists, no `Co-Authored-By`.
68
+
69
+ # FINAL RULES
70
+
71
+ ONLY ADDRESS A SINGLE FINDING per iteration.
@@ -0,0 +1,29 @@
1
+ <commits>
2
+
3
+ !?`git log -n 5 --format="%H%n%ad%n%B---" --date=short|||No commits found`
4
+
5
+ </commits>
6
+
7
+ <learnings>
8
+
9
+ !?`cat ./.otto/LEARNINGS.md|||_No learnings recorded yet._`
10
+
11
+ </learnings>
12
+
13
+ <issue>
14
+
15
+ !?`gh issue view "$OTTO_ISSUE" --json number,title,state|||Issue not found`
16
+
17
+ Full issue body + comments spilled to: @spill?:issue.json=`gh issue view "$OTTO_ISSUE" --json number,title,body,comments,state|||[]`
18
+
19
+ `Read` that file to get the full body and comments before acting on the issue.
20
+
21
+ </issue>
22
+
23
+ # THE TASK
24
+
25
+ Work **only** on issue #{{ INPUTS }} (shown above). Do not list, triage, or pick from any other open issues — this run is scoped to a single issue.
26
+
27
+ If issue #{{ INPUTS }} is already complete (closed, or there is no work left to do), output <promise>NO MORE TASKS</promise>.
28
+
29
+ @include:ghprompt-workflow.md
@@ -0,0 +1,29 @@
1
+ {{ RESUME }}
2
+
3
+ <commits>
4
+
5
+ !?`git log -n 5 --format="%H%n%ad%n%B---" --date=short|||No commits found`
6
+
7
+ </commits>
8
+
9
+ <learnings>
10
+
11
+ !?`cat ./.otto/LEARNINGS.md|||_No learnings recorded yet._`
12
+
13
+ </learnings>
14
+
15
+ <issues-summary>
16
+
17
+ `gh issue list --state open --limit 50 --json number,title,labels`
18
+
19
+ </issues-summary>
20
+
21
+ <issues-full-file>
22
+
23
+ Full issue bodies + comments spilled to: @spill?:issues.json=`gh issue list --state open --limit 50 --json number,title,body,labels,comments|||[]`
24
+
25
+ Read that file with `Read` (use `offset`/`limit` if it is large) to get bodies and comments before picking a task. The `<issues-summary>` block above is the lean index for triage.
26
+
27
+ </issues-full-file>
28
+
29
+ @include:ghprompt.md
@@ -0,0 +1,83 @@
1
+ @include:superpowers.md
2
+
3
+ # RECONCILE BEFORE SELECTING
4
+
5
+ Before picking an issue, reconcile against reality: check recent `git log` and the working
6
+ tree to see whether the work for an open issue is already implemented and committed. If it
7
+ is, close/comment on the issue rather than redoing the work. Treat issue checklists as
8
+ hints, not truth — committed code is done.
9
+
10
+ # EXPLORATION
11
+
12
+ Explore the repo.
13
+
14
+ # IMPLEMENTATION
15
+
16
+ Complete the task.
17
+
18
+ # FEEDBACK LOOPS
19
+
20
+ Before committing, run the feedback loops:
21
+
22
+ ### Frontend / Node
23
+
24
+ - `pnpm run test` to run the tests
25
+ - `pnpm run typecheck` to run the type checker
26
+
27
+ ### Backend / Dotnet
28
+
29
+ - `dotnet test` to run the tests
30
+ - `dotnet build` to type-check
31
+
32
+ **If `dotnet test` or `dotnet build` fails with MSB3248** ("Could not resolve assembly reference" / "file is corrupt") — this is a known virtiofs/9p I/O quirk when the repo is mounted from the Windows host. It is NOT a code defect. Do not defer verification. Re-run with build outputs redirected to `/tmp` and parallelism disabled:
33
+
34
+ ```bash
35
+ dotnet test <path-to-test-csproj> \
36
+ -m:1 \
37
+ /p:UseSharedCompilation=false \
38
+ /p:BuildInParallel=false \
39
+ /p:BaseIntermediateOutputPath=/tmp/otto-obj/$(basename <path-to-test-csproj> .csproj)/ \
40
+ /p:BaseOutputPath=/tmp/otto-bin/$(basename <path-to-test-csproj> .csproj)/
41
+ ```
42
+
43
+ Only if that second attempt also fails may you defer and record the blocker in the commit message.
44
+
45
+ # COMMIT
46
+
47
+ Make a single `git commit -am` with a short message:
48
+
49
+ - Subject line (≤72 chars): what changed
50
+ - Optional body (≤3 bullets): key decision, blocker for next iteration
51
+ - No file lists (git tracks them), no `Co-Authored-By`
52
+
53
+ # THE ISSUE
54
+
55
+ If the task is complete, close the original GitHub issue.
56
+
57
+ If the task is not complete, leave a comment on the GitHub issue with what was done.
58
+
59
+ # LEARNINGS
60
+
61
+ The repo's accumulated learnings are in the `<learnings>` block — durable, reusable knowledge from prior iterations (conventions, gotchas, decisions and their why, dead ends). Consult it during EXPLORATION and IMPLEMENTATION so you don't relearn what's known or repeat a dead end.
62
+
63
+ If, while doing the task, you discover a NEW durable, reusable learning — a repo convention, a non-obvious gotcha, a decision and its why, or a dead-end to avoid — append it tersely to the right section of `./.otto/LEARNINGS.md`. Create the file if it does not exist, with these four sections:
64
+
65
+ ```
66
+
67
+ # Otto learnings
68
+
69
+ ## Conventions
70
+
71
+ ## Gotchas
72
+
73
+ ## Decisions
74
+
75
+ ## Dead ends
76
+
77
+ ```
78
+
79
+ Dedupe against existing entries and prune anything no longer true. This file is committed WITH your task commit (it is git-tracked) — do NOT make a separate commit for it. The bar is durable AND reusable: do NOT record routine or one-off task details.
80
+
81
+ # FINAL RULES
82
+
83
+ ONLY WORK ON A SINGLE TASK.
@@ -0,0 +1,39 @@
1
+ # ISSUES
2
+
3
+ Two views of open GitHub issues are provided at the start of context:
4
+
5
+ - `<issues-summary>` — inline lean index (number, title, labels). Use this to triage and pick a task.
6
+ - `<issues-full-file>` — path to a spilled JSON file containing bodies + comments. `Read` that file (with `offset`/`limit` if it is large) once you have picked an issue you want to act on.
7
+
8
+ You will work on the AFK issues only, not the HITL ones. Label filtering uses the `labels` field in the summary.
9
+
10
+ You've also been passed a file containing the last few commits. Review these to understand what work has been done.
11
+
12
+ If all AFK tasks are complete, output <promise>NO MORE TASKS</promise>.
13
+
14
+ # TASK SELECTION
15
+
16
+ Pick the next task. Prioritize tasks in this order:
17
+
18
+ 1. Critical bugfixes
19
+ 2. Development infrastructure
20
+
21
+ Getting development infrastructure like tests and types and dev scripts ready is an important precursor to building features.
22
+
23
+ 3. Tracer bullets for new features
24
+
25
+ Tracer bullets are small slices of functionality that go through all layers of the system, allowing you to test and validate your approach early. This helps in identifying potential issues and ensures that the overall architecture is sound before investing significant time in development.
26
+
27
+ TL;DR - build a tiny, end-to-end slice of the feature first, then expand it out.
28
+
29
+ 4. Polish and quick wins
30
+ 5. Refactors
31
+
32
+ # RECONCILE BEFORE SELECTING
33
+
34
+ Before picking an issue, reconcile against reality: check recent `git log` and the working
35
+ tree to see whether the work for an open issue is already implemented and committed. If it
36
+ is, close/comment on the issue rather than redoing the work. Treat issue checklists as
37
+ hints, not truth — committed code is done.
38
+
39
+ @include:ghprompt-workflow.md
@@ -0,0 +1,97 @@
1
+ # PLAN / PRD
2
+
3
+ The plan and PRD are provided in the `<inputs>` block at the start of context — conventionally the paths to a plan file and a PRD file. `Read` them to get the work.
4
+
5
+ You've also been passed the last few commits in `<commits>`. Review them to understand what work has already been done.
6
+
7
+ Work through the plan/PRD tasks. If all of them are complete, output `<promise>NO MORE TASKS</promise>`.
8
+
9
+ @include:superpowers.md
10
+
11
+ # TASK SELECTION
12
+
13
+ Pick the next task. Prioritize tasks in this order:
14
+
15
+ 1. Critical bugfixes
16
+ 2. Development infrastructure
17
+
18
+ Getting development infrastructure like tests and types and dev scripts ready is an important precursor to building features.
19
+
20
+ 3. Tracer bullets for new features
21
+
22
+ Tracer bullets are small slices of functionality that go through all layers of the system, allowing you to test and validate your approach early. This helps in identifying potential issues and ensures that the overall architecture is sound before investing significant time in development.
23
+
24
+ TL;DR - build a tiny, end-to-end slice of the feature first, then expand it out.
25
+
26
+ 4. Polish and quick wins
27
+ 5. Refactors
28
+
29
+ # RECONCILE BEFORE SELECTING
30
+
31
+ Before picking a task, reconcile the plan against reality. Check recent `git log` and the
32
+ working tree to see which tasks are **already implemented and committed**. Treat plan-file
33
+ checkboxes as hints, NOT truth — code that is present and committed is done even if its box
34
+ is unticked. Skip anything already done. When you complete or confirm a task, flip its
35
+ checkbox as part of your commit so the plan converges to the truth.
36
+
37
+ # EXPLORATION
38
+
39
+ Explore the repo.
40
+
41
+ # IMPLEMENTATION
42
+
43
+ Complete the task.
44
+
45
+ # FEEDBACK LOOPS
46
+
47
+ Before committing, run the feedback loops:
48
+
49
+ ### Frontend / Node
50
+
51
+ - `pnpm run test` to run the tests
52
+ - `pnpm run typecheck` to run the type checker
53
+
54
+ ### Backend / Dotnet
55
+
56
+ - `dotnet test` to run the tests
57
+ - `dotnet build` to type-check
58
+
59
+ # COMMIT
60
+
61
+ Make a single `git commit -am` with a short message:
62
+
63
+ - Subject line (≤72 chars): what changed
64
+ - Optional body (≤3 bullets): key decision, blocker for next iteration
65
+ - No file lists (git tracks them), no `Co-Authored-By`
66
+
67
+ # RECORDING PROGRESS
68
+
69
+ When a task is complete, record the outcome in your commit body, and update the plan file's status if it tracks one.
70
+
71
+ If a task is not complete, record the blocker in the commit body so the next iteration can pick up where you left off.
72
+
73
+ # LEARNINGS
74
+
75
+ The repo's accumulated learnings are in the `<learnings>` block — durable, reusable knowledge from prior iterations (conventions, gotchas, decisions and their why, dead ends). Consult it during EXPLORATION and IMPLEMENTATION so you don't relearn what's known or repeat a dead end.
76
+
77
+ If, while doing the task, you discover a NEW durable, reusable learning — a repo convention, a non-obvious gotcha, a decision and its why, or a dead-end to avoid — append it tersely to the right section of `./.otto/LEARNINGS.md`. Create the file if it does not exist, with these four sections:
78
+
79
+ ```
80
+
81
+ # Otto learnings
82
+
83
+ ## Conventions
84
+
85
+ ## Gotchas
86
+
87
+ ## Decisions
88
+
89
+ ## Dead ends
90
+
91
+ ```
92
+
93
+ Dedupe against existing entries and prune anything no longer true. This file is committed WITH your task commit (it is git-tracked) — do NOT make a separate commit for it. The bar is durable AND reusable: do NOT record routine or one-off task details.
94
+
95
+ # FINAL RULES
96
+
97
+ ONLY WORK ON A SINGLE TASK.
@@ -0,0 +1,41 @@
1
+ <head>
2
+
3
+ !?`git rev-parse HEAD|||(no commits)`
4
+
5
+ </head>
6
+
7
+ <learnings>
8
+
9
+ !?`cat ./.otto/LEARNINGS.md|||_No learnings recorded yet._`
10
+
11
+ </learnings>
12
+
13
+ <latest-diff>
14
+
15
+ !?`git show --stat HEAD|||No diff`
16
+
17
+ Full patch spilled to: @spill?:head.diff=`git show HEAD|||No diff body`
18
+
19
+ Read that file with `Read` (use `offset`/`limit` for large diffs) before reviewing.
20
+
21
+ </latest-diff>
22
+
23
+ # REVIEWER — {{ LENS }} lens
24
+
25
+ You review the most recent commit (HEAD) through ONE lens only: **{{ LENS }}**.
26
+
27
+ - `correctness` — bugs, regressions, broken logic, unhandled edge cases.
28
+ - `security` — input validation, secrets, injection, auth bypass.
29
+ - `tests` — coverage gaps for the changed code; missing/weak assertions.
30
+
31
+ If `<head>` shows `(no commits)`, output `<lens>SKIP</lens>` and stop.
32
+
33
+ # OUTPUT
34
+
35
+ List concrete findings for the **{{ LENS }}** lens only, each as `- <file>:<line> — <issue>`. Be terse. If nothing for this lens, output `none`.
36
+
37
+ # RULES
38
+
39
+ - READ-ONLY. Do **not** edit files (including `./.otto/LEARNINGS.md`). Do **not** commit. Do **not** run feedback loops.
40
+ - Use the `<learnings>` block only to avoid flagging an already-accepted decision — never write to it.
41
+ - Only the {{ LENS }} lens — ignore issues another lens owns.
@@ -0,0 +1,29 @@
1
+ <head>
2
+
3
+ !?`git rev-parse HEAD|||(no commits)`
4
+
5
+ </head>
6
+
7
+ <learnings>
8
+
9
+ !?`cat ./.otto/LEARNINGS.md|||_No learnings recorded yet._`
10
+
11
+ </learnings>
12
+
13
+ # REVIEW SYNTHESIS
14
+
15
+ An adversarial verifier already judged the lens findings and wrote `{{ FINDINGS_DIR }}verdicts.md`. `Read` that file. Only lines marked **`CONFIRMED`** are real defects to fix; ignore every `REJECTED` line. If the file says `none` or contains no `CONFIRMED` lines, there is nothing to fix.
16
+
17
+ # ACTION
18
+
19
+ 1. Collect the `CONFIRMED` findings (already deduped and verified). If there are none, output `<review>OK</review>` and do **not** commit.
20
+ 2. Otherwise fix them in the working tree (only the latest commit's code — no unrelated changes), run the feedback loops:
21
+ - Frontend / Node: `pnpm run test`, `pnpm run typecheck`
22
+ - Backend / Dotnet: `dotnet test`, `dotnet build`
23
+ then make a SINGLE commit: `git commit -am "fix(review): <short reason>"` (subject ≤72 chars, no `Co-Authored-By`, no file lists). If a finding reflects a durable, reusable learning (e.g. a recurring defect class), you may also append it tersely to `./.otto/LEARNINGS.md` so it rides in this same commit.
24
+
25
+ # RULES
26
+
27
+ - Never amend the implementer's commit — always a new `fix(review):` commit.
28
+ - Trust the verifier's verdicts — do not re-litigate `REJECTED` findings or hunt for new ones.
29
+ - Single pass. Do not loop.
@@ -0,0 +1,52 @@
1
+ <head>
2
+
3
+ !?`git rev-parse HEAD|||(no commits)`
4
+
5
+ </head>
6
+
7
+ <learnings>
8
+
9
+ !?`cat ./.otto/LEARNINGS.md|||_No learnings recorded yet._`
10
+
11
+ </learnings>
12
+
13
+ <latest-diff>
14
+
15
+ !?`git show --stat HEAD|||No diff`
16
+
17
+ Full patch spilled to: @spill?:head.diff=`git show HEAD|||No diff body`
18
+
19
+ Read that file with `Read` (use `offset`/`limit` for large diffs) before judging.
20
+
21
+ </latest-diff>
22
+
23
+ # ADVERSARIAL VERIFICATION
24
+
25
+ Review lenses (correctness / security / tests) each examined HEAD and wrote findings to `{{ FINDINGS_DIR }}` — `Read` every `findings-*.md` file there.
26
+
27
+ Your role is the **SKEPTIC**. The lenses are eager: many findings will be false positives, speculative, pre-existing, out of scope, or things this repo already accepts. Try to **REFUTE** each finding against the actual HEAD diff and the surrounding code before any of them earns a fix.
28
+
29
+ For every distinct finding, decide:
30
+
31
+ - **CONFIRMED** — you verified, against the real changed code, that it is a genuine defect introduced by THIS commit.
32
+ - **REJECTED** — false positive, not reproducible, speculative, pre-existing (not introduced by HEAD), out of scope, or an already-accepted decision per `<learnings>`.
33
+
34
+ Bias toward **REJECTED** when genuinely uncertain: this loop commits fixes with no human in the loop, so a wrong or noisy fix costs more than a missed nit.
35
+
36
+ # OUTPUT
37
+
38
+ Write your verdicts to `{{ FINDINGS_DIR }}verdicts.md`, one finding per line, deduped:
39
+
40
+ ```
41
+ CONFIRMED — <file>:<line> — <issue> — <one line: why it is real>
42
+ REJECTED — <file>:<line> — <issue> — <one line: why not>
43
+ ```
44
+
45
+ If the lenses produced no findings at all, write a single line: `none`.
46
+
47
+ End your reply with a one-line tally: `<verify>C confirmed, R rejected</verify>`.
48
+
49
+ # RULES
50
+
51
+ - READ-ONLY except for writing `verdicts.md`. Do **not** edit tracked files. Do **not** commit. Do **not** run feedback loops.
52
+ - Judge only HEAD's changes. Ignore pre-existing issues the commit did not introduce.
@@ -0,0 +1,62 @@
1
+ <head>
2
+
3
+ !?`git rev-parse HEAD|||(no commits)`
4
+
5
+ </head>
6
+
7
+ <recent-commits>
8
+
9
+ !?`git log -n 3 --format="%H%n%ad%n%B---" --date=short|||No commits found`
10
+
11
+ </recent-commits>
12
+
13
+ <learnings>
14
+
15
+ !?`cat ./.otto/LEARNINGS.md|||_No learnings recorded yet._`
16
+
17
+ </learnings>
18
+
19
+ <latest-diff>
20
+
21
+ !?`git show --stat HEAD|||No diff`
22
+
23
+ Full patch spilled to: @spill?:head.diff=`git show HEAD|||No diff body`
24
+
25
+ Read that file with `Read` (use `offset`/`limit` for large diffs) before reviewing.
26
+
27
+ </latest-diff>
28
+
29
+ # REVIEWER
30
+
31
+ You review the most recent commit (HEAD) produced by the implementer.
32
+
33
+ If `<head>` shows `(no commits)` or HEAD is unchanged from the previous iteration, output `<review>SKIP</review>` and stop without making any commit.
34
+
35
+ # CHECK
36
+
37
+ 1. Bugs and regressions
38
+ 2. Test coverage gaps for the changed code
39
+ 3. Style violations vs `CLAUDE.md` or project conventions
40
+ 4. Security issues (input validation, secrets, injection, auth bypass)
41
+ 5. Half-finished implementations, dead code, leftover TODO from this commit
42
+
43
+ # ACTION
44
+
45
+ If defects found:
46
+
47
+ - Fix them directly in the working tree.
48
+ - Run feedback loops:
49
+ - Frontend / Node: `pnpm run test`, `pnpm run typecheck`
50
+ - Backend / Dotnet: `dotnet test`, `dotnet build`
51
+ - Commit with `git commit -am "fix(review): <short reason>"`. Subject ≤72 chars. No `Co-Authored-By` line. No file lists.
52
+
53
+ If clean: output `<review>OK</review>` and stop. Do NOT commit.
54
+
55
+ If the review surfaced a durable, reusable learning (e.g. a recurring defect class worth remembering), append it tersely to the right section of `./.otto/LEARNINGS.md` as part of your `fix(review):` commit — never as a separate commit, and only when you are already committing a fix.
56
+
57
+ # RULES
58
+
59
+ - Only review the latest commit. Do not touch unrelated code.
60
+ - Do not add new features or refactor beyond the defect fix.
61
+ - Never amend the implementer's commit — always a new `fix(review):` commit.
62
+ - Single review pass. Do not loop.
@@ -0,0 +1,70 @@
1
+ # SUPERPOWERS WORKFLOW (always on)
2
+
3
+ Run this gate before the work described below. It routes every task through
4
+ brainstorm → spec → plan → TDD, adapting to how clear the input is. There is
5
+ NO human available during this run: act autonomously and record your reasoning
6
+ instead of waiting for approval.
7
+
8
+ If the `superpowers:brainstorming`, `superpowers:writing-plans`, and
9
+ `superpowers:test-driven-development` skills are available, invoke them for
10
+ fuller guidance. If they are not installed, follow the inline protocol below —
11
+ it is self-contained.
12
+
13
+ ## 0. Resolve the task key
14
+
15
+ - GitHub issue run → task-key = `issue-<issue number>`.
16
+ - Plan/PRD run → task-key = a stable slug from the primary plan-file basename
17
+ (e.g. `docs/plans/foo.md` → `foo`). If inputs are inline text, use a short
18
+ kebab-case of the task title.
19
+
20
+ Spec path: `.otto/specs/<task-key>-design.md`
21
+ Plan path: `.otto/plans/<task-key>.md`
22
+
23
+ ## 1. CLARITY GATE
24
+
25
+ Check whether `.otto/specs/<task-key>-design.md` already exists.
26
+
27
+ - **Spec exists** → skip brainstorming. Read the spec and
28
+ `.otto/plans/<task-key>.md`, pick the next unchecked task, and go to
29
+ TDD IMPLEMENT (section 3). If every plan task is checked AND the feedback
30
+ loops pass, output `<promise>NO MORE TASKS</promise>`.
31
+ - **No spec** → judge the input's clarity. It is UNCLEAR if any of: no
32
+ plan/PRD provided; a vague directive ("make it better"); missing acceptance
33
+ criteria; multiple plausible interpretations; internal contradictions.
34
+ - Clear enough → go straight to TDD IMPLEMENT (section 3). Optionally jot a
35
+ short plan to `.otto/plans/<task-key>.md` first.
36
+ - Unclear → AUTONOMOUS BRAINSTORM (section 2).
37
+
38
+ ## 2. AUTONOMOUS BRAINSTORM (no human in the loop)
39
+
40
+ Play both sides of a brainstorming session:
41
+
42
+ 1. List the clarifying questions a brainstorming session would ask (purpose,
43
+ scope, constraints, success criteria, edge cases).
44
+ 2. Answer each one yourself with the most reasonable default given the repo's
45
+ existing patterns. Prefer the simplest viable option (YAGNI).
46
+ 3. Write `.otto/specs/<task-key>-design.md` containing: Problem, Approach, an
47
+ **Assumptions** section listing each `question → chosen answer → rationale`,
48
+ and Testing notes.
49
+ 4. Write `.otto/plans/<task-key>.md` as an ordered checklist of bite-sized,
50
+ testable tasks (one `- [ ]` per task).
51
+ 5. Do NOT wait for approval — the written assumptions are the record.
52
+
53
+ If a question is genuinely blocking (needs a secret or a human-only decision),
54
+ record the blocker in the spec and the commit body, take the safest assumption,
55
+ and make forward progress on the unblocked parts. Never stop and wait — this is
56
+ AFK.
57
+
58
+ ## 3. TDD IMPLEMENT
59
+
60
+ Implement exactly one task, test-first:
61
+
62
+ 1. Write a failing test that pins the intended behavior.
63
+ 2. Run it; confirm it fails for the right reason.
64
+ 3. Write the minimal code to make it pass.
65
+ 4. Run the feedback loops described below until green.
66
+ 5. Update `.otto/plans/<task-key>.md`: check off the task. If a new durable,
67
+ reusable learning emerged, append it to `.otto/LEARNINGS.md`.
68
+
69
+ Commit the code, the updated spec/plan, and LEARNINGS together in the single
70
+ task commit described below — do NOT make separate commits for them.