@dogfood-lab/study-swarm 1.2.0 → 2.0.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/CHANGELOG.md +47 -0
- package/PROTOCOL.md +14 -2
- package/README.es.md +26 -3
- package/README.fr.md +26 -3
- package/README.hi.md +26 -3
- package/README.it.md +26 -3
- package/README.ja.md +26 -3
- package/README.md +26 -3
- package/README.pt-BR.md +26 -3
- package/README.zh.md +26 -3
- package/SECURITY.md +2 -2
- package/bin/study-swarm.mjs +529 -30
- package/examples/study-swarm-canon-rollback.dispatch.md +97 -0
- package/examples/study-swarm-canon-rollback.lock.json +78 -0
- package/examples/study-swarm-canon-rollback.orchestration.json +761 -0
- package/examples/study-swarm-ci.yml +3 -0
- package/examples/study-swarm-lock.dispatch.md +3 -3
- package/examples/study-swarm-lock.lock.json +15 -15
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -75,9 +75,14 @@ npm i -g @dogfood-lab/study-swarm # or run ad-hoc: npx @dogfood-lab/study-sw
|
|
|
75
75
|
|---|---|
|
|
76
76
|
| `study-swarm protocol` | Print the full protocol — the five steps, the halt table, the sourcing standard. |
|
|
77
77
|
| `study-swarm new <slug>` | Scaffold a `<slug>.dispatch.md` with the five-step skeleton to fill in. |
|
|
78
|
-
| `study-swarm lint [--json] <path…>` | Check a dispatch's *Research grounding* against the sourcing standard — every finding needs an author, a year, and a resolvable identifier (arXiv / DOI / URL); "studies show…" hand-waving is rejected. Exit `1` on violations, so it gates CI. A `<path>` may be a file, a directory (linted recursively for `*.dispatch.md`), or `-` for stdin; `--json` emits a machine-readable report. |
|
|
78
|
+
| `study-swarm lint [--json] [--strict] <path…>` | Check a dispatch's *Research grounding* against the sourcing standard — every finding needs an author, a year, and a resolvable identifier (arXiv / DOI / URL / RFC); "studies show…" hand-waving is rejected. Exit `1` on violations, so it gates CI. A `<path>` may be a file, a directory (linted recursively for `*.dispatch.md`), or `-` for stdin; `--json` emits a machine-readable report. `--strict` additionally flags **orphan citations** — a finding no Step-5 choice references — since "citations without a connection are noise" (opt-in, so the default CI gate is unchanged). |
|
|
79
|
+
| `study-swarm lock --init <dispatch>` | Scaffold `<dispatch>.orchestration.json` — a fill-in-the-blanks harness record (one step per Step-2 agent) to feed to `lock … --from`. |
|
|
79
80
|
| `study-swarm lock <dispatch> --from <orchestration.json>` | Pin a dispatch for replay — write `<dispatch>.lock.json` content-addressing, per Step-2 agent, the **resolved model id** + the **SHA-256 of the byte-exact prompt** + the **SHA-256 of the tool schema**, plus the Step-4 **verifier receipt**, rolled into one `lock_sha256`. |
|
|
80
81
|
| `study-swarm lock --verify <dispatch> [--from …]` | Re-derive those hashes and assert they match the lock; any drift exits `1`, so it gates CI like a package lockfile. Without `--from`, checks the lock's own integrity. |
|
|
82
|
+
| `study-swarm withdraw <id> --reason <reason> [--from <dir>] [--receipt <path>]` | **Canon-rollback compensator.** Flag every dispatch in the corpus whose *Research grounding* cites `<id>` as `evidence-withdrawn` (a tombstone sidecar `<slug>.withdrawn.json` — flag, never delete) and emit a content-addressed withdrawal receipt. `--reason` ∈ `fabricated · misattributed · retracted · verifier-flipped · other`. |
|
|
83
|
+
| `study-swarm requalify --check <corpus-dir>` | Fail closed (exit `1`) for any dispatch carrying an unresolved `evidence-withdrawn` flag — the andon that **halts** a withdrawn finding's dependents until it is removed or re-grounded. Gates CI. |
|
|
84
|
+
| `study-swarm requalify --status <corpus-dir> [--json]` | Read-only evidence-health **view** of a corpus — withdrawn vs resolved counts, a breakdown by reason and resolution mode, per-dispatch lines. Informational (exit `0`), unlike the `--check` gate. |
|
|
85
|
+
| `study-swarm requalify --resolve <dispatch> <id> --mode removed\|regrounded [--note …]` | Clear a flag once the finding is removed (the citation is gone) or re-grounded (re-verified clean by the sibling runner; `--note` records the attestation). Idempotent; appends to the sidecar's audit trail. |
|
|
81
86
|
|
|
82
87
|
`lint` is deterministic — zero model calls — so it's safe in CI. It enforces **Step 3's sourcing standard** locally; the model-based **Step 4** verification still defers to [`roleos verify-citations`](https://github.com/mcp-tool-shop-org/role-os) → prism.
|
|
83
88
|
|
|
@@ -90,7 +95,7 @@ study-swarm lint my-decision.dispatch.md # enforce the sourcing standard
|
|
|
90
95
|
roleos verify-citations my-decision.dispatch.md # model-based Step 4 (different family, via prism)
|
|
91
96
|
```
|
|
92
97
|
|
|
93
|
-
|
|
98
|
+
Four complete, lint-clean worked dispatches ship as references: [`examples/study-swarm-self.dispatch.md`](examples/study-swarm-self.dispatch.md) (the protocol's central decision, compact), [`examples/study-swarm-v1_1.dispatch.md`](examples/study-swarm-v1_1.dispatch.md) (the full v1.1 design pass — 27 citations, every one externally verified), [`examples/study-swarm-lock.dispatch.md`](examples/study-swarm-lock.dispatch.md) (the v1.2 lock design — 39 citations, gated through the runner, and the first dispatch to ship its own lock), and [`examples/study-swarm-canon-rollback.dispatch.md`](examples/study-swarm-canon-rollback.dispatch.md) (the v1.3 canon-rollback design — 27 citations across revocation, retraction, sagas, and build-invalidation, and the first dispatch to be withdrawn-then-requalified).
|
|
94
99
|
|
|
95
100
|
### Gate it in CI
|
|
96
101
|
|
|
@@ -109,11 +114,15 @@ concurrency:
|
|
|
109
114
|
jobs:
|
|
110
115
|
lint:
|
|
111
116
|
runs-on: ubuntu-latest
|
|
117
|
+
timeout-minutes: 5
|
|
112
118
|
steps:
|
|
113
119
|
- uses: actions/checkout@v4
|
|
114
120
|
- uses: actions/setup-node@v4
|
|
115
121
|
with: { node-version: '20' }
|
|
116
122
|
- run: npx @dogfood-lab/study-swarm@latest lint dispatches/
|
|
123
|
+
# Halt the build while any finding that became canon is withdrawn and not yet
|
|
124
|
+
# removed or re-grounded — the canon-rollback andon (exit 1 on any unresolved flag).
|
|
125
|
+
- run: npx @dogfood-lab/study-swarm@latest requalify --check dispatches/
|
|
117
126
|
```
|
|
118
127
|
|
|
119
128
|
### Pin a dispatch for replay (`dispatch.lock.json`)
|
|
@@ -122,6 +131,20 @@ A grounded, verified dispatch is only auditable if you can say *what produced it
|
|
|
122
131
|
|
|
123
132
|
**It pins inputs, not outputs.** Pinning model + prompt + temperature does *not* make an LLM's output bit-identical — batch-invariance, floating-point non-associativity, mixture-of-experts routing, and silent provider drift are all outside an offline tool's control. So the lock gives you **replayable inputs and drift-detectable outputs**, never "deterministic replay." The design is grounded, citation by citation, in [`examples/study-swarm-lock.dispatch.md`](examples/study-swarm-lock.dispatch.md) — the first dispatch to ship its own lock ([`examples/study-swarm-lock.lock.json`](examples/study-swarm-lock.lock.json)).
|
|
124
133
|
|
|
134
|
+
### Roll back a withdrawn finding (`withdraw` / `requalify`)
|
|
135
|
+
|
|
136
|
+
A verified finding becomes **canon** — it informs a downstream decision. So what happens when it's later **withdrawn** (a citation turns out fabricated/misattributed on a re-run, a cited paper is retracted, or the gate flips it)? A `git revert` is not enough, because the finding already propagated. The canon-rollback compensator makes the cleanup executable:
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
study-swarm withdraw arXiv:2402.15089 --reason misattributed --from dispatches/ --receipt rollback.json
|
|
140
|
+
# → flags every dispatch citing it `evidence-withdrawn` (a tombstone sidecar — flag, never delete)
|
|
141
|
+
# and writes a content-addressed withdrawal receipt naming every dependent.
|
|
142
|
+
study-swarm requalify --check dispatches/ # exit 1 while any flag is unresolved — the andon HALT
|
|
143
|
+
study-swarm requalify --resolve d.dispatch.md arXiv:2402.15089 --mode removed # or: --mode regrounded --note "<attestation>"
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
`requalify --check` **fails closed** until each flagged finding is removed or **re-grounded** (re-verified clean by the sibling runner — the CLI records the attestation, it does not itself re-verify). The withdrawal is surfaced **contrastively**, never as a silent drop. Everything — the tombstone and the receipt — is content-addressed and drift-detectable, and operates on the *evidence* layer only: `lock --verify` is untouched by a withdraw. The design is grounded in [`examples/study-swarm-canon-rollback.dispatch.md`](examples/study-swarm-canon-rollback.dispatch.md), and the [PROTOCOL.md](PROTOCOL.md) §"Compensating a withdrawn finding" is the executable shape. This is the **NAMED_COMPENSATORS** standard made executable: a named, idempotent undo that leaves a known post-state and a receipt.
|
|
147
|
+
|
|
125
148
|
## Why it works, in one breath
|
|
126
149
|
|
|
127
150
|
**Current** — the field moves fast; demanding specific studies-with-years keeps designs from shipping 18 months behind. **Functional** — evidence shows what *fails*, not just what works (explanations can increase over-reliance on *wrong* AI — Bansal et al. 2021, [arXiv:2006.14779](https://arxiv.org/abs/2006.14779)). **Safe** — the verifier-protected envelope is the architecture the evidence supports, and the protocol enforces it on its own output. Sourcing isn't academic theater; it's the evidence trail.
|
|
@@ -132,7 +155,7 @@ A grounded, verified dispatch is only auditable if you can say *what produced it
|
|
|
132
155
|
|
|
133
156
|
## Status
|
|
134
157
|
|
|
135
|
-
A working protocol, externally verified by its own machinery — a different model family checks its citations (see the proof above). **v1.1** sharpens the verifier where the first release was silent: decomposed/ternary groundedness, generation-time grounding, an oracle-gated cascade for combining lenses, and calibrated abstention — each grounded in the verified v1.1 dispatch. **v1.2** makes a dispatch byte-replayable: `study-swarm lock` pins the resolved model, prompt, and tool schema per step plus the verifier receipt, and `lock --verify` fails closed on drift. This repo is the public reference; [PROTOCOL.md](PROTOCOL.md) is the executable shape. Part of the [dogfood-lab](https://github.com/dogfood-lab) family — methods and showcases for building in the AI era.
|
|
158
|
+
A working protocol, externally verified by its own machinery — a different model family checks its citations (see the proof above). **v1.1** sharpens the verifier where the first release was silent: decomposed/ternary groundedness, generation-time grounding, an oracle-gated cascade for combining lenses, and calibrated abstention — each grounded in the verified v1.1 dispatch. **v1.2** makes a dispatch byte-replayable: `study-swarm lock` pins the resolved model, prompt, and tool schema per step plus the verifier receipt, and `lock --verify` fails closed on drift. **v1.3** makes the rollback executable: when a finding that already became canon is withdrawn, `study-swarm withdraw` flags every dependent and `requalify --check` halts them fail-closed until they're removed or re-grounded — a named, receipted, idempotent compensator. **v2.0** makes more of the protocol executable and hardens the lock: `lint --strict` flags orphan citations — the one named failure mode the CLI couldn't catch — `lock --init` scaffolds the harness record, `requalify --status` reads a corpus's evidence health, and the lock's content-addressing is domain-separated (artifact schema v2 — a lock from an earlier version is regenerated rather than mis-flagged as tampered; the CLI's command surface stays backward-compatible). This repo is the public reference; [PROTOCOL.md](PROTOCOL.md) is the executable shape. Part of the [dogfood-lab](https://github.com/dogfood-lab) family — methods and showcases for building in the AI era.
|
|
136
159
|
|
|
137
160
|
MIT licensed.
|
|
138
161
|
|
package/README.pt-BR.md
CHANGED
|
@@ -75,9 +75,14 @@ npm i -g @dogfood-lab/study-swarm # or run ad-hoc: npx @dogfood-lab/study-sw
|
|
|
75
75
|
|---|---|
|
|
76
76
|
| `study-swarm protocol` | Imprime o protocolo completo – as cinco etapas, a tabela de interrupção e o padrão de referência. |
|
|
77
77
|
| `study-swarm new <slug>` | Cria um arquivo `<slug>.dispatch.md` com o esqueleto das cinco etapas para preencher. |
|
|
78
|
-
| `study-swarm lint [--json] <path…>` |
|
|
78
|
+
| `study-swarm lint [--json] [--strict] <path…>` | Verifique a *base de pesquisa* de um relatório em relação ao padrão de fontes – cada conclusão deve ter um autor, um ano e um identificador que possa ser localizado (arXiv / DOI / URL / RFC); argumentos vagos do tipo "estudos mostram…" são rejeitados. Retorne `1` em caso de violações, para que isso impeça a execução do CI. Um `<caminho>` pode ser um arquivo, um diretório (verificado recursivamente para `*.dispatch.md`) ou `-` para entrada padrão; `--json` gera um relatório legível por máquina. `--strict` também sinaliza **citações órfãs** – uma conclusão que nenhuma escolha da Etapa 5 referencia –, já que "citações sem conexão são ruído" (opcional, portanto, a configuração padrão do CI permanece inalterada). |
|
|
79
|
+
| `study-swarm lock --init <dispatch>` | Crie o arquivo `<dispatch>.orchestration.json` – um modelo de registro para preencher os campos (uma etapa por agente da Etapa 2) para fornecer ao comando `lock … --from`. |
|
|
79
80
|
| `study-swarm lock <dispatch> --from <orchestration.json>` | Fixe um envio para reprodução – crie o arquivo `<dispatch>.lock.json` com informações de conteúdo, conforme o agente da Etapa 2, incluindo o **ID do modelo resolvido** + o **SHA-256 do prompt exato em bytes** + o **SHA-256 do esquema da ferramenta**, mais o **comprovante do verificador** da Etapa 4, tudo reunido em um único arquivo `lock_sha256`. |
|
|
80
81
|
| `study-swarm lock --verify <dispatch> [--from …]` | Recalcule esses hashes e verifique se correspondem ao bloqueio; qualquer desvio resulta em saída `1`, portanto, controla o CI como um arquivo de bloqueio de pacote. Sem `--from`, verifica a própria integridade do bloqueio. |
|
|
82
|
+
| `study-swarm withdraw <id> --reason <reason> [--from <dir>] [--receipt <path>]` | **Mecanismo de compensação para reversão do canon.** Marcar cada registro no corpus cujo *fundamento da pesquisa* cite `<id>` como `evidência-retirada` (um arquivo auxiliar `<slug>.withdrawn.json` — marcar, nunca excluir) e emitir um comprovante de retirada com base no conteúdo. `--reason` ∈ `fabricado · atribuído incorretamente · revogado · verificador alterado · outro`. |
|
|
83
|
+
| `study-swarm requalify --check <corpus-dir>` | Falhar em modo fechado (sair com código `1`) para qualquer registro que contenha uma marcação `evidência-retirada` não resolvida — o sinalizador que **interrompe** os elementos dependentes de um resultado retirado até que seja removido ou reavaliado. Gates CI. |
|
|
84
|
+
| `study-swarm requalify --status <corpus-dir> [--json]` | Visualização somente leitura do estado de validade das evidências de um corpus – contagem de conclusões retiradas versus resolvidas, uma divisão por motivo e modo de resolução, linhas por relatório. Informativo (retorna `0`), diferente da verificação `--check`. |
|
|
85
|
+
| `study-swarm requalify --resolve <registro> <id> --mode removed\ | regrounded [--note …]` | Remover uma marcação assim que o resultado for removido (a citação desaparecer) ou reavaliado (reverificado e validado pelo executor irmão; `--note` registra a confirmação). Idempotente; adiciona ao histórico de auditoria do arquivo auxiliar. |
|
|
81
86
|
|
|
82
87
|
`lint` é determinístico – sem chamadas de modelo – portanto, é seguro no CI. Ele aplica o **padrão de referência da Etapa 3** localmente; a verificação baseada em modelo da **Etapa 4** ainda depende de [`roleos verify-citations`](https://github.com/mcp-tool-shop-org/role-os) → prism.
|
|
83
88
|
|
|
@@ -90,7 +95,7 @@ study-swarm lint my-decision.dispatch.md # enforce the sourcing standard
|
|
|
90
95
|
roleos verify-citations my-decision.dispatch.md # model-based Step 4 (different family, via prism)
|
|
91
96
|
```
|
|
92
97
|
|
|
93
|
-
|
|
98
|
+
Quatro registros completos, limpos e funcionais são enviados como referência: [`examples/study-swarm-self.dispatch.md`](examples/study-swarm-self.dispatch.md) (a decisão central do protocolo, concisa), [`examples/study-swarm-v1_1.dispatch.md`](examples/study-swarm-v1_1.dispatch.md) (o design completo da versão 1.1 — 27 citações, todas verificadas externamente), [`examples/study-swarm-lock.dispatch.md`](examples/study-swarm-lock.dispatch.md) (o design de bloqueio da versão 1.2 — 39 citações, controlado pelo executor e o primeiro registro a enviar seu próprio bloqueio) e [`examples/study-swarm-canon-rollback.dispatch.md`](examples/study-swarm-canon-rollback.dispatch.md) (o design de reversão do canon da versão 1.3 — 27 citações em relação à revogação, retração, sequências e invalidação da construção, e o primeiro registro a ser retirado e depois reavaliado).
|
|
94
99
|
|
|
95
100
|
### Valide no CI
|
|
96
101
|
|
|
@@ -109,11 +114,15 @@ concurrency:
|
|
|
109
114
|
jobs:
|
|
110
115
|
lint:
|
|
111
116
|
runs-on: ubuntu-latest
|
|
117
|
+
timeout-minutes: 5
|
|
112
118
|
steps:
|
|
113
119
|
- uses: actions/checkout@v4
|
|
114
120
|
- uses: actions/setup-node@v4
|
|
115
121
|
with: { node-version: '20' }
|
|
116
122
|
- run: npx @dogfood-lab/study-swarm@latest lint dispatches/
|
|
123
|
+
# Halt the build while any finding that became canon is withdrawn and not yet
|
|
124
|
+
# removed or re-grounded — the canon-rollback andon (exit 1 on any unresolved flag).
|
|
125
|
+
- run: npx @dogfood-lab/study-swarm@latest requalify --check dispatches/
|
|
117
126
|
```
|
|
118
127
|
|
|
119
128
|
### Fixe um envio para reprodução (`dispatch.lock.json`)
|
|
@@ -122,6 +131,20 @@ Um envio validado e comprovado só pode ser auditado se você puder dizer *o que
|
|
|
122
131
|
|
|
123
132
|
**Ele fixa as entradas, não as saídas.** Fixar modelo + prompt + temperatura *não* torna a saída de um LLM bit a bit idêntica – invariância em lote, não associatividade de ponto flutuante, roteamento de mistura de especialistas e desvio silencioso do provedor estão todos fora do controle de uma ferramenta offline. Portanto, o bloqueio fornece **entradas reproduzíveis e saídas com detecção de desvio**, nunca "reprodução determinística". O design é fundamentado, citação por citação, em [`examples/study-swarm-lock.dispatch.md`](examples/study-swarm-lock.dispatch.md) – o primeiro envio a incluir seu próprio bloqueio ([`examples/study-swarm-lock.lock.json`](examples/study-swarm-lock.lock.json)).
|
|
124
133
|
|
|
134
|
+
### Reverter um resultado retirado (`withdraw` / `requalify`)
|
|
135
|
+
|
|
136
|
+
Um resultado verificado torna-se **canon** — ele informa uma decisão subsequente. Então, o que acontece quando ele é posteriormente **retirado** (uma citação se revela fabricada/atribuída incorretamente em uma nova execução, um artigo citado é retirado ou o controle o altera)? Um `git revert` não é suficiente, porque o resultado já foi propagado. O mecanismo de compensação para reversão do canon torna a limpeza executável:
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
study-swarm withdraw arXiv:2402.15089 --reason misattributed --from dispatches/ --receipt rollback.json
|
|
140
|
+
# → flags every dispatch citing it `evidence-withdrawn` (a tombstone sidecar — flag, never delete)
|
|
141
|
+
# and writes a content-addressed withdrawal receipt naming every dependent.
|
|
142
|
+
study-swarm requalify --check dispatches/ # exit 1 while any flag is unresolved — the andon HALT
|
|
143
|
+
study-swarm requalify --resolve d.dispatch.md arXiv:2402.15089 --mode removed # or: --mode regrounded --note "<attestation>"
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
`requalify --check` **falha em modo fechado** até que cada resultado marcado seja removido ou **reavaliado** (reverificado e validado pelo executor irmão — a CLI registra a confirmação, não o faz por conta própria). A retirada é apresentada de forma **contrastante**, nunca como uma remoção silenciosa. Tudo — o arquivo auxiliar e o comprovante — tem base no conteúdo e pode ser detectado em caso de desvio, e opera apenas na camada de *evidência*: `lock --verify` não é afetado por uma retirada. O design é baseado em [`examples/study-swarm-canon-rollback.dispatch.md`](examples/study-swarm-canon-rollback.dispatch.md), e o [PROTOCOL.md](PROTOCOL.md) §"Compensando um resultado retirado" é a forma executável. Este é o padrão **NAMED_COMPENSATORS** tornado executável: uma operação de desfazer nomeada e idempotente que deixa um estado pós-operacional conhecido e um comprovante.
|
|
147
|
+
|
|
125
148
|
## Por que funciona, em poucas palavras
|
|
126
149
|
|
|
127
150
|
**Atual** – o campo evolui rapidamente; exigir estudos específicos com anos evita que os projetos sejam lançados com 18 meses de atraso. **Funcional** – a evidência mostra o que *falha*, não apenas o que funciona (explicações podem aumentar a dependência excessiva em IA *incorreta* – Bansal et al. 2021, [arXiv:2006.14779](https://arxiv.org/abs/2006.14779)). **Seguro** – o envelope protegido pelo verificador é a arquitetura que a evidência suporta, e o protocolo a aplica em sua própria saída. A referência não é um exercício acadêmico; é o rastro da evidência.
|
|
@@ -132,7 +155,7 @@ Um envio validado e comprovado só pode ser auditado se você puder dizer *o que
|
|
|
132
155
|
|
|
133
156
|
## Status
|
|
134
157
|
|
|
135
|
-
Um protocolo funcional, verificado externamente por
|
|
158
|
+
Um protocolo funcional, verificado externamente por seu próprio mecanismo – uma família de modelos diferente verifica suas citações (veja a prova acima). A **versão 1.1** aprimora o verificador, onde a primeira versão estava silenciosa: base de pesquisa decomposta/ternária, base de pesquisa no momento da geração, um sistema em cascata controlado por um oráculo para combinar lentes e abstinência calibrada – cada um baseado na verificação da versão 1.1 do relatório. A **versão 1.2** torna um relatório reproduzível: `study-swarm lock` fixa o modelo, o prompt e o esquema de ferramentas resolvidos por etapa, além do recibo do verificador, e `lock --verify` falha se houver desvio. A **versão 1.3** torna a reversão executável: quando uma conclusão que já se tornou um padrão é retirada, `study-swarm withdraw` sinaliza todas as dependências e `requalify --check` interrompe sua execução até que sejam removidas ou reavaliadas – um compensador nomeado, com recibo e idempotente. A **versão 2.0** torna mais partes do protocolo executáveis e reforça o bloqueio: `lint --strict` sinaliza citações órfãs – a única falha detectável pela CLI –, `lock --init` cria o modelo de registro, `requalify --status` lê o estado de validade das evidências de um corpus e o endereçamento de conteúdo do bloqueio é separado por domínio (esquema de artefato v2 – um bloqueio de uma versão anterior é regenerado em vez de ser sinalizado incorretamente como adulterado; a interface de linha de comando permanece compatível com versões anteriores). Este repositório é a referência pública; [PROTOCOL.md](PROTOCOL.md) é a forma executável. Parte da família [dogfood-lab](https://github.com/dogfood-lab) – métodos e demonstrações para construir na era da IA.
|
|
136
159
|
|
|
137
160
|
Licenciado sob MIT.
|
|
138
161
|
|
package/README.zh.md
CHANGED
|
@@ -75,9 +75,14 @@ npm i -g @dogfood-lab/study-swarm # or run ad-hoc: npx @dogfood-lab/study-sw
|
|
|
75
75
|
|---|---|
|
|
76
76
|
| `study-swarm protocol` | 打印完整的协议——五个步骤、停止表以及来源标准。 |
|
|
77
77
|
| `study-swarm new <slug>` | 创建一个`<slug>.dispatch.md`文件,其中包含五步流程的框架,以便进行填充。 |
|
|
78
|
-
| `study-swarm lint [--json] <path…>` |
|
|
78
|
+
| `study-swarm lint [--json] [--strict] <path…>` | 检查某个报告的“研究依据”,并对照来源标准进行验证——每个发现都需要有作者、年份和可解析的标识符(arXiv / DOI / URL / RFC);禁止使用含糊不清的表述,例如“研究表明……”。如果存在违规情况,则返回 `1`,从而阻止 CI 流程。`<path>` 可以是文件、目录(递归地检查所有 `*.dispatch.md` 文件),或者 `-` 表示标准输入;`--json` 会输出机器可读的报告。`--strict` 还会标记“孤立引用”——即某个发现没有被任何第五步选项引用,因为“没有关联的引用是无用的”(可选功能,因此默认的 CI 流程不会改变)。 |
|
|
79
|
+
| `study-swarm lock --init <dispatch>` | 生成 `<dispatch>.orchestration.json` 文件——这是一个填空式的框架记录(每个步骤对应一个第二步中的代理),用于提供给 `lock … --from` 命令。 |
|
|
79
80
|
| `study-swarm lock <dispatch> --from <orchestration.json>` | 将一个调度固定下来以便重放——编写 `<dispatch>.lock.json`,其中包含基于内容的哈希值,按照步骤 2 中的代理进行操作,包括**已解析的模型 ID** + **字节级精确提示的 SHA-256 值** + **工具模式的 SHA-256 值**,以及步骤 4 中的**验证者凭证**,并将它们组合成一个 `lock_sha256`。 |
|
|
80
81
|
| `study-swarm lock --verify <dispatch> [--from …]` | 重新计算这些哈希值并确认它们与锁匹配;如果出现任何偏差,则退出并返回 1,因此它就像软件包的 lock 文件一样,可以控制 CI 流程。如果不使用 `--from` 参数,则会检查锁自身的完整性。 |
|
|
82
|
+
| `study-swarm withdraw <id> --reason <reason> [--from <dir>] [--receipt <path>]` | **规范回滚补偿器。** 标记语料库中每个引用 `<id>` 作为“证据已撤回”(一个墓碑侧文件 `<slug>.withdrawn.json`——标记,永不删除)的文档,并生成基于内容的撤回凭证。 `--reason` ∈ `fabricated · misattributed · retracted · verifier-flipped · other`。 |
|
|
83
|
+
| `study-swarm requalify --check <corpus-dir>` | 对于任何带有未解决的“证据已撤回”标志的文档,执行失败安全机制(退出代码为 `1`)——这是一种“andon”(警报),它会**阻止**已撤回结论的依赖项,直到该结论被删除或重新验证。用于门控 CI。 |
|
|
84
|
+
| `study-swarm requalify --status <corpus-dir> [--json]` | 以只读方式查看语料库的“证据健康状况”——包括已撤回和已解决的数量、按原因和解决方法分类,以及每个报告的行数。这是一个信息性输出(返回 `0`),与 `--check` 流程不同。 |
|
|
85
|
+
| `study-swarm requalify --resolve <dispatch> <id> --mode removed\ | regrounded [--note …]` | 一旦该结论被删除(引用消失)或重新验证(由辅助运行器重新验证;`--note` 记录证明),则清除标志。幂等性;附加到侧文件的审计跟踪中。 |
|
|
81
86
|
|
|
82
87
|
`lint`是确定性的——不调用任何模型——因此可以在CI中安全使用。它在本地强制执行**第3步的来源标准**;基于模型的**第4步**验证仍然依赖于[`roleos verify-citations`](https://github.com/mcp-tool-shop-org/role-os) → prism。
|
|
83
88
|
|
|
@@ -90,7 +95,7 @@ study-swarm lint my-decision.dispatch.md # enforce the sourcing standard
|
|
|
90
95
|
roleos verify-citations my-decision.dispatch.md # model-based Step 4 (different family, via prism)
|
|
91
96
|
```
|
|
92
97
|
|
|
93
|
-
|
|
98
|
+
四个完整的、经过代码检查的文档作为参考发布:[`examples/study-swarm-self.dispatch.md`](examples/study-swarm-self.dispatch.md)(协议的核心决策,简洁),[`examples/study-swarm-v1_1.dispatch.md`](examples/study-swarm-v1_1.dispatch.md)(完整的 v1.1 设计版本——27 个引用,每个引用都经过外部验证),[`examples/study-swarm-lock.dispatch.md`](examples/study-swarm-lock.dispatch.md)(v1.2 锁定设计——39 个引用,通过运行器进行门控,并且是第一个发布其自身锁定的文档),以及 [`examples/study-swarm-canon-rollback.dispatch.md`](examples/study-swarm-canon-rollback.dispatch.md)(v1.3 规范回滚设计——27 个引用,涵盖撤销、撤稿、连续事件和构建失效,并且是第一个被撤回然后重新验证的文档)。
|
|
94
99
|
|
|
95
100
|
### 在CI中进行筛选
|
|
96
101
|
|
|
@@ -109,11 +114,15 @@ concurrency:
|
|
|
109
114
|
jobs:
|
|
110
115
|
lint:
|
|
111
116
|
runs-on: ubuntu-latest
|
|
117
|
+
timeout-minutes: 5
|
|
112
118
|
steps:
|
|
113
119
|
- uses: actions/checkout@v4
|
|
114
120
|
- uses: actions/setup-node@v4
|
|
115
121
|
with: { node-version: '20' }
|
|
116
122
|
- run: npx @dogfood-lab/study-swarm@latest lint dispatches/
|
|
123
|
+
# Halt the build while any finding that became canon is withdrawn and not yet
|
|
124
|
+
# removed or re-grounded — the canon-rollback andon (exit 1 on any unresolved flag).
|
|
125
|
+
- run: npx @dogfood-lab/study-swarm@latest requalify --check dispatches/
|
|
117
126
|
```
|
|
118
127
|
|
|
119
128
|
### 将一个调度固定下来以便重放 (`dispatch.lock.json`)
|
|
@@ -122,6 +131,20 @@ jobs:
|
|
|
122
131
|
|
|
123
132
|
**它固定输入,而不是输出。** 固定模型 + 提示 + 温度并不能使 LLM 的输出完全相同——批处理不变性、浮点数非结合律、混合专家路由以及无声提供者漂移都超出了离线工具的控制范围。因此,该锁为您提供**可重放的输入和可检测偏差的输出**,而不是“确定性重放”。该设计基于 [`examples/study-swarm-lock.dispatch.md`](examples/study-swarm-lock.dispatch.md) 中的每一处引用,并且是第一个发布其自身锁([`examples/study-swarm-lock.lock.json`](examples/study-swarm-lock.lock.json))的调度文件。
|
|
124
133
|
|
|
134
|
+
### 回滚已撤回的结论 (`withdraw` / `requalify`)
|
|
135
|
+
|
|
136
|
+
经过验证的结论成为**规范**——它会影响下游决策。那么,如果稍后该结论被**撤回**(在重新运行时发现引用是捏造/错误归因,引用的论文被撤稿,或者门控机制将其标记),会发生什么?简单的 `git revert` 并不足以解决问题,因为该结论已经传播开来。规范回滚补偿器使清理过程可执行:
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
study-swarm withdraw arXiv:2402.15089 --reason misattributed --from dispatches/ --receipt rollback.json
|
|
140
|
+
# → flags every dispatch citing it `evidence-withdrawn` (a tombstone sidecar — flag, never delete)
|
|
141
|
+
# and writes a content-addressed withdrawal receipt naming every dependent.
|
|
142
|
+
study-swarm requalify --check dispatches/ # exit 1 while any flag is unresolved — the andon HALT
|
|
143
|
+
study-swarm requalify --resolve d.dispatch.md arXiv:2402.15089 --mode removed # or: --mode regrounded --note "<attestation>"
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
`requalify --check` 在每个带有标志的结论被删除或**重新验证**(由辅助运行器重新验证——CLI 记录证明,它本身不会重新验证)之前,将**失败安全**。撤回以**对比方式**呈现,而不是默默地删除。所有内容——墓碑和凭证——都基于内容进行寻址且可检测漂移,并且仅对*证据*层进行操作:`lock --verify` 不受撤回的影响。该设计基于 [`examples/study-swarm-canon-rollback.dispatch.md`](examples/study-swarm-canon-rollback.dispatch.md),并且 [PROTOCOL.md](PROTOCOL.md) §“补偿已撤回的结论”是可执行的形式。这是**NAMED_COMPENSATORS** 标准的可执行版本:一种命名的、幂等的撤销操作,它会留下一个已知的后期状态和一个凭证。
|
|
147
|
+
|
|
125
148
|
## 用一句话概括其工作原理
|
|
126
149
|
|
|
127
150
|
**及时性**——该领域发展迅速;要求提供具体的带有年份的研究,可以防止设计落后18个月。**功能性**——证据表明哪些*方法失败*,而不仅仅是哪些有效(解释可能会增加对*错误*人工智能的过度依赖——Bansal等人,2021年,[arXiv:2006.14779](https://arxiv.org/abs/2006.14779))。**安全性**——受验证器保护的范围是证据支持的架构,并且协议对其自身的输出进行强制执行。来源不是学术上的形式主义;它是证据链。
|
|
@@ -132,7 +155,7 @@ jobs:
|
|
|
132
155
|
|
|
133
156
|
## 状态
|
|
134
157
|
|
|
135
|
-
|
|
158
|
+
一个可行的协议,通过其自身的机制进行外部验证——不同的模型系列会检查其引用(参见上面的证明)。**v1.1** 版本改进了验证器,解决了首次发布版本中存在的不足:分解/三元依据、生成时间依据、用于组合不同视角的基于预言机的级联方法以及校准的弃权机制——所有这些都以经过验证的 v1.1 报告为基础。**v1.2** 版本使报告能够进行字节级别的重放:`study-swarm lock` 命令会固定每个步骤中已解决的模型、提示和工具模式,以及验证器收据;`lock --verify` 命令会在检测到漂移时停止流程。**v1.3** 版本使回滚操作可执行:当某个已经成为标准的事实被撤回时,`study-swarm withdraw` 命令会标记所有相关的依赖项,并且 `requalify --check` 命令会暂停这些依赖项的运行,直到它们被删除或重新验证——这是一个命名的、带有收据的、幂等的补偿器。**v2.0** 版本使协议中的更多部分可执行,并加强了锁定机制:`lint --strict` 命令会标记孤立引用——这是 CLI 无法捕获的唯一一种失败模式;`lock --init` 命令会生成框架记录;`requalify --status` 命令会读取语料库的证据健康状况;锁定的内容寻址是领域隔离的(工件模式 v2——来自早期版本的锁定会被重新生成,而不是被错误地标记为已篡改;CLI 的命令界面保持向后兼容)。此仓库是公共参考;[PROTOCOL.md](PROTOCOL.md) 是可执行的形式。它是 [dogfood-lab](https://github.com/dogfood-lab) 系列的一部分——用于构建人工智能时代的方法和示例。
|
|
136
159
|
|
|
137
160
|
采用MIT许可证。
|
|
138
161
|
|
package/SECURITY.md
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
## Threat model
|
|
6
6
|
|
|
7
|
-
- **What it runs:** a small Node CLI (Node >= 18). `protocol`, `version`, and `help` only print text. `lint <
|
|
8
|
-
- **What it does NOT do:** no network access, no model calls, no telemetry, no
|
|
7
|
+
- **What it runs:** a small Node CLI (Node >= 18). `protocol`, `version`, and `help` only print text. `lint <path…>` **reads** the files (or stdin) you name. `new <slug>` **writes** exactly one file — `<slug>.dispatch.md` — in the current working directory, and refuses to overwrite an existing file; the slug is sanitized to a single filename (path separators replaced with `-`, pure-dots slugs rejected), so `new` cannot write outside the current directory. `lock`, `withdraw`, and `requalify` **read** the dispatch / orchestration / sidecar files you name and **write** JSON artifacts at paths you supply: a `<dispatch>.lock.json` or `<dispatch>.withdrawn.json` co-located with the dispatch you point at, and (for `withdraw --receipt <path>`) a receipt at the exact path you give. Unlike `new`, these paths are taken as given — no traversal sanitization — because the commands operate on artifacts you name explicitly; they write where you point them (like `cp` or `tee`), never anywhere derived from untrusted input.
|
|
8
|
+
- **What it does NOT do:** no network access, no model calls, no telemetry, no use of credentials or environment beyond what Node needs to run, and no filesystem access beyond reading the inputs you name and writing the artifacts described above.
|
|
9
9
|
- **Secrets/credentials:** none in source or output.
|
|
10
10
|
- **Permissions required:** filesystem read for `lint`; one-file write (in the working directory) for `new`. Nothing else.
|
|
11
11
|
|