@vocdoni/skills 0.5.3 → 0.7.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.
- package/.claude-plugin/marketplace.json +29 -27
- package/CHANGELOG.md +38 -0
- package/README.md +66 -41
- package/bin/install.js +13 -2
- package/package.json +1 -1
- package/plugins/agentic-dev/.claude-plugin/plugin.json +2 -2
- package/plugins/agentic-dev/agents/model-router.md +105 -0
- package/plugins/agentic-dev/skills/subagent-driven-development/SKILL.md +25 -13
- package/plugins/agentic-dev/skills/subagent-driven-development/references/audits.md +20 -13
- package/plugins/agentic-dev/skills/subagent-driven-development/references/dispatch.md +42 -1
- package/plugins/agentic-dev/skills/subagent-driven-development/references/ledger.md +11 -6
- package/plugins/agentic-dev/skills/subagent-driven-development/references/model-catalog.md +118 -0
- package/plugins/agentic-dev/skills/subagent-driven-development/references/models.md +126 -71
- package/plugins/agentic-dev/skills/subagent-driven-development/scripts/init-workspace.sh +2 -1
- package/plugins/agentic-dev/skills/subagent-driven-development/scripts/model-inventory.sh +142 -0
- package/plugins/claude-pi-subagent/plugins/pi-subagent/package-lock.json +4 -3
- package/plugins/vocdoni-comments/.claude-plugin/plugin.json +2 -2
- package/plugins/vocdoni-comments/hooks/hooks.json +28 -0
- package/plugins/vocdoni-comments/hooks/session-start.sh +45 -0
- package/plugins/vocdoni-contributing/.claude-plugin/plugin.json +3 -2
- package/plugins/vocdoni-contributing/hooks/hooks.json +14 -2
- package/plugins/vocdoni-contributing/hooks/session-start.sh +18 -6
- package/plugins/vocdoni-contributing/skills/contributing/SKILL.md +41 -7
- package/plugins/vocdoni-go/.claude-plugin/plugin.json +2 -2
- package/plugins/vocdoni-go/skills/vocdoni-backend-review/SKILL.md +522 -0
- package/plugins/vocdoni-go/skills/vocdoni-backend-review/references/prompts.md +260 -0
- package/plugins/vocdoni-go/skills/vocdoni-backend-review/scripts/untracked-list.sh +35 -0
- package/plugins/vocdoni-sdk/.claude-plugin/plugin.json +4 -5
- package/plugins/vocdoni-sdk/skills/vocdoni-ballot-protocol/SKILL.md +61 -38
- package/plugins/vocdoni-sdk/skills/vocdoni-sdk/SKILL.md +35 -21
- package/plugins/vocdoni-sdk/skills/vocdoni-sdk/recipes/approval-vote.ts +3 -3
- package/plugins/vocdoni-sdk/skills/vocdoni-sdk/recipes/basic-poll.ts +6 -6
- package/plugins/vocdoni-sdk/skills/vocdoni-sdk/recipes/csp-vote.ts +12 -7
- package/plugins/vocdoni-sdk/skills/vocdoni-sdk/recipes/multichoice-vote.ts +3 -3
- package/plugins/vocdoni-sdk/skills/vocdoni-sdk/recipes/quadratic-vote.ts +3 -3
- package/plugins/vocdoni-sdk/skills/vocdoni-sdk/recipes/ranked-vote.ts +3 -3
- package/plugins/vocdoni-sdk/skills/vocdoni-sdk/recipes/weighted-census.ts +3 -3
- package/plugins/vocdoni-sdk/skills/vocdoni-sdk/references/accounts.md +26 -15
- package/plugins/vocdoni-sdk/skills/vocdoni-sdk/references/census.md +9 -10
- package/plugins/vocdoni-sdk/skills/vocdoni-sdk/references/client.md +15 -13
- package/plugins/vocdoni-sdk/skills/vocdoni-sdk/references/csp.md +43 -18
- package/plugins/vocdoni-sdk/skills/vocdoni-sdk/references/elections.md +4 -4
- package/plugins/vocdoni-sdk/skills/vocdoni-sdk/references/errors.md +24 -21
- package/plugins/vocdoni-sdk/skills/vocdoni-sdk/references/removed-features.md +98 -0
- package/plugins/vocdoni-sdk/skills/vocdoni-sdk/references/results.md +0 -1
- package/plugins/vocdoni-sdk/skills/vocdoni-sdk/references/voting.md +30 -34
- package/plugins/vocdoni-sequencer/.claude-plugin/plugin.json +21 -0
- package/plugins/vocdoni-sequencer/skills/vocdoni-sequencer/SKILL.md +169 -0
- package/plugins/vocdoni-sequencer/skills/vocdoni-sequencer/references/removed-routes.md +60 -0
- package/plugins/davinci-sdk/.claude-plugin/plugin.json +0 -13
- package/plugins/davinci-sdk/skills/davinci-sdk/SKILL.md +0 -120
- package/plugins/davinci-sdk/skills/davinci-sdk/recipes/bootstrap.ts +0 -61
- package/plugins/davinci-sdk/skills/davinci-sdk/recipes/cast-vote.ts +0 -78
- package/plugins/davinci-sdk/skills/davinci-sdk/recipes/create-process.ts +0 -102
- package/plugins/davinci-sdk/skills/davinci-sdk/recipes/full-election.ts +0 -128
- package/plugins/davinci-sdk/skills/davinci-sdk/recipes/read-results.ts +0 -73
- package/plugins/davinci-sdk/skills/davinci-sdk/recipes/token-census.ts +0 -111
- package/plugins/davinci-sdk/skills/davinci-sdk/references/ballot-modes.md +0 -125
- package/plugins/davinci-sdk/skills/davinci-sdk/references/census.md +0 -168
- package/plugins/davinci-sdk/skills/davinci-sdk/references/contracts.md +0 -133
- package/plugins/davinci-sdk/skills/davinci-sdk/references/errors.md +0 -83
- package/plugins/davinci-sdk/skills/davinci-sdk/references/process.md +0 -225
- package/plugins/davinci-sdk/skills/davinci-sdk/references/protocol.md +0 -65
- package/plugins/davinci-sdk/skills/davinci-sdk/references/sequencer.md +0 -135
- package/plugins/davinci-sdk/skills/davinci-sdk/references/setup.md +0 -123
- package/plugins/davinci-sdk/skills/davinci-sdk/references/voting.md +0 -128
- package/plugins/vocdoni-sdk/skills/vocdoni-sdk/recipes/anonymous-vote.ts +0 -108
- package/plugins/vocdoni-sdk/skills/vocdoni-sdk/recipes/token-census.ts +0 -121
- package/plugins/vocdoni-sdk/skills/vocdoni-sdk/references/anonymous.md +0 -183
- package/plugins/vocdoni-sdk/skills/vocdoni-sdk/references/census3.md +0 -308
- package/plugins/vocdoni-stripe/.claude-plugin/plugin.json +0 -22
- package/plugins/vocdoni-stripe/skills/stripe-subscription/SKILL.md +0 -276
- package/plugins/vocdoni-stripe/skills/stripe-subscription/references/backend-contract.md +0 -142
- package/plugins/vocdoni-stripe/skills/stripe-subscription/references/product-templates.md +0 -132
- package/plugins/vocdoni-stripe/skills/stripe-subscription/references/stripe-cli.md +0 -212
- package/plugins/vocdoni-stripe/skills/stripe-subscription/scripts/clone-product.sh +0 -247
- package/plugins/vocdoni-stripe/skills/stripe-subscription/scripts/stripe-json.sh +0 -223
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
# Prompts and contracts
|
|
2
|
+
|
|
3
|
+
## Contents
|
|
4
|
+
- Reviewer prompt
|
|
5
|
+
- The six reviewer roles
|
|
6
|
+
- Review report contract
|
|
7
|
+
- Planner prompt and plan contract
|
|
8
|
+
- Implementer prompt and report contract
|
|
9
|
+
- Pre-flight audit (sensitive branches)
|
|
10
|
+
- Gate audit
|
|
11
|
+
|
|
12
|
+
## Reviewer prompt
|
|
13
|
+
|
|
14
|
+
Target and effort per reviewer come from SKILL.md's "Models and effort" table.
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
You are the <role> reviewer, iteration <N>, of the Go backend branch <branch> in <repo>.
|
|
18
|
+
<role paragraph and checklist from below>
|
|
19
|
+
|
|
20
|
+
Load these skills with the Skill tool before reviewing: <skills from SKILL.md's table, under the
|
|
21
|
+
names that resolved>.
|
|
22
|
+
Read the repo instructions: <CLAUDE.md, AGENTS.md, CONTRIBUTING.md paths>.
|
|
23
|
+
|
|
24
|
+
Branch purpose: <one paragraph>
|
|
25
|
+
Review the full diff against the fixed base: git diff <base-sha> (includes uncommitted work)
|
|
26
|
+
Untracked source files in scope: <list or "none">
|
|
27
|
+
Verification already run by the controller: <workspace>/iter-<N>/verify.md
|
|
28
|
+
Findings rejected in earlier iterations, with evidence: <workspace>/rejected.md
|
|
29
|
+
Raise one of these again only with new evidence the rejection does not answer.
|
|
30
|
+
|
|
31
|
+
Rules:
|
|
32
|
+
- Read-only, except for your report file below. Do not edit other files, run code generators,
|
|
33
|
+
or run commands that write into the repo. You may read any file and run read-only git and go
|
|
34
|
+
commands (go doc, go list, git log/blame).
|
|
35
|
+
- You do not dispatch subagents.
|
|
36
|
+
- Stay inside your role; other reviewers cover the rest.
|
|
37
|
+
- Report only concrete problems you can show in the code, with evidence. No style preferences
|
|
38
|
+
the repo does not already follow, no speculative risks, no invented findings.
|
|
39
|
+
- Review the current state of the whole diff, not only the latest changes.
|
|
40
|
+
<global constraints from SKILL.md, verbatim>
|
|
41
|
+
|
|
42
|
+
Write the report (contract below) to <workspace>/iter-<N>/<role>.md, or return it in full in
|
|
43
|
+
your reply if you have no Write tool. Otherwise reply to me in under 6 lines: status, finding count by severity, report path.
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## The six reviewer roles
|
|
47
|
+
|
|
48
|
+
Each finding belongs to one role. Where two roles touch the same topic, the owner named here
|
|
49
|
+
reports it and the other leaves it alone.
|
|
50
|
+
|
|
51
|
+
**usage** — senior Vocdoni backend engineer focused on how consumers use the code. End-to-end
|
|
52
|
+
workflows, API and CLI ergonomics and consistency, public package usability, input validation at
|
|
53
|
+
the boundary, error messages and recovery, surprising behaviour, configuration defaults,
|
|
54
|
+
backward compatibility, integration with Vocdoni SDKs and protocol expectations.
|
|
55
|
+
|
|
56
|
+
**design** — senior Vocdoni Go architect. Package responsibilities, interface design (small,
|
|
57
|
+
consumer-side), dependency direction, coupling and cohesion, data ownership and lifecycle, the
|
|
58
|
+
concurrency model, where trust boundaries sit, protocol and data format compatibility,
|
|
59
|
+
architecture that is more complex than the requirements need. Prefer the simplest design that
|
|
60
|
+
meets the actual requirements.
|
|
61
|
+
|
|
62
|
+
**implementation** — senior Vocdoni Go implementation engineer. Correctness, bugs and
|
|
63
|
+
regressions, error handling, context cancellation, races and goroutine lifetimes, resource
|
|
64
|
+
cleanup, security vulnerabilities, failure paths and edge cases, allocations and algorithmic
|
|
65
|
+
cost, use of modern Go for the module's version. A performance finding needs evidence (a
|
|
66
|
+
benchmark, a profile, or a complexity argument on realistic sizes); no premature optimization.
|
|
67
|
+
Owns security findings and baseline verification failures, except failures `verify.md` marks WAIVED.
|
|
68
|
+
|
|
69
|
+
**style** — Go code quality specialist. Idiomatic Go, Vocdoni conventions, naming, readability,
|
|
70
|
+
needless abstractions, duplicated or dead code, deep nesting, overengineering, unneeded
|
|
71
|
+
dependencies, consistency with the surrounding code, standard library use. Prefer removing
|
|
72
|
+
complexity to adding abstractions for hypothetical needs. Comments belong to the documentation
|
|
73
|
+
reviewer.
|
|
74
|
+
|
|
75
|
+
**testing** — senior Vocdoni Go testing engineer. Unit, integration and regression tests for the
|
|
76
|
+
changed behaviour, boundaries, invalid input, error paths, concurrency and `-race`, determinism
|
|
77
|
+
(no sleeps, no order dependence, no network), assertion quality, table-driven structure, missing
|
|
78
|
+
or weakened tests. Use the coverage profile in `verify.md` for the changed code. Prefer
|
|
79
|
+
behavioural coverage over percentage.
|
|
80
|
+
|
|
81
|
+
**documentation** — senior Vocdoni technical writer. GoDoc on exported declarations, READMEs, API
|
|
82
|
+
and configuration docs, examples, code comments (per the `comments` skill), migration and
|
|
83
|
+
compatibility notes, and whether docs match the implementation. Comments carry intent and
|
|
84
|
+
non-obvious constraints, not a restatement of the code.
|
|
85
|
+
|
|
86
|
+
## Review report contract
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
reviewer: <role>
|
|
90
|
+
iteration: <N>
|
|
91
|
+
status: CLEAN | FINDINGS | BLOCKED
|
|
92
|
+
scope: <packages and files reviewed>
|
|
93
|
+
verification: <commands run or read, and what they showed>
|
|
94
|
+
limitations: <what could not be checked, and why>
|
|
95
|
+
findings:
|
|
96
|
+
- severity: CRITICAL | HIGH | MEDIUM | LOW
|
|
97
|
+
confidence: HIGH | MEDIUM | LOW
|
|
98
|
+
title: <short title>
|
|
99
|
+
location: <file:line or symbol>
|
|
100
|
+
problem: <what is wrong>
|
|
101
|
+
evidence: <code excerpt, test, command output>
|
|
102
|
+
impact: <what breaks if left>
|
|
103
|
+
recommendation: <direction of the fix>
|
|
104
|
+
acceptance: <how to verify the fix>
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
CLEAN means zero actionable findings, a stated scope and stated verification. A review that could
|
|
108
|
+
not finish, or lacks evidence, is BLOCKED, never CLEAN. The controller assigns finding IDs.
|
|
109
|
+
|
|
110
|
+
## Planner prompt and plan contract
|
|
111
|
+
|
|
112
|
+
Plan drafter role, strong model, high effort. Read-only: it writes only its plan file.
|
|
113
|
+
|
|
114
|
+
```
|
|
115
|
+
You plan iteration <N> of the review of branch <branch> in <repo>. You do not edit project files
|
|
116
|
+
and you do not dispatch subagents.
|
|
117
|
+
|
|
118
|
+
Load: vocdoni-go:go-best-practices, vocdoni-go:go-code-quality (under the names that resolved).
|
|
119
|
+
Read <repo instruction files>.
|
|
120
|
+
<global constraints from SKILL.md, verbatim>
|
|
121
|
+
Branch purpose: <paragraph> Base: <base-sha> Tree state: <git status summary>
|
|
122
|
+
Reports: <workspace>/iter-<N>/{usage,design,implementation,style,testing,documentation}.md
|
|
123
|
+
Finding IDs: <workspace>/iter-<N>/findings.md (earlier iterations: iter-<K>/findings.md)
|
|
124
|
+
Gate audit to address, if the gate sent work back: <workspace>/iter-<N>/gate.md (only the findings listed on the ledger's `Iter <N>: G done` line)
|
|
125
|
+
Owner's uncommitted changes, in no-commit mode when step 9 saved them: <workspace>/owner.patch, <workspace>/owner-untracked.lst
|
|
126
|
+
Pre-flight audit to address, if it returned REPLAN or EXECUTE AFTER FIXES: <workspace>/iter-<N>/preflight.md (all of it: rulings come only on the final plan)
|
|
127
|
+
Second pre-flight and auditor consult, after a second pre-flight or a stall: <workspace>/iter-<N>/preflight-2.md, <workspace>/consult-<topic>.md
|
|
128
|
+
History: <workspace>/progress.md (earlier rulings and outcomes) and <workspace>/iter-<K>/plan.md for earlier iterations
|
|
129
|
+
|
|
130
|
+
1. Check every finding against the code. 2. Merge duplicates and link findings that repeat
|
|
131
|
+
earlier ones by ID. 3. Find shared root causes. 4. Resolve conflicts between findings with
|
|
132
|
+
evidence. 5. Prefer the smallest change that fixes the root cause, within the branch's purpose.
|
|
133
|
+
6. Order tasks by dependency, then severity. Flag any task that changes a public API, a
|
|
134
|
+
persisted or wire format, or a security boundary.
|
|
135
|
+
|
|
136
|
+
Write the plan (contract below) to <workspace>/iter-<N>/plan.md. Reply in under 8 lines.
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
```
|
|
140
|
+
iteration: <N>
|
|
141
|
+
summary: <strategy in 2-3 lines>
|
|
142
|
+
dispositions:
|
|
143
|
+
- finding: <ID>
|
|
144
|
+
decision: ACCEPTED | AMENDED | REJECTED
|
|
145
|
+
duplicates: <earlier IDs or none>
|
|
146
|
+
rationale: <evidence: file:line, test, spec clause>
|
|
147
|
+
tasks:
|
|
148
|
+
- id: T<n>
|
|
149
|
+
findings: <IDs>
|
|
150
|
+
objective: <expected result>
|
|
151
|
+
files: <paths>
|
|
152
|
+
changes: <what to change, precise enough to implement without guessing>
|
|
153
|
+
depends_on: <task IDs or none>
|
|
154
|
+
flags: <public-api | format | security | none>
|
|
155
|
+
acceptance: <criteria>
|
|
156
|
+
verification: <commands and expected result>
|
|
157
|
+
risks: <risks and mitigations>
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Every finding gets a disposition. A rejection without evidence is sent back.
|
|
161
|
+
|
|
162
|
+
## Implementer prompt and report contract
|
|
163
|
+
|
|
164
|
+
Use agentic-dev's implementer prompt contract (`references/dispatch.md`) with these changes:
|
|
165
|
+
|
|
166
|
+
- The brief is `<workspace>/iter-<N>/plan.md`, the task IDs to execute, and the rulings for those
|
|
167
|
+
tasks and for the findings they address, plus `<workspace>/iter-<N>/findings.md`.
|
|
168
|
+
- In no-commit mode, when step 9 saved them, the owner's uncommitted changes are
|
|
169
|
+
`<workspace>/owner.patch` and `<workspace>/owner-untracked.lst`; pass both.
|
|
170
|
+
- The report goes to `<workspace>/iter-<N>/task-<task-id>-report.md` (e.g. `task-T1-report.md`), not
|
|
171
|
+
`<workspace>/task-<N>-report.md`: task IDs restart every iteration.
|
|
172
|
+
- Load: vocdoni-go:go-best-practices, vocdoni-go:go-code-quality, vocdoni-go:go-modern,
|
|
173
|
+
vocdoni-comments:comments (under the names that resolved).
|
|
174
|
+
- Commit mode: "commit each task with explicit paths" or "do not commit; leave changes in the
|
|
175
|
+
working tree", as the ledger's `Mode:` line says.
|
|
176
|
+
- Add the global constraints from SKILL.md verbatim.
|
|
177
|
+
- Untracked files a task names are in scope; this overrides the base rule about untracked files
|
|
178
|
+
for those paths only.
|
|
179
|
+
- Touch only the files the task names, plus tests and docs it requires. Never edit lines of the
|
|
180
|
+
owner's uncommitted changes unless a task names them, and never edit inside an untracked nested
|
|
181
|
+
git repository: the controller cannot see changes there.
|
|
182
|
+
- If the plan leaves a decision open that changes its intent, stop and return NEEDS_CONTEXT with:
|
|
183
|
+
the task, the question, the options, your recommendation and its impact, and which tasks are
|
|
184
|
+
done and pending. Do not decide it yourself.
|
|
185
|
+
|
|
186
|
+
The report follows agentic-dev's report contract, plus `findings addressed: <IDs>` and one
|
|
187
|
+
verification line per command: `<command>: PASS | FAIL | SKIPPED — <result>`.
|
|
188
|
+
|
|
189
|
+
## Pre-flight audit (sensitive branches)
|
|
190
|
+
|
|
191
|
+
Auditor target, high effort. agentic-dev's pre-flight prompt expects a spec and a plan with
|
|
192
|
+
Global Constraints and a release section; this one fits a fix plan.
|
|
193
|
+
|
|
194
|
+
```
|
|
195
|
+
You are a strict pre-flight auditor of the fix plan for iteration <N> of the review of branch
|
|
196
|
+
<branch>, run before any code changes. Assume the implementer follows the plan literally.
|
|
197
|
+
|
|
198
|
+
Plan: <workspace>/iter-<N>/plan.md
|
|
199
|
+
Findings: <workspace>/iter-<N>/{usage,design,implementation,style,testing,documentation}.md
|
|
200
|
+
Gate findings, if the gate sent work back: <workspace>/iter-<N>/gate.md (only the findings listed on the ledger's `Iter <N>: G done` line)
|
|
201
|
+
Read the repo instructions: <CLAUDE.md, AGENTS.md, CONTRIBUTING.md paths>
|
|
202
|
+
<global constraints from SKILL.md, verbatim>
|
|
203
|
+
Ledger: <workspace>/progress.md Branch purpose: <paragraph>
|
|
204
|
+
Current state: git diff <base-sha> (working tree against the fixed base), untracked: <list>
|
|
205
|
+
Finding IDs: <workspace>/iter-<N>/findings.md
|
|
206
|
+
Already decided (do not relitigate without new evidence): the ledger's Ruling lines and
|
|
207
|
+
<workspace>/rejected.md
|
|
208
|
+
|
|
209
|
+
Check:
|
|
210
|
+
1. Each task fixes the root cause of its findings, and its acceptance criteria prove it.
|
|
211
|
+
2. Conflicts: tasks that touch the same file, symbol or interface, and the order they need.
|
|
212
|
+
3. No task changes a public API, a persisted or wire format, or a security boundary without the
|
|
213
|
+
flag, and none goes beyond the branch's purpose.
|
|
214
|
+
4. Each rejected finding's evidence holds against the code.
|
|
215
|
+
5. Security, cryptography, voting or ballot code a task touches: read it in full.
|
|
216
|
+
|
|
217
|
+
Write the report to <workspace>/iter-<N>/<preflight.md, or preflight-2.md for the second one>, or return it in your reply if you have no
|
|
218
|
+
Write tool:
|
|
219
|
+
- Verdict: EXECUTE | EXECUTE AFTER FIXES | REPLAN
|
|
220
|
+
- Findings in the F<n> block format of agentic-dev's references/audits.md
|
|
221
|
+
|
|
222
|
+
Read-only: change no file other than the report, and do not dispatch subagents.
|
|
223
|
+
Reply in under 8 lines: verdict, counts by severity, report path.
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
## Gate audit
|
|
227
|
+
|
|
228
|
+
Auditor target, high effort. It diffs the working tree, not `<base>...<branch>`: in no-commit
|
|
229
|
+
mode the fixes exist only in the working tree.
|
|
230
|
+
|
|
231
|
+
```
|
|
232
|
+
You are the final, strict auditor of branch <branch> after its iterative review converged. Look
|
|
233
|
+
for reasons it should not merge.
|
|
234
|
+
|
|
235
|
+
Branch purpose: <paragraph> Ledger: <workspace>/progress.md
|
|
236
|
+
Read the repo instructions: <CLAUDE.md, AGENTS.md, CONTRIBUTING.md paths>
|
|
237
|
+
<global constraints from SKILL.md, verbatim>
|
|
238
|
+
Diff: git diff <base-sha> (working tree against the fixed base), untracked source: <list>
|
|
239
|
+
Controller's verification: <workspace>/iter-<N>/verify.md
|
|
240
|
+
Finding IDs: <workspace>/iter-*/findings.md (every iteration's; this one may have none)
|
|
241
|
+
Already decided (do not relitigate without new evidence): the ledger's Ruling lines and
|
|
242
|
+
<workspace>/rejected.md
|
|
243
|
+
|
|
244
|
+
Check:
|
|
245
|
+
1. The branch does what its purpose says and nothing more; the fixes did not drift from it.
|
|
246
|
+
2. Risky paths, read in full rather than as diffs: untrusted input, concurrency, cryptography,
|
|
247
|
+
voting or ballot logic, persistence, auth.
|
|
248
|
+
3. Every accepted finding is really fixed, and every rejection's evidence still holds.
|
|
249
|
+
4. Tests test behaviour, really ran, and none was weakened.
|
|
250
|
+
5. Leftovers: debug code, TODOs, dead code, stray generated files.
|
|
251
|
+
|
|
252
|
+
Write the report to <workspace>/iter-<N>/gate.md, or return it in your reply if you have no Write
|
|
253
|
+
tool:
|
|
254
|
+
- Verdict: MERGE | MERGE AFTER FIXES | DO NOT MERGE
|
|
255
|
+
- Findings in the F<n> block format of agentic-dev's references/audits.md
|
|
256
|
+
- A "Residual risk" paragraph: what could still go wrong, and how we would notice
|
|
257
|
+
|
|
258
|
+
Read-only: change no file other than the report, and do not dispatch subagents.
|
|
259
|
+
Reply in under 8 lines: verdict, counts by severity, report path.
|
|
260
|
+
```
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Print "<path>\t<state>" for every untracked, non-ignored path, sorted by path. <state> is:
|
|
3
|
+
# a regular file the blob hash of its raw bytes
|
|
4
|
+
# a symlink "link:<target>"
|
|
5
|
+
# a nested repo "repo" (by name only: nothing runs inside it, so changes within are invisible)
|
|
6
|
+
# anything else "other"
|
|
7
|
+
# Two listings taken before and after an iteration differ where an untracked path was added,
|
|
8
|
+
# had its content edited, was retargeted or removed (mode changes and nested repos excepted).
|
|
9
|
+
# Paths are raw (core.quotePath=false).
|
|
10
|
+
# Exits non-zero and prints nothing when git ls-files fails or warns (e.g. an unreadable
|
|
11
|
+
# directory, whose contents would otherwise read as removed) or a file cannot be hashed.
|
|
12
|
+
# A filename containing a newline breaks the one-line-per-path format; changes are still detected.
|
|
13
|
+
# Usage: untracked-list.sh >| <file> (from anywhere in the repo; check the exit status)
|
|
14
|
+
set -euo pipefail
|
|
15
|
+
top=$(git rev-parse --show-toplevel)
|
|
16
|
+
cd "$top"
|
|
17
|
+
tmp=$(mktemp -d); trap 'rm -rf "$tmp"' EXIT
|
|
18
|
+
git -c core.quotePath=false ls-files -z --others --exclude-standard >"$tmp/list" 2>"$tmp/err" ||
|
|
19
|
+
{ cat "$tmp/err" >&2; exit 1; }
|
|
20
|
+
if [[ -s $tmp/err ]]; then cat "$tmp/err" >&2; exit 1; fi
|
|
21
|
+
while IFS= read -r -d '' f; do
|
|
22
|
+
f=${f%/}
|
|
23
|
+
if [[ -L $f ]]; then
|
|
24
|
+
state="link:$(readlink -- "$f")"
|
|
25
|
+
elif [[ -d $f ]]; then
|
|
26
|
+
state=repo
|
|
27
|
+
elif [[ -f $f ]]; then
|
|
28
|
+
# --no-filters hashes the raw bytes: clean and EOL filters would hide a CRLF->LF rewrite.
|
|
29
|
+
state=$(git hash-object --no-filters -- "$f") || exit 1
|
|
30
|
+
else
|
|
31
|
+
state=other
|
|
32
|
+
fi
|
|
33
|
+
printf '%s\t%s\n' "$f" "$state"
|
|
34
|
+
done <"$tmp/list" | LC_ALL=C sort >"$tmp/out"
|
|
35
|
+
cat "$tmp/out"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vocdoni-sdk",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Vocdoni SDK (@vocdoni/sdk
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "Legacy reference skill for the Vocdoni SDK (@vocdoni/sdk 0.10.0), the TypeScript client of the Vochain /v2 API now served by vocdoni-sequencer, kept to maintain existing code: client setup, accounts, census types, election variants, CSP voting (including weighted CSP votes) and vote memos, with recipes, plus what replaces the features the chain and the SaaS dropped. Also ships the ballot protocol skill: the on-chain ballot and results model the sequencer enforces. New integrations use the vocdoni-integrator-sdk plugin.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Vocdoni",
|
|
7
7
|
"url": "https://vocdoni.io"
|
|
@@ -17,8 +17,7 @@
|
|
|
17
17
|
"voting",
|
|
18
18
|
"elections",
|
|
19
19
|
"census",
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"zk"
|
|
20
|
+
"legacy",
|
|
21
|
+
"ballot-protocol"
|
|
23
22
|
]
|
|
24
23
|
}
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: vocdoni-ballot-protocol
|
|
3
|
-
description: Use this skill whenever the user is reasoning about the *encoding* of Vocdoni ballots and results
|
|
3
|
+
description: Use this skill whenever the user is reasoning about the *encoding* of Vocdoni ballots and results, the on-chain ballot protocol that vocdoni-sequencer (voconed) enforces under both the legacy @vocdoni/sdk vote types and the integrator SDK's raw `ballotProtocol`. Triggers on questions like "what shape is the vote array", "how are results aggregated", "what does my Vote([2,1,2]) actually mean", "how do I read the result matrix", "what's the difference between maxCount and maxValue", "why does my quadratic vote cost N²", "what is costExponent really", "discrete vs index-weighted aggregation", on `ballotProtocol`, `minValue` or `minTotalCost`, on a vote rejected with `invalid vote: ...`, or any debugging session where a numeric ballot has to be mapped to a tally. Also use when explaining how an election variant (approval, ranked, quadratic, multi-question) works at the bit-level. This skill teaches the data model; vocdoni-integrator-sdk and the legacy vocdoni-sdk teach the client APIs.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Vocdoni Ballot Protocol
|
|
7
7
|
|
|
8
|
-
A small, deliberate specification for how Vocdoni encodes ballots and accumulates results.
|
|
8
|
+
A small, deliberate specification for how Vocdoni encodes ballots and accumulates results. It is the on-chain data model that the chain, [[vocdoni-sequencer]] (`voconed`, the single-node Vochain serving DEV/STG/PROD), stores per election and enforces on every ballot. The archived `vocdoni-node` (`go.vocdoni.io/dvote`) is legacy; read the sequencer code, not the node's.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
Clients reach it two ways:
|
|
11
|
+
|
|
12
|
+
- [[vocdoni-integrator-sdk]]: each question carries a raw `ballotProtocol` (`maxCount`, `maxValue`, `maxTotalCost`, `costExponent`, `uniqueValues`, `costFromWeight`, ...) that goes through saas-backend to the chain.
|
|
13
|
+
- [[vocdoni-sdk]] (`@vocdoni/sdk`, **legacy**): the `IVoteType` fields and the election variant classes serialise into the same parameters.
|
|
14
|
+
|
|
15
|
+
Knowing the model lets you debug "why does my vote array produce those results" without guessing, whichever client built the election.
|
|
11
16
|
|
|
12
17
|
## Core idea
|
|
13
18
|
|
|
@@ -28,17 +33,20 @@ So results are *not* a per-option vote count — they're a histogram over (field
|
|
|
28
33
|
|
|
29
34
|
## Protocol parameters
|
|
30
35
|
|
|
31
|
-
These are stored on-chain per election and constrain what ballots are valid.
|
|
36
|
+
These are stored on-chain per election and constrain what ballots are valid. The numeric ones live in the process `voteOptions` (proto `ProcessVoteOptions`, all `uint32`, shown as `tallyMode` by `GET /elections/{id}`); `uniqueValues` and `costFromWeight` live in the `envelopeType`.
|
|
32
37
|
|
|
33
|
-
| Parameter | Type
|
|
34
|
-
| ----------------- |
|
|
35
|
-
| `maxCount` | `
|
|
36
|
-
| `maxValue` | `
|
|
37
|
-
| `minValue` | `
|
|
38
|
+
| Parameter | Type | Meaning |
|
|
39
|
+
| ----------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------- |
|
|
40
|
+
| `maxCount` | `uint32` | Number of fields per ballot. Range: `1 ≤ maxCount ≤ 64`, and `maxCount × (maxValue + 1)` must stay within 2^20 result cells. |
|
|
41
|
+
| `maxValue` | `uint32` | Maximum value any field may take. `0` is a special marker meaning "values are amounts to aggregate" (budget/quadratic). |
|
|
42
|
+
| `minValue` | `uint32` | Minimum value any field may take. `0` means no minimum; an empty ballot passes. **New with vocdoni-sequencer.** |
|
|
38
43
|
| `uniqueValues` | `bool` | If `true`, no value may appear twice in a single ballot (used by ranked voting). |
|
|
39
|
-
| `maxTotalCost` | `
|
|
40
|
-
| `minTotalCost` | `
|
|
41
|
-
| `costExponent` | `
|
|
44
|
+
| `maxTotalCost` | `uint32` | Upper bound on `Σ(value[i] ^ costExponent)`. `0` means "no limit / not applicable". |
|
|
45
|
+
| `minTotalCost` | `uint32` | Lower bound on the same sum. `0` means no minimum. **New with vocdoni-sequencer.** |
|
|
46
|
+
| `costExponent` | `uint32` | Plain integer exponent applied per value when computing the total cost (`1` linear, `2` quadratic). Not scaled. |
|
|
47
|
+
| `costFromWeight` | `bool` | If `true`, the voter's census weight replaces `maxTotalCost` as the upper cost bound (`minTotalCost` stays a constant lower bound). |
|
|
48
|
+
|
|
49
|
+
`minValue` and `minTotalCost` did not exist before vocdoni-sequencer (spec `docs/specs/2026-10-27-ballot-minimums-design.md`); elections that leave them at `0` are tallied exactly as before.
|
|
42
50
|
|
|
43
51
|
### Cost formula
|
|
44
52
|
|
|
@@ -46,7 +54,7 @@ These are stored on-chain per election and constrain what ballots are valid.
|
|
|
46
54
|
totalCost = Σ (value[i] ^ costExponent)
|
|
47
55
|
```
|
|
48
56
|
|
|
49
|
-
A ballot is valid only if `minTotalCost ≤ totalCost ≤ maxTotalCost` (each bound ignored when set to `0`).
|
|
57
|
+
A ballot is valid only if `minTotalCost ≤ totalCost ≤ maxTotalCost` (each bound ignored when set to `0`; under `costFromWeight` the upper bound is the voter's weight). With `costExponent = 0` every field costs `1`, including a `0` value (`0^0 = 1`), so the total cost is just the number of fields: set `costExponent = 1` when the cost should count the values.
|
|
50
58
|
|
|
51
59
|
For quadratic voting (`costExponent = 2`):
|
|
52
60
|
|
|
@@ -56,39 +64,52 @@ Vote([1, 1, 2, 2]) cost = 1² + 1² + 2² + 2² = 10
|
|
|
56
64
|
Vote([0, 3, 1, 1]) cost = 0² + 3² + 1² + 1² = 11
|
|
57
65
|
```
|
|
58
66
|
|
|
59
|
-
### `costExponent`
|
|
67
|
+
### `costExponent` is not scaled
|
|
68
|
+
|
|
69
|
+
`costExponent` is a plain integer exponent. The chain raises each value to it directly (`new(big.Int).Exp(v, costExponent)` in `vochain/results/results.go`); there is no `× 10 000` scaling and no fractional exponent. `@vocdoni/sdk` sends `1` (its default, and what `BudgetElection` sets) or `2` (`QuadraticElection`'s default `quadraticCost`).
|
|
70
|
+
|
|
71
|
+
Old SDKs sent an inert default of `10000`. It is harmless while no cost rule applies, which is why the chain does not cap the exponent in general. It caps it only where it matters:
|
|
60
72
|
|
|
61
|
-
|
|
73
|
+
- with `minTotalCost > 0`, a new election with `costExponent > 8` is rejected (`costExponent %d greater than 8`);
|
|
74
|
+
- the max-cost check rejects a ballot with any value ≥ 2 through a cheap lower bound before computing a huge power (with `costExponent 10000` and `maxTotalCost 1`, `[1,0,0]` passes and `[2,0,0]` fails).
|
|
62
75
|
|
|
63
|
-
|
|
64
|
-
| ------------- | ------------------ |
|
|
65
|
-
| `0` | `0.0000` |
|
|
66
|
-
| `10 000` | `1.0000` |
|
|
67
|
-
| `20 000` | `2.0000` |
|
|
68
|
-
| `65 535` | `6.5535` (max) |
|
|
76
|
+
## Where the rules are enforced
|
|
69
77
|
|
|
70
|
-
|
|
78
|
+
All rules live in one function, `results.CheckVote` (`vochain/results/results.go`), applied in this order: no negative value, `maxCount`, `uniqueValues`, `maxValue`, `minValue`, max cost, `minTotalCost`.
|
|
71
79
|
|
|
72
|
-
|
|
80
|
+
| When | What is checked | On failure |
|
|
81
|
+
| --------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------ |
|
|
82
|
+
| Election creation | `maxCount ≥ 1`, result-matrix size, `minValue ≤ maxValue` (when `maxValue > 0`), `minTotalCost ≤ maxTotalCost` (when `maxTotalCost > 0`), `costExponent ≤ 8` when `minTotalCost > 0` | `NewProcessTx` rejects the election (`vochain/transaction/election_tx.go`) |
|
|
83
|
+
| Vote submission, plaintext | Every ballot rule, through `CheckPlaintextBallot` (`vochain/transaction/vote_rules.go`) | The vote tx is rejected with `invalid vote: <rule>` (or `cannot decode vote package: ...`) |
|
|
84
|
+
| Vote submission, encrypted | Nothing about the ballot: it cannot be read without the keys | - |
|
|
85
|
+
| Tally (and live indexer results) | Every ballot rule, through `AddVote` | The ballot is silently skipped; it never reaches the results |
|
|
73
86
|
|
|
74
|
-
|
|
87
|
+
So an encrypted (`secretUntilTheEnd`) ballot that breaks a rule is accepted and then dropped at the tally. Validate encrypted ballots client-side before sending them.
|
|
88
|
+
|
|
89
|
+
## Client ↔ protocol mapping
|
|
90
|
+
|
|
91
|
+
The integrator SDK's `ballotProtocol` (see [[vocdoni-integrator-sdk]]) uses the protocol names directly: `maxCount`, `maxValue`, `maxTotalCost`, `costExponent`, `uniqueValues`, `costFromWeight`, `maxVoteOverwrites`. Its type does not carry `minValue` or `minTotalCost` yet.
|
|
92
|
+
|
|
93
|
+
These are the corresponding `IVoteType` fields in the legacy `@vocdoni/sdk` (see [[vocdoni-sdk]]'s `elections.md`):
|
|
75
94
|
|
|
76
95
|
| Protocol | SDK `IVoteType` field | Notes |
|
|
77
96
|
| ------------------- | ----------------------- | ------------------------------------------------------------------------------------------- |
|
|
78
97
|
| `maxCount` | `maxCount` | SDK auto-fills as `questions.length` (multi-question) or `choices.length` (single-question). |
|
|
79
98
|
| `maxValue` | `maxValue` | SDK auto-fills as `max(choices.length - 1)` across questions. Set to `0` for budget/quadratic. |
|
|
80
|
-
| `minValue` | (
|
|
99
|
+
| `minValue` | (none) | `@vocdoni/sdk` 0.10.0 cannot set it; no variant sends it. |
|
|
81
100
|
| `uniqueValues` | `uniqueChoices` | Renamed for human clarity. Required by ranked elections. |
|
|
82
101
|
| `maxTotalCost` | `maxTotalCost` | Election variants set this from `maxBudget` (budget/quadratic). |
|
|
83
|
-
| `minTotalCost` | (
|
|
84
|
-
| `costExponent` | `costExponent` | `1`
|
|
85
|
-
| `costFromWeight` | `costFromWeight` |
|
|
102
|
+
| `minTotalCost` | (none) | `@vocdoni/sdk` 0.10.0 cannot set it. `BudgetElection`'s `forceFullBudget` is election metadata plus a client-side check in `checkVote`; no minimum reaches the chain. |
|
|
103
|
+
| `costExponent` | `costExponent` | Sent as is: `1` by default and for budget, `2` for quadratic. |
|
|
104
|
+
| `costFromWeight` | `costFromWeight` | On-chain `envelopeType` flag; the budget/quadratic variants set it with `maxTotalCost = 0` (census weight as budget). |
|
|
86
105
|
|
|
87
106
|
The SDK's variant classes (`ApprovalElection`, `MultiChoiceElection`, `BudgetElection`, `QuadraticElection`) exist precisely to set the right protocol parameters for common shapes — they're presets, not new on-chain features.
|
|
88
107
|
|
|
108
|
+
The Go `apiclient` in vocdoni-sequencer can already set `minValue` and `minTotalCost` (`api.VoteType`); the JS clients cannot yet.
|
|
109
|
+
|
|
89
110
|
## Results matrix — how to read it
|
|
90
111
|
|
|
91
|
-
`results[fieldIndex][value]` = number of voters who chose `value` for that field.
|
|
112
|
+
`results[fieldIndex][value]` = number of voters who chose `value` for that field (each counted with its census weight in a weighted census).
|
|
92
113
|
|
|
93
114
|
### Worked example: rate 3 candidates 0..2
|
|
94
115
|
|
|
@@ -179,15 +200,15 @@ Three candidates, scores 0..2 — but each score used at most once (ranking).
|
|
|
179
200
|
| ---------- | ---------- | ---------- | -------------- | -------------- | -------------- | -------------- |
|
|
180
201
|
| `3` | `0` | `2` | — | — | — | `true` |
|
|
181
202
|
|
|
182
|
-
Ballots: `[2,1,2]`, `[
|
|
203
|
+
Ballots: permutations such as `[2,0,1]` or `[0,1,2]`. The worked example above uses `uniqueValues = false`; with `true`, `[2,1,2]` and `[0,0,0]` break the rule (rejected at submission when plaintext, skipped at the tally when encrypted).
|
|
183
204
|
|
|
184
205
|
### Single choice (out of three)
|
|
185
206
|
|
|
186
|
-
Pick exactly one of three options.
|
|
207
|
+
Pick exactly one of three options. The `minTotalCost = 1` half (no blank ballot) is enforced only by vocdoni-sequencer.
|
|
187
208
|
|
|
188
209
|
| `maxCount` | `minValue` | `maxValue` | `minTotalCost` | `maxTotalCost` | `costExponent` | `uniqueValues` |
|
|
189
210
|
| ---------- | ---------- | ---------- | -------------- | -------------- | -------------- | -------------- |
|
|
190
|
-
| `3` | `0` | `1` | `1` | `1` |
|
|
211
|
+
| `3` | `0` | `1` | `1` | `1` | `1` | `false` |
|
|
191
212
|
|
|
192
213
|
Ballot shape: `[v0, v1, v2]` where each `v_i ∈ {0, 1}` and `Σ v_i = 1`. (i.e. exactly one of the positions is `1`.)
|
|
193
214
|
|
|
@@ -201,9 +222,9 @@ Per-option (index-weighted): `[0·3 + 1·0 + 2·0, 0·1 + 1·2 + 2·0, 0·2 + 1
|
|
|
201
222
|
|
|
202
223
|
| `maxCount` | `minValue` | `maxValue` | `minTotalCost` | `maxTotalCost` | `costExponent` | `uniqueValues` |
|
|
203
224
|
| ---------- | ---------- | ---------- | -------------- | -------------- | -------------- | -------------- |
|
|
204
|
-
| `5` | `0` | `1` | `3` | `3` |
|
|
225
|
+
| `5` | `0` | `1` | `3` | `3` | `1` | `false` |
|
|
205
226
|
|
|
206
|
-
The `minTotalCost = maxTotalCost = 3` forces exactly 3 approvals. Set both to `0` for unlimited.
|
|
227
|
+
The `minTotalCost = maxTotalCost = 3` with `costExponent = 1` forces exactly 3 approvals (with `costExponent = 0` every ballot would cost 5). Set both to `0` for unlimited. `minTotalCost` needs vocdoni-sequencer and a client that can send it; without it only the upper bound holds.
|
|
207
228
|
|
|
208
229
|
Ballots: `[1,1,1,0,0]`, `[0,1,1,1,0]`, `[1,1,1,0,0]` → results: `[ [1,2], [0,3], [0,3], [2,1], [3,0] ]`. Approval count per option: `[2, 3, 3, 1, 0]`.
|
|
209
230
|
|
|
@@ -248,16 +269,18 @@ Ballots: `[4,3,2]`, `[4,2,3]`, `[0,1,4]` → results `[ [1,0,0,0,2], [0,1,1,1,0]
|
|
|
248
269
|
|
|
249
270
|
This is the case to use `discrete-counting`: read each field as "votes per candidate for this position", *not* as "weighted points".
|
|
250
271
|
|
|
251
|
-
## Why this matters for the
|
|
272
|
+
## Why this matters for the client developer
|
|
252
273
|
|
|
253
|
-
1. **Vote-shape errors stop being mysterious.** `Vote([…])` is exactly the on-chain ballot. When
|
|
274
|
+
1. **Vote-shape errors stop being mysterious.** `Vote([…])` is exactly the on-chain ballot. When a plaintext vote is rejected with `invalid vote: ...` (for example `max value overflow 3`, `min total cost underflow: 1`, `values are not unique`), the suffix names the broken rule. Look at the protocol params; client-side checks in the SDKs are only partial copies of `CheckVote`.
|
|
254
275
|
2. **Results are a histogram, not a tally.** If you `console.log(election.results)` and see a matrix instead of a per-option count, it's not a bug. Pick the right interpretation (`index-weighted` or `discrete-counting`) for the election type — see "Result interpretation modes".
|
|
255
|
-
3. **Variants are presets, not new primitives.** `ApprovalElection`, `MultiChoiceElection`, `BudgetElection`, `QuadraticElection` set protocol parameters for you. Knowing the underlying parameters helps you (a) understand why the variant is constrained the way it is, and (b) build a custom shape via the base `Election.from(...)` when no variant fits.
|
|
276
|
+
3. **Variants are presets, not new primitives.** In the legacy SDK, `ApprovalElection`, `MultiChoiceElection`, `BudgetElection`, `QuadraticElection` set protocol parameters for you. Knowing the underlying parameters helps you (a) understand why the variant is constrained the way it is, and (b) build a custom shape via the base `Election.from(...)` when no variant fits.
|
|
256
277
|
4. **`maxValue = 0` is a flag, not zero.** It means "field values are aggregable amounts whose cap comes from `maxTotalCost` and `costExponent`" — used by budget and quadratic. Don't read it as "each value can be at most 0".
|
|
257
278
|
|
|
258
279
|
## Cross-references
|
|
259
280
|
|
|
260
|
-
- [[vocdoni-
|
|
281
|
+
- [[vocdoni-sequencer]] — the chain that stores these parameters and enforces them (`vochain/results/results.go`, `vochain/transaction/vote_rules.go`, `vochain/transaction/election_tx.go`).
|
|
282
|
+
- [[vocdoni-integrator-sdk]] — the current client; questions carry the raw `ballotProtocol`, and `@vocdoni/ballot` encodes and decodes it.
|
|
283
|
+
- [[vocdoni-sdk]] — the legacy `@vocdoni/sdk`, which produces and consumes ballots of this shape.
|
|
261
284
|
- `references/elections.md` — `IVoteType` fields that map to these protocol parameters.
|
|
262
285
|
- `references/election-types.md` — which preset (Approval/MultiChoice/Budget/Quadratic) sets which parameters.
|
|
263
286
|
- `references/voting.md` — `Vote([…])` shape per election kind.
|