@dzhechkov/p-replicator 1.5.7 → 1.5.10

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 (25) hide show
  1. package/README/ru/html/build.js +11 -3
  2. package/package.json +1 -1
  3. package/src/commands/remove.js +16 -2
  4. package/src/commands/update.js +7 -0
  5. package/templates/.claude/rules/replicate-pipeline.md +16 -0
  6. package/templates/.claude/skills/brutal-honesty-review/scripts/assess-tests.sh +2 -2
  7. package/templates/.claude/skills/cc-toolkit-generator-enhanced/SKILL.md +1 -1
  8. package/templates/.claude/skills/cc-toolkit-generator-enhanced/modules/06-package-deliver.md +1 -1
  9. package/templates/.claude/skills/goap-research-ed25519/SKILL.md +81 -371
  10. package/templates/.claude/skills/goap-research-ed25519/references/ed25519-verification.md +58 -624
  11. package/templates/.claude/skills/goap-research-ed25519/references/research-actions.md +61 -506
  12. package/templates/.claude/skills/goap-research-ed25519/references/source-evaluation.md +42 -543
  13. package/templates/.claude/skills/goap-research-ed25519/scripts/ed25519_verifier.py +427 -448
  14. package/templates/.claude/skills/goap-research-ed25519/scripts/goap_planner.py +4 -4
  15. package/templates/.claude/skills/goap-research-ed25519/scripts/test_ed25519_verifier.py +112 -0
  16. package/templates/.claude/skills/knowledge-extractor/SKILL.md +1 -1
  17. package/templates/.claude/skills/pipeline-forge/SKILL.md +5 -1
  18. package/templates/.claude/skills/problem-solver-enhanced/SKILL.md +3 -0
  19. package/templates/.claude/skills/requirements-validator/SKILL.md +2 -2
  20. package/templates/.claude/skills/reverse-engineering-unicorn/SKILL.md +7 -2
  21. package/templates/.claude/skills/reverse-engineering-unicorn/modules/01-intelligence.md +15 -29
  22. package/templates/.claude/skills/reverse-engineering-unicorn/modules/02-product-customers.md +4 -4
  23. package/templates/.claude/skills/reverse-engineering-unicorn/modules/03-market-competition.md +9 -16
  24. package/templates/.claude/skills/reverse-engineering-unicorn/modules/04-business-finance.md +4 -3
  25. package/templates/.claude/skills/reverse-engineering-unicorn/modules/05-growth-engine.md +3 -2
@@ -186,7 +186,7 @@ function renderCode(code, lang) {
186
186
  }
187
187
 
188
188
  // ─── Main parser ──────────────────────────────────────────────────────────
189
- function parseMarkdown(md, idPrefix = '') {
189
+ function parseMarkdown(md, idPrefix = '', usedIds = new Set()) {
190
190
  // Normalize line endings
191
191
  const lines = md.replace(/\r\n/g, '\n').split('\n');
192
192
  const out = [];
@@ -228,7 +228,15 @@ function parseMarkdown(md, idPrefix = '') {
228
228
  const level = h[1].length;
229
229
  const text = h[2].trim();
230
230
  const baseId = slugify(text);
231
- const id = idPrefix && level > 1 ? `${idPrefix}-${baseId}` : baseId || idPrefix || 'section';
231
+ let id = idPrefix && level > 1 ? `${idPrefix}-${baseId}` : baseId || idPrefix || 'section';
232
+ // P3: de-duplicate heading slugs (GitHub-style -2/-3 suffix) so duplicate headings never emit
233
+ // duplicate `id` attributes (invalid HTML + hash-nav resolving only to the first occurrence).
234
+ if (usedIds.has(id)) {
235
+ let n = 2;
236
+ while (usedIds.has(`${id}-${n}`)) n++;
237
+ id = `${id}-${n}`;
238
+ }
239
+ usedIds.add(id);
232
240
  out.push(`<h${level} id="${escapeAttr(id)}">${processInline(text)}</h${level}>`);
233
241
  i++;
234
242
  continue;
@@ -248,7 +256,7 @@ function parseMarkdown(md, idPrefix = '') {
248
256
  qLines.push(lines[i].replace(/^>\s?/, ''));
249
257
  i++;
250
258
  }
251
- out.push(`<blockquote>${parseMarkdown(qLines.join('\n'), idPrefix)}</blockquote>`);
259
+ out.push(`<blockquote>${parseMarkdown(qLines.join('\n'), idPrefix, usedIds)}</blockquote>`);
252
260
  continue;
253
261
  }
254
262
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dzhechkov/p-replicator",
3
- "version": "1.5.7",
3
+ "version": "1.5.10",
4
4
  "description": "P-Replicator — Claude Code toolkit for AI-assisted product development (Vibe Coding). Full /replicate pipeline, 10 modular skills (194K+ chars), /harvest knowledge extraction, swarm agents, quality gates, security patterns, cross-project learning.",
5
5
  "main": "src/cli.js",
6
6
  "bin": {
@@ -37,7 +37,12 @@ function run(options) {
37
37
 
38
38
  if (existingFiles.length === 0) {
39
39
  warn('No files found to remove (already cleaned up?).');
40
- // Still remove manifest
40
+ // Dry run is a strict no-op — must NOT unregister the install (the P2 bug: this ran BEFORE the
41
+ // dryRun guard below, so `remove --dry-run` deleted the manifest on the already-cleaned path).
42
+ if (dryRun) {
43
+ warn(`Dry run — would remove ${MANIFEST_FILE} to unregister the (already-empty) install. Nothing written.`);
44
+ process.exit(0);
45
+ }
41
46
  const manifestPath = path.join(targetDir, MANIFEST_FILE);
42
47
  if (fileExists(manifestPath)) {
43
48
  fs.unlinkSync(manifestPath);
@@ -53,6 +58,7 @@ function run(options) {
53
58
 
54
59
  // ── c) Remove files ────────────────────────────────────────────────────
55
60
  let removed = 0;
61
+ const failed = [];
56
62
  for (const f of existingFiles) {
57
63
  const fullPath = path.join(targetDir, f);
58
64
  try {
@@ -60,6 +66,7 @@ function run(options) {
60
66
  removed++;
61
67
  } catch (err) {
62
68
  warn(`Could not remove: ${f} (${err.message})`);
69
+ failed.push(f);
63
70
  }
64
71
  }
65
72
 
@@ -88,9 +95,16 @@ function run(options) {
88
95
  }
89
96
 
90
97
  // ── e) Remove manifest ─────────────────────────────────────────────────
98
+ // P3: only unregister the install when EVERY tracked file was actually removed. If some failed
99
+ // (permissions, locked, read-only mount), keep the manifest so the survivors stay tracked and a
100
+ // later `remove`/`doctor` can still see + finish them — deleting it would strand them as orphans.
91
101
  const manifestPath = path.join(targetDir, MANIFEST_FILE);
92
102
  if (fileExists(manifestPath)) {
93
- fs.unlinkSync(manifestPath);
103
+ if (failed.length > 0) {
104
+ warn(`${failed.length} file(s) could not be removed — keeping ${MANIFEST_FILE} so they stay tracked (re-run remove after fixing permissions).`);
105
+ } else {
106
+ fs.unlinkSync(manifestPath);
107
+ }
94
108
  }
95
109
 
96
110
  console.log('');
@@ -50,6 +50,13 @@ function run(options) {
50
50
  console.log('');
51
51
 
52
52
  if (added.length === 0 && modified.length === 0) {
53
+ // P3: refresh the recorded version even when templates are byte-identical, so the manifest is not
54
+ // a STALE version record after a metadata-only release (doctor/update kept reporting the old
55
+ // installed version). Only the version field changes — no files touched.
56
+ if (manifest.version !== newVersion) {
57
+ writeManifest(targetDir, { ...manifest, version: newVersion });
58
+ info(`Version record refreshed to ${bold(newVersion)} (templates unchanged).`);
59
+ }
53
60
  success('Already up to date!');
54
61
  process.exit(0);
55
62
  }
@@ -11,6 +11,22 @@ Product Discovery Planning Validation Toolkit Finalize
11
11
 
12
12
  Never skip Phase 2 (Validation). Toolkit (Phase 3) MUST be built on validated documentation.
13
13
 
14
+ ### Optional: UI replication (post-pipeline)
15
+
16
+ When the goal includes rebuilding a target's **frontend** (not just the business/toolkit), the
17
+ `clone-website` skill — [`@dzhechkov/skills-website-cloner`](https://www.npmjs.com/package/@dzhechkov/skills-website-cloner),
18
+ the implementation counterpart to `reverse-engineering-unicorn` — produces a pixel-perfect
19
+ Next.js clone of a live site.
20
+
21
+ | Skill | Required | Purpose | Fallback |
22
+ |-------|----------|---------|----------|
23
+ | `clone-website` | OPTIONAL (external) | Reverse-engineer a live site → running Next.js/shadcn clone | use `frontend-design` to build a fresh UI, or skip |
24
+
25
+ **Reference, not vendored** (per ADR-0001). It is NOT one of the pre-shipped p-replicator skills
26
+ and has hard runtime prerequisites (a browser-MCP + a Next.js/shadcn/Tailwind scaffold). Install
27
+ separately: `npx @dzhechkov/skills-website-cloner init` or `dz init --select clone-website`. If
28
+ absent or its prerequisites are unmet, skip the UI-clone step and log a warning.
29
+
14
30
  ## Skill Loading Protocol
15
31
 
16
32
  When executing skills during the pipeline:
@@ -78,7 +78,7 @@ assess_edge_cases() {
78
78
  found_count=0
79
79
  for pattern in "${edge_case_patterns[@]}"; do
80
80
  if grep -ri "$pattern" "$TEST_DIR" > /dev/null 2>&1; then
81
- ((found_count++))
81
+ found_count=$((found_count+1))
82
82
  fi
83
83
  done
84
84
 
@@ -161,7 +161,7 @@ assess_stability() {
161
161
  failures=0
162
162
  for i in {1..3}; do
163
163
  if ! npm test > /dev/null 2>&1; then
164
- ((failures++))
164
+ failures=$((failures+1))
165
165
  fi
166
166
  done
167
167
 
@@ -419,7 +419,7 @@ Run in Phase 6 before delivery.
419
419
  | brutal-honesty-review | .claude/skills/ | P0 | Always |
420
420
  | idea2prd-manual | .claude/skills/ | P1 | IF DDD detected |
421
421
  | goap-research-ed25519 | .claude/skills/ | P1 | IF DDD detected |
422
- | feature-navigator | .claude/skills/ | P1 | Always (recommended) |
422
+ | feature-navigator | .claude/skills/ (GENERATED per-project by module 04 — NOT a module-08 copy-dependency) | P1 | Always (recommended) |
423
423
 
424
424
  ## Reusability
425
425
 
@@ -275,7 +275,7 @@ Scan targets:
275
275
 
276
276
  Scan patterns (all are CRITICAL if found):
277
277
 
278
- Pattern: {{[A-Z_]+}}
278
+ Pattern: {{[^}]+}} # ANY placeholder token — uppercase, lowercase, hyphenated, or spaced (was {{[A-Z_]+}}, which silently passed {{feature-id}}, {{Feature Name}})
279
279
  Examples: {{PROJECT_NAME}}, {{LANGUAGE}}, {{MAX_ENTITIES}}, {{TECH_KEYWORDS}}
280
280
  Action: Look up value in IPM and substitute
281
281
 
@@ -1,415 +1,125 @@
1
1
  ---
2
2
  name: goap-research-ed25519
3
- description: Advanced GOAP research system with Ed25519 cryptographic verification for anti-hallucination protection. Combines Goal-Oriented Action Planning with cryptographic signatures to ensure source authenticity, claim verification, and citation chain integrity. Use for high-stakes research requiring verifiable facts, competitive intelligence, legal/medical research, or any context where hallucination prevention is critical. Triggers on "verified research", "trusted sources only", "anti-hallucination", "signed sources", "cryptographic verification".
3
+ description: GOAP research system with Ed25519 provenance and tamper-evidence under pinned trusted-issuer keys. Use for high-stakes research that needs cited sources, explicit confidence, signed audit trails, or cryptographic proof of who signed a fact. Ed25519 does not prove truthfulness or prevent hallucination.
4
+ trust_tier: 1
5
+ trust_tier_label: "Structured"
6
+ trust_tier_path: "Run /bto-test to promote to Tier 2"
4
7
  ---
5
8
 
6
- # GOAP Research Skill with Ed25519 Verification
9
+ # GOAP Research with Ed25519 Provenance
7
10
 
8
- Advanced research system combining Goal-Oriented Action Planning (GOAP) with Ed25519 cryptographic verification for maximum anti-hallucination protection.
11
+ This skill combines Goal-Oriented Action Planning (GOAP), source evaluation, and optional Ed25519 signatures.
9
12
 
10
- ## Key Differentiators from Standard GOAP
13
+ Ed25519 provides cryptographic provenance and tamper-evidence under pinned trusted-issuer keys: it proves who signed the canonical message and that the signed bytes were not altered. It does not prove that the claim is true, prevent plagiarism, or replace ordinary source evaluation.
11
14
 
12
- | Feature | Standard GOAP | GOAP-Ed25519 |
13
- |---------|---------------|--------------|
14
- | Source Trust | Reliability scoring (1-5) | Cryptographic signatures + scoring |
15
- | Claim Verification | Cross-reference | Cross-reference + signature chain |
16
- | Anti-Hallucination | Triangulation | Triangulation + mandatory citations |
17
- | Audit Trail | Research path log | Signed verification ledger |
18
- | Trust Anchors | Editorial reputation | Trusted issuer whitelist |
15
+ ## Core Rules
19
16
 
20
- ## Ed25519 Verification Architecture
17
+ 1. Every factual claim needs a source URL.
18
+ 2. Unknown, unsigned, revoked, mismatched, or invalid issuer signatures are not issuer-verified.
19
+ 3. Trusted issuer status requires an explicit issuer -> pinned Ed25519 public key mapping. A domain string alone is never trusted.
20
+ 4. Strict and paranoid modes reject plans with remaining unsigned or invalid claims.
21
+ 5. Self-attested researcher signatures provide audit-log tamper-evidence only and are capped below issuer-trusted confidence.
21
22
 
22
- ```
23
- ┌─────────────────────────────────────────────────────────────┐
24
- │ RESEARCH PIPELINE │
25
- ├─────────────────────────────────────────────────────────────┤
26
- │ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
27
- │ │ Source │───▶│ Ed25519 │───▶│ Verified │ │
28
- │ │ Content │ │ Verifier │ │ Facts │ │
29
- │ └──────────┘ └──────────┘ └──────────┘ │
30
- │ │ │ │ │
31
- │ ▼ ▼ ▼ │
32
- │ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
33
- │ │ Citation │ │ Signature│ │ Confidence│ │
34
- │ │ Extractor│ │ Chain │ │ Calculator│ │
35
- │ └──────────┘ └──────────┘ └──────────┘ │
36
- │ │ │ │ │
37
- │ └──────────────┴───────────────┘ │
38
- │ │ │
39
- │ ▼ │
40
- │ ┌────────────────┐ │
41
- │ │ Verification │ │
42
- │ │ Ledger (signed)│ │
43
- │ └────────────────┘ │
44
- └─────────────────────────────────────────────────────────────┘
45
- ```
23
+ ## Trust Classes
46
24
 
47
- ## Core GOAP Methodology (Enhanced)
48
-
49
- ### Phase 1: State Assessment with Trust Initialization
50
-
51
- **Define Current State:**
52
- - Existing knowledge about the topic
53
- - Available sources and access constraints
54
- - **NEW:** Trusted issuer whitelist configuration
55
- - **NEW:** Ed25519 keypair availability
56
- - Time and depth requirements
57
-
58
- **Define Goal State:**
59
- - Specific questions to answer
60
- - Required evidence types
61
- - **NEW:** Minimum verification threshold (0.85 default, 0.95 strict)
62
- - **NEW:** Required signature chain depth
63
- - Confidence thresholds for conclusions
64
-
65
- **Gap Analysis:**
66
- - Knowledge gaps to fill
67
- - **NEW:** Unsigned claims requiring verification
68
- - **NEW:** Citation chain breaks to resolve
69
-
70
- ### Phase 2: Action Inventory (Extended)
71
-
72
- Research actions with Ed25519 verification extensions:
73
-
74
- | Action | Preconditions | Effects | Cost | Verification |
75
- |--------|---------------|---------|------|--------------|
76
- | `web_search_broad` | topic_defined | candidates_found | 1 | None |
77
- | `web_search_verified` | topic_defined, trusted_issuers_set | verified_candidates_found | 2 | Domain signature |
78
- | `fetch_source` | url_known | content_retrieved | 2 | TLS certificate |
79
- | `fetch_signed_source` | url_known, issuer_pubkey | signed_content_retrieved | 3 | Ed25519 signature |
80
- | `extract_facts` | content_retrieved | facts_cataloged | 1 | None |
81
- | `sign_extracted_facts` | facts_cataloged, private_key | signed_facts | 2 | Self-signature |
82
- | `verify_claim` | claim_identified | claim_verified/refuted | 3 | Cross-ref |
83
- | `verify_claim_cryptographic` | claim_identified, signature_available | cryptographically_verified | 4 | Ed25519 verify |
84
- | `cross_reference` | multiple_sources | consistency_checked | 2 | None |
85
- | `cross_reference_signed` | multiple_signed_sources | signed_consistency_checked | 3 | Multi-sig verify |
86
- | `build_citation_chain` | facts_cataloged | citation_chain_complete | 2 | Chain integrity |
87
- | `verify_citation_chain` | citation_chain_complete | chain_verified | 3 | Ed25519 chain |
88
- | `generate_signed_report` | conclusions_formed, private_key | signed_report_delivered | 3 | Report signature |
89
-
90
- ### Phase 3: Plan Generation (A* with Verification Cost)
91
-
92
- Enhanced cost function:
93
- ```
94
- f(n) = g(n) + h(n) + v(n)
95
- ```
96
- - `g(n)`: Actual cost (searches performed, time spent)
97
- - `h(n)`: Heuristic distance to goal (remaining questions)
98
- - `v(n)`: **Verification penalty** (unsigned claims × 0.5)
99
-
100
- **Planning Heuristics:**
101
- 1. Prioritize signed sources over unsigned (lower total cost)
102
- 2. Prefer sources from trusted issuers whitelist
103
- 3. Weight cryptographically verified claims higher
104
- 4. Factor citation chain depth in confidence
105
-
106
- ### Phase 4: OODA Loop with Verification Checkpoints
107
-
108
- **Observe:**
109
- - Monitor search results quality
110
- - **Track signature validity status**
111
- - **Monitor citation chain integrity**
112
- - Identify information gaps
113
-
114
- **Orient:**
115
- - Assess if current path leads to goal
116
- - **Evaluate cryptographic trust level**
117
- - **Check for signature chain breaks**
118
- - Recognize when verification fails
119
-
120
- **Decide:**
121
- - Continue current research branch or pivot
122
- - **Accept or reject unsigned sources**
123
- - **Trigger re-verification on suspicious content**
124
- - Choose between depth and breadth
125
-
126
- **Act:**
127
- - Execute next optimal action
128
- - **Sign verified findings**
129
- - **Update verification ledger**
130
- - Trigger replanning if deviation detected
131
-
132
- ### Phase 5: Dynamic Replanning with Trust Recalculation
133
-
134
- Trigger replanning when:
135
- - Key assumption invalidated
136
- - **Signature verification fails**
137
- - **Trusted issuer removed from whitelist**
138
- - **Citation chain broken**
139
- - Higher-quality signed source discovered
140
-
141
- ## Ed25519 Verification Protocol
142
-
143
- ### Trusted Issuers Whitelist
144
-
145
- Default trusted issuers (Level 5 sources):
146
- ```yaml
147
- trusted_issuers:
148
- news:
149
- - reuters.com
150
- - ap.org
151
- - bbc.com
152
- academic:
153
- - arxiv.org
154
- - nature.com
155
- - science.org
156
- - pubmed.gov
157
- government:
158
- - .gov domains
159
- - .gov.uk domains
160
- - europa.eu
161
- financial:
162
- - sec.gov
163
- - federalreserve.gov
164
- - ecb.europa.eu
165
- ```
25
+ | Trust class | Requirement | What it proves | Confidence |
26
+ |---|---|---|---|
27
+ | `ISSUER_SIGNED` | Signature verifies against the active pinned key for the claimed issuer | The pinned issuer signed this exact canonical message | up to `0.95` |
28
+ | `SELF_ATTESTED` | Researcher signature verifies against the embedded researcher key | The research record was not altered after self-signing | up to `0.60` |
29
+ | `UNVERIFIED` | Unknown issuer, missing pin, revoked key, key mismatch, malformed key, or invalid signature | No cryptographic provenance | `0.0` |
166
30
 
167
- ### Signature Verification Flow
31
+ ## Signed Message
168
32
 
169
- ```
170
- 1. Source provides content + signature + public_key_id
171
- 2. Fetch public key from trusted keyserver or issuer
172
- 3. Verify Ed25519 signature: verify(signature, content_hash, public_key)
173
- 4. Check issuer against trusted whitelist
174
- 5. Record verification result in ledger
175
- 6. Assign cryptographic trust score
176
- ```
33
+ `sign_fact()` and `verify_fact()` use the same deterministic JSON message containing:
177
34
 
178
- ### Citation Chain Verification
179
-
180
- Each fact in the chain must have:
181
- ```json
182
- {
183
- "claim": "The statement being made",
184
- "source_url": "https://...",
185
- "source_hash": "sha256:abc123...",
186
- "issuer_pubkey": "ed25519:xyz789...",
187
- "signature": "ed25519_sig:...",
188
- "timestamp": "2025-01-22T10:30:00Z",
189
- "parent_citation": "chain_id:previous_fact_id",
190
- "confidence": 0.95
191
- }
192
- ```
35
+ - `issuer`
36
+ - `source_url`
37
+ - `claim`
38
+ - `source_hash`
39
+ - `timestamp`
40
+ - optional `research_context` / nonce
193
41
 
194
- Chain verification:
195
- 1. Verify each fact's signature individually
196
- 2. Verify chain integrity (parent hashes match)
197
- 3. Check all issuers are in trusted whitelist
198
- 4. Calculate aggregate chain confidence
42
+ Changing the issuer or moving the source URL after signing invalidates the signature. The code signs the raw canonical message bytes; Ed25519 performs its own internal hashing. Do not pre-hash with SHA-512 before signing.
199
43
 
200
- ## Anti-Hallucination Rules
44
+ ## Pinned Issuers
201
45
 
202
- ### 100% Citation Rule
203
- **Every factual claim MUST have a verifiable source.** No exceptions.
46
+ The default pinned issuer registry is empty. Add real keys explicitly:
204
47
 
205
- ```
206
- FORBIDDEN: "Studies show that X leads to Y"
207
- ✅ REQUIRED: "A 2024 study published in Nature (DOI: 10.1038/...) found that X leads to Y"
48
+ ```python
49
+ verifier = Ed25519Verifier(
50
+ trusted_issuers={
51
+ "example.org": {"pubkey_b64": "base64-public-key", "status": "active"}
52
+ }
53
+ )
208
54
  ```
209
55
 
210
- ### Verification Thresholds
56
+ `status: revoked` rejects the key. Online revocation fetching is not implemented. Replay protection is limited to binding `research_context` / nonce into the signed message; there is no persistent nonce ledger.
211
57
 
212
- | Mode | Threshold | Use Case |
213
- |------|-----------|----------|
214
- | `development` | 0.75 | Exploratory research, brainstorming |
215
- | `moderate` | 0.85 | Standard research (default) |
216
- | `strict` | 0.95 | Legal, medical, financial research |
217
- | `paranoid` | 0.99 | Critical decisions, published reports |
58
+ ## Citation Chain Verification
218
59
 
219
- ### Confidence Calculation
60
+ Each non-root fact stores `parent_hash = sha256(canonical_message(parent_fact))`. Chain verification:
220
61
 
221
- ```
222
- confidence = base_reliability × verification_multiplier × recency_factor
62
+ 1. Verifies each fact signature.
63
+ 2. Recomputes each parent content hash and compares it to the child's `parent_hash`.
64
+ 3. Verifies `chain_signature` over the ordered list of fact hashes.
223
65
 
224
- where:
225
- base_reliability = source level (1-5) / 5
226
- verification_multiplier = 1.0 if unsigned, 1.2 if signed, 1.5 if chain_verified
227
- recency_factor = 1.0 if <24h, 0.9 if <7d, 0.8 if <30d, 0.6 if older
228
- ```
66
+ Reordering, substituting, editing, relabeling, or moving a signed fact fails verification.
229
67
 
230
- ## Research Execution Patterns (Enhanced)
68
+ ## GOAP Research Modes
231
69
 
232
- ### Pattern A: Verified Exploratory Research
233
- ```
234
- Goal: comprehensive_verified_understanding
235
- Actions:
236
- 1. configure_trusted_issuers whitelist_active
237
- 2. web_search_verified verified_candidates_found
238
- 3. FOR EACH candidate: fetch_signed_source → signed_content_retrieved
239
- 4. extract_facts → facts_cataloged
240
- 5. sign_extracted_facts → signed_facts
241
- 6. cross_reference_signed → signed_consistency_checked
242
- 7. build_citation_chain → citation_chain_complete
243
- 8. verify_citation_chain → chain_verified
244
- 9. synthesize_findings → conclusions_formed
245
- 10. generate_signed_report → signed_report_delivered
246
- ```
70
+ | Mode | Behavior |
71
+ |---|---|
72
+ | `development` | Allows unsigned claims with clear labels and lower confidence. |
73
+ | `moderate` | Prefers signed and cross-checked sources but may continue with labeled uncertainty. |
74
+ | `strict` | Rejects plans with unsigned, invalid, unknown, revoked, or mismatched claims. |
75
+ | `paranoid` | Same as strict, with stronger source redundancy expectations. |
247
76
 
248
- ### Pattern B: High-Stakes Fact Verification
249
- ```
250
- Goal: cryptographically_verified_claim
251
- Mode: strict (0.95 threshold)
252
- Actions:
253
- 1. identify_claim → claim_defined
254
- 2. configure_trusted_issuers (strict list) → whitelist_active
255
- 3. find_primary_source → primary_located
256
- 4. fetch_signed_source → signed_content_retrieved
257
- 5. verify_claim_cryptographic → cryptographically_verified
258
- 6. cross_reference_signed (≥3 sources) → multi_source_verified
259
- 7. build_citation_chain → citation_chain_complete
260
- 8. verify_citation_chain → chain_verified (confidence ≥0.95)
261
- ```
77
+ ## Confidence Formula
262
78
 
263
- ### Pattern C: Competitive Analysis with Audit Trail
264
79
  ```
265
- Goal: auditable_competitive_landscape
266
- Actions:
267
- 1. identify_players → competitors_listed
268
- 2. configure_trusted_issuers whitelist_active
269
- 3. FOR EACH competitor:
270
- - web_search_verified → verified_info_found
271
- - fetch_signed_source (official sources) → signed_content
272
- - extract_facts → facts_cataloged
273
- - sign_extracted_facts → signed_facts
274
- 4. cross_reference_signed → consistency_verified
275
- 5. build_citation_chain → full_chain
276
- 6. generate_signed_report → auditable_report
80
+ confidence =
81
+ 0.0 if UNVERIFIED
82
+ <=0.60 if SELF_ATTESTED
83
+ min(0.95, base_by_source_level * recency_factor) if ISSUER_SIGNED
277
84
  ```
278
85
 
279
- ## Output Structure (Enhanced)
280
-
281
- ### Verified Research Report Format
282
-
283
- ```markdown
284
- ## Executive Summary
285
- [Key findings in 2-3 sentences]
286
-
287
- ## Verification Status
288
- - Mode: strict (0.95 threshold)
289
- - Chain Integrity: ✅ VERIFIED
290
- - Unsigned Claims: 0
291
- - Total Citations: 15
292
- - Trusted Issuers Used: 8
86
+ Invalid signatures are rejected with confidence `0.0`; they are never a recoverable `0.5` penalty.
293
87
 
294
- ## Research Objective
295
- [Original question/goal]
88
+ ## Research Workflow
296
89
 
297
- ## Methodology
298
- [GOAP plan executed, verification protocol used]
90
+ 1. Define the research goal and required evidence threshold.
91
+ 2. Configure pinned issuer keys when issuer-grade provenance is required.
92
+ 3. Search and fetch sources.
93
+ 4. Extract claims and source URLs.
94
+ 5. Hash source content with SHA-256 for `source_hash`.
95
+ 6. Create self-attested facts for the research ledger or issuer-signed facts when a pinned issuer key actually signed the message.
96
+ 7. Verify facts and citation chains.
97
+ 8. Cross-check claims through ordinary source evaluation.
98
+ 9. Report confidence, unsigned claims, rejected signatures, and limitations explicitly.
299
99
 
300
- ## Verified Findings
100
+ ## Output Expectations
301
101
 
302
- ### [Subtopic 1]
303
- [Findings with signed inline citations]
102
+ Reports should include:
304
103
 
305
- **Verification Details:**
306
- | Claim | Source | Signature | Confidence |
307
- |-------|--------|-----------|------------|
308
- | ... | ... | | 0.96 |
309
-
310
- ### [Subtopic 2]
311
- [Findings with signed inline citations]
312
-
313
- ## Confidence Assessment
314
- - Cryptographically Verified (≥0.95): [claims list]
315
- - Cross-Reference Verified (0.85-0.95): [claims list]
316
- - Single Source (0.75-0.85): [claims list]
317
- - Unverified (<0.75): NONE (strict mode)
318
-
319
- ## Citation Chain
320
- [Full chain with signatures - see Appendix A]
321
-
322
- ## Verification Ledger
323
- [Signed log of all verification operations]
324
-
325
- ## Sources
326
- [Numbered list with URLs, signatures, and trust scores]
327
-
328
- ## Appendix A: Cryptographic Verification Details
329
- [Full Ed25519 signature data for audit]
330
- ```
331
-
332
- ## Quality Standards (Enhanced)
333
-
334
- **Completeness Checks:**
335
- - [ ] All original questions addressed
336
- - [ ] **100% of claims have citations**
337
- - [ ] **All citations are verifiable**
338
- - [ ] **Citation chain integrity verified**
339
- - [ ] Primary sources found where possible
340
- - [ ] Contradictions identified and addressed
341
- - [ ] Confidence levels assigned to conclusions
342
- - [ ] **Verification ledger signed and complete**
343
-
344
- **Anti-Hallucination Checks:**
345
- - [ ] No claims without sources
346
- - [ ] No "studies show" without specific citation
347
- - [ ] No statistics without methodology source
348
- - [ ] No quotes without attribution + verification
349
- - [ ] No predictions presented as facts
104
+ - Research objective and GOAP plan executed.
105
+ - Findings with source URLs.
106
+ - Verification status per claim (`ISSUER_SIGNED`, `SELF_ATTESTED`, or `UNVERIFIED`).
107
+ - Chain integrity result when citation chains are used.
108
+ - Unsigned and rejected claims.
109
+ - Explicit caveat that cryptographic provenance is not truth verification.
350
110
 
351
111
  ## Implementation
352
112
 
353
- ### Python Usage
354
-
355
- ```python
356
- from goap_planner import GOAPResearchPlanner
357
- from ed25519_verifier import Ed25519Verifier
358
-
359
- # Initialize with Ed25519 verification
360
- planner = GOAPResearchPlanner(
361
- verification_mode="strict",
362
- trusted_issuers=["reuters.com", "ap.org", "nature.com"]
363
- )
364
-
365
- # Generate research plan
366
- plan = planner.plan(
367
- goal_type="verified_exploratory",
368
- topic="AI safety regulations 2025"
369
- )
370
-
371
- # Execute with verification
372
- results = planner.execute(plan, verify_all=True)
113
+ Use the scripts in this skill:
373
114
 
374
- # Generate signed report
375
- report = planner.generate_report(
376
- results,
377
- sign=True,
378
- include_verification_ledger=True
379
- )
380
- ```
115
+ - [scripts/ed25519_verifier.py](scripts/ed25519_verifier.py)
116
+ - [scripts/goap_planner.py](scripts/goap_planner.py)
381
117
 
382
- ### CLI Usage (via goalie integration)
118
+ Install Python crypto dependencies in a virtual environment:
383
119
 
384
120
  ```bash
385
- # Install goalie for Ed25519 support
386
- npm install -g goalie
387
-
388
- # Verified research
389
- goalie search "Your research question" \
390
- --verify \
391
- --strict-verify \
392
- --trusted-issuers "reuters.com,ap.org,nature.com" \
393
- --mode academic \
394
- --save
395
-
396
- # Anti-hallucination check
397
- goalie reason --mode anti-hallucination \
398
- --claims "Your claim to verify" \
399
- --citations "Source URL"
121
+ python3 -m venv .venv
122
+ .venv/bin/pip install cryptography
400
123
  ```
401
124
 
402
- ## References
403
-
404
- For detailed implementations, see:
405
- - [references/research-actions.md](references/research-actions.md) - Complete action specifications with Ed25519 extensions
406
- - [references/source-evaluation.md](references/source-evaluation.md) - Source credibility with cryptographic trust
407
- - [references/ed25519-verification.md](references/ed25519-verification.md) - Ed25519 protocol details
408
- - [scripts/goap_planner.py](scripts/goap_planner.py) - Enhanced GOAP planner
409
- - [scripts/ed25519_verifier.py](scripts/ed25519_verifier.py) - Verification module
410
-
411
- ## Dependencies
412
-
413
- - Python 3.9+
414
- - `@noble/ed25519` (Node.js) or `cryptography` (Python) for Ed25519
415
- - Optional: `goalie` npm package for CLI integration
125
+ Use `--break-system-packages` only as a last-resort local workaround when you understand the system-integrity risk.