@agentproto/corpus-presets 0.1.0 → 0.2.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/dist/research/index.d.ts +31 -0
- package/dist/research/index.mjs +85 -0
- package/dist/research/index.mjs.map +1 -0
- package/package.json +20 -8
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { CorpusPreset } from '@agentproto/corpus';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* AUTO-GENERATED build artifact — DO NOT COMMIT, DO NOT EDIT.
|
|
5
|
+
*
|
|
6
|
+
* Regenerated from @agentproto/corpus/test/fixtures/research/
|
|
7
|
+
* by the prebuild / precheck-types / pretest / predev hooks on
|
|
8
|
+
* this package. To change the preset content, edit the fixtures.
|
|
9
|
+
*/
|
|
10
|
+
declare const RESEARCH_PRESET_FILES: Readonly<Record<string, string>>;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Research corpus preset.
|
|
14
|
+
*
|
|
15
|
+
* Pure TS data — `files` is inlined from the M0 fixture workspace at
|
|
16
|
+
* build time via `scripts/gen-research.mjs`. The M0 conformance test
|
|
17
|
+
* proves every file validates against the actual AgentProto JSON
|
|
18
|
+
* Schemas, so a host that writes these to disk gets a known-good
|
|
19
|
+
* starter workspace.
|
|
20
|
+
*
|
|
21
|
+
* Usage:
|
|
22
|
+
*
|
|
23
|
+
* import { ResearchCorpusPreset } from "@agentproto/corpus-presets/research"
|
|
24
|
+
* for (const [rel, content] of Object.entries(ResearchCorpusPreset.files)) {
|
|
25
|
+
* await fs.writeFile(path.join(workspaceRoot, rel), content)
|
|
26
|
+
* }
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
declare const ResearchCorpusPreset: CorpusPreset;
|
|
30
|
+
|
|
31
|
+
export { RESEARCH_PRESET_FILES, ResearchCorpusPreset };
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @agentproto/corpus-presets v0.1.0-alpha
|
|
3
|
+
* Pure-TS starter workspaces for the AIP-10 corpus runtime.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// src/research/files.ts
|
|
7
|
+
var RESEARCH_PRESET_FILES = Object.freeze({
|
|
8
|
+
"collections/corpus-candidate/COLLECTION.md": '---\nschema: collection.schema/v1\nname: corpus-candidate\ntitle: Corpus Candidate\ndescription: |\n Candidate corpus item awaiting analysis and promotion to an AIP-10 entry.\n Discovered candidates live in `_candidates.yaml` sidecar; materialized\n ITEM.md files appear only after transition out of `discovered`.\nversion: 1.0.0\ninitialStatus: discovered\nstatuses:\n - { id: discovered, label: Discovered, transitionsTo: [analyzed, rejected] }\n - { id: analyzed, label: Analyzed, transitionsTo: [approved, rejected, needs-work] }\n - { id: needs-work, label: Needs Work, transitionsTo: [analyzed, rejected] }\n - { id: approved, label: Approved, terminal: true }\n - { id: rejected, label: Rejected, terminal: true }\nidentity:\n slugSource: id\n filingPath: "collections/corpus-candidate/{slug}/ITEM.md"\nfields:\n - { name: sourcePath, type: string, required: true }\n - { name: sourceUrl, type: url }\n - { name: targetEntryPath, type: string }\n - { name: corpusKind, type: enum, enum: [principle, example, pattern, critique, summary, timeline], required: true }\n - { name: qualityScore, type: number }\n - { name: riskScore, type: number }\n - { name: promotionMode, type: enum, enum: [auto, human] }\n - { name: contentHash, type: string }\n - { name: reviewerNotes, type: text }\nlints:\n - { id: required-field-source-path, kind: required-field, appliesTo: "*", severity: error, params: { fields: [sourcePath] } }\n - { id: required-field-corpus-kind, kind: required-field, appliesTo: "*", severity: error, params: { fields: [corpusKind] } }\nmetadata:\n corpus:\n description: Used by source-scout (writes), research-analyst (writes), quality-reviewer (scores), corpus-curator (promotes).\n---\n\n# Corpus Candidate collection\n\nHolds candidates discovered by the scout, analyzed by the analyst, scored by the reviewer, and promoted by the curator. State machine enforced by `statuses[].transitionsTo`. Domain-agnostic \u2014 the `corpusKind` field drives which entry type the analyst targets.\n',
|
|
9
|
+
"collections/corpus-candidate/nature-review-2026-06/ITEM.md": '---\nschema: collection.item/v1\ncollection: corpus-candidate\nid: nature-review-2026-06\ntitle: Replication crisis systematic review \u2014 pattern extraction\nstatus: analyzed\nsourcePath: sources/fresh/nature-review-2026-06.md\nsourceUrl: https://example.com/nature/reviews/replication-crisis-2026\ntargetEntryPath: entries/patterns/2026/systematic-review-pattern.md\ncorpusKind: pattern\ncontentHash: sha256:b2e4f8a1c3d5e7f9a1b3c5d7e9f1a3b5c7d9e1f3a5b7c9d1e3f5a7b9c1d3e5f7\ntags: [methodology, replication, systematic-review]\ncreatedAt: "2026-06-10T09:00:00Z"\nupdatedAt: "2026-06-10T10:30:00Z"\nmetadata:\n corpus:\n qualityScore: 4.5\n riskScore: 0.8\n promotionMode: auto\n---\n\n# Candidate: Replication crisis systematic review\n\nCandidate extracted from a peer-reviewed Nature Reviews article. The pattern (hierarchical Bayesian meta-analysis for heterogeneous replication studies) generalizes across empirical research domains. Analyst recommends auto-promotion.\n\n## Analysis\n- Primary-authority source (peer-reviewed journal, pre-registered)\n- Methodology (hierarchical Bayesian meta-analysis) is domain-portable\n- No legal or intellectual-property risk identified\n- 847-study sample provides robust effect-size estimates\n\n## Decision\n- promotionMode: auto\n- gates pass: qualityScore 4.5 \u2265 4.2, riskScore 0.8 \u2264 1.5, archive hash present, all required fields populated\n',
|
|
10
|
+
"entries/critiques/2026/selection-bias-failure.md": '---\nschema: knowledge.entry/v1\nslug: selection-bias-failure\nkind: critique\ntitle: Selection bias as a driver of non-replication\nupdated_at: "2026-06-10T10:30:00Z"\nsources:\n - nature-review-2026-06\nconfidence: 0.90\ntags: [methodology, bias, replication, failure-mode]\nmetadata:\n corpus:\n status: active\n qualityScore: 4.4\n riskScore: 0.5\n domain: research\n temporal:\n firstSeen: "2011-01-01T00:00:00Z"\n lastSeen: "2026-06-10T10:30:00Z"\n mentions:\n - { at: "2011-01-01T00:00:00Z", sourceId: nature-review-2026-06, weight: 1.0 }\n - { at: "2026-06-10T10:30:00Z", sourceId: nature-review-2026-06, weight: 1.0 }\n promotionMode: human\n promotedAt: "2026-06-10T10:30:00Z"\n promotedBy: corpus-curator\n---\n\n## Summary\nStudies that select their sample on the outcome variable or restrict inclusion to high-effect subgroups produce inflated effect sizes that fail to replicate in unselected populations.\n\n## Why it fails\nWhen inclusion criteria correlate with the outcome, the sample is not representative of the target population. The estimated effect is an artifact of the selection process, not a property of the population. Replication studies that sample more broadly will find smaller or null effects.\n\n## Failure modes\n- **Outcome-dependent sampling**: recruiting only people who experienced the effect being studied.\n- **Subgroup cherry-picking**: reporting the subgroup with the largest effect after observing the data.\n- **Survivor bias in longitudinal studies**: only measuring participants who completed the study.\n- **Publication bias at meta-analysis level**: including only published (positive) studies.\n\n## Use when\n- Evaluating a new source for corpus inclusion: check whether sample selection is described.\n- Scoring riskScore for an entry: unexplained heterogeneity across replications raises riskScore.\n- Writing critique entries that expose methodological limitations in existing literature.\n\n## Avoid when\n- The selection IS the design (e.g., case studies of rare diseases where selection is inherent).\n',
|
|
11
|
+
"entries/patterns/2026/systematic-review-pattern.md": '---\nschema: knowledge.entry/v1\nslug: systematic-review-pattern\nkind: pattern\ntitle: Systematic review with hierarchical Bayesian meta-analysis\nupdated_at: "2026-06-10T10:30:00Z"\nsources:\n - nature-review-2026-06\nconfidence: 0.88\ntags: [methodology, meta-analysis, bayesian, replication]\nmetadata:\n corpus:\n status: active\n qualityScore: 4.5\n riskScore: 0.6\n domain: research\n temporal:\n firstSeen: "2018-01-01T00:00:00Z"\n lastSeen: "2026-06-10T10:30:00Z"\n mentions:\n - { at: "2018-01-01T00:00:00Z", sourceId: nature-review-2026-06, weight: 1.0 }\n - { at: "2026-06-10T10:30:00Z", sourceId: nature-review-2026-06, weight: 1.0 }\n promotionMode: auto\n promotedAt: "2026-06-10T10:30:00Z"\n promotedBy: corpus-curator\n---\n\n## Summary\nSystematic reviews achieve reliable effect-size estimates when they: (1) pre-register inclusion criteria, (2) apply hierarchical Bayesian pooling to account for between-study heterogeneity, and (3) report credible intervals rather than p-values.\n\n## Why it works\nHierarchical (random-effects) Bayesian models shrink extreme estimates toward the population mean \u2014 the replication crisis showed that underpowered studies with extreme point estimates drive non-replication. Pre-registration eliminates post-hoc analysis flexibility.\n\n## Transferable pattern\n1. Pre-register: hypothesis, inclusion/exclusion criteria, analysis plan.\n2. Screen independently: two reviewers screen abstracts; resolve conflicts by consensus.\n3. Pool with hierarchical Bayes: \u03C4\xB2 estimates between-study variance; shrink estimates accordingly.\n4. Report 95 % credible intervals, not just posterior means.\n5. Conduct sensitivity analysis: exclude low-quality studies, check robustness.\n\n## Use when\n- Synthesizing a body of empirical literature with heterogeneous study designs.\n- The corpus needs a high-confidence summary of a contested empirical question.\n- Effect-size estimation matters, not just directional conclusions.\n\n## Avoid when\n- Fewer than 10 primary studies exist (insufficient for pooling).\n- The research question is qualitative or interpretive rather than quantitative.\n',
|
|
12
|
+
"entries/principles/2026/primary-sources-beat-synthesis.md": '---\nschema: knowledge.entry/v1\nslug: primary-sources-beat-synthesis\nkind: principle\ntitle: Primary sources beat synthesis\nupdated_at: "2026-06-10T10:30:00Z"\nsources:\n - nature-review-2026-06\nconfidence: 0.92\ntags: [methodology, evidence, authority, sourcing]\nmetadata:\n corpus:\n status: active\n qualityScore: 4.7\n riskScore: 0.4\n domain: research\n temporal:\n firstSeen: "2015-01-01T00:00:00Z"\n lastSeen: "2026-06-10T10:30:00Z"\n mentions:\n - { at: "2015-01-01T00:00:00Z", sourceId: nature-review-2026-06, weight: 1.0 }\n - { at: "2026-06-10T10:30:00Z", sourceId: nature-review-2026-06, weight: 1.0 }\n promotionMode: human\n promotedAt: "2026-06-10T10:30:00Z"\n promotedBy: corpus-curator\n---\n\n## Summary\nWhen a synthesis contradicts its primary sources, trust the primary sources. Systematic reviews compress information; compression loses detail that sometimes reverses the conclusion.\n\n## Why it works\nSynthesis introduces two layers of error: sampling bias in study selection and aggregation error in effect-size combination. Primary data carries neither of these artefacts by construction.\n\n## Transferable pattern\n- Cite primary studies, not meta-analyses, when a claim is contested.\n- When a meta-analysis conflicts with a landmark primary study, read the primary study.\n- Record confidence lower when your only source is a secondary synthesis.\n\n## Use when\n- Evaluating evidentiary strength of a claim for corpus promotion.\n- Deciding authority tier for a new source (primary vs secondary vs rumour).\n- Writing confidence scores on entries derived from secondary sources.\n\n## Avoid when\n- The domain has no accessible primary literature (policy documents, grey literature).\n- Speed matters more than precision and a trusted synthesis is available.\n',
|
|
13
|
+
"KNOWLEDGE.md": '---\nschema: knowledge.workspace/v1\nname: research-corpus\ntitle: Research Expert Corpus\ndescription: |\n Domain-agnostic research knowledge for autonomous agents. Composes AIP-10 (knowledge),\n AIP-18 (curation collections), AIP-9 (operators), AIP-15 (workflows), and AIP-41\n (routines) into an autonomous discovery-and-improvement loop.\nversion: 1.0.0\nentityTypes:\n - { name: Principle, description: "Durable finding or research rule" }\n - { name: Example, description: "Concrete source-derived example or case study" }\n - { name: Pattern, description: "Reusable transferable methodology or mechanic" }\n - { name: Critique, description: "Negative example, failure mode, or methodological flaw" }\n - { name: Summary, description: "Compressed synthesis of a source or topic cluster" }\n - { name: Timeline, description: "Time-sensitive trend or field evolution" }\nsources:\n retention: forever\n signing: optional\n hashAlgo: sha256\n authorityDefault: secondary\nlints:\n - { id: require-source-on-examples, kind: require-source, appliesTo: Example, severity: error }\n - { id: min-confidence-principles, kind: min-confidence, appliesTo: Principle, severity: warn, params: { min: 0.6 } }\n - { id: max-age-timelines, kind: max-age, appliesTo: Timeline, severity: warn, params: { days: 730 } }\n - { id: max-age-summaries, kind: max-age, appliesTo: Summary, severity: warn, params: { days: 180 } }\n - { id: broken-ref-all, kind: broken-ref, appliesTo: "*", severity: error }\n - { id: orphan-all, kind: orphan, appliesTo: "*", severity: info }\ncuration:\n tone: "neutral, expert, source-backed"\n depth: medium\n autoLink: byName\n conflictResolution: authority\nqueryHints:\n preferRecent: true\n preferAuthoritative: true\nmetadata:\n corpus:\n version: 1\n domain: research\n entryLayout:\n kind: hierarchical\n groupBy: entityType\n autoPromote:\n enabled: true\n requires:\n qualityScore: { min: 4.2 }\n riskScore: { max: 1.5 }\n hasArchiveHash: true\n requiredFields: [why_it_works, transferable_pattern, use_when, avoid_when]\n notRestricted: true\n temporal:\n defaultHalfLifeDays: 365\n scoreFormula: max-mention-decay\n retrievalBoosts:\n qualityScore: { weight: 0.30 }\n temporalScore: { weight: 0.20 }\n mentionCount: { weight: 0.10 }\n confidence: { weight: 0.15 }\n retrievalDefaults:\n status: active\n minQualityScore: 3.5\n minTemporalScore: 0.1\n accessModes:\n read: { allowedRoles: ["*"] }\n cite: { allowedRoles: ["*"] }\n flag-learning: { allowedRoles: ["*"], rateLimit: { perOperator: 20, window: "24h" } }\n curate: { allowedRoles: [corpus-curator, admin] }\n promote: { allowedRoles: [corpus-curator, admin] }\n admin-reindex: { allowedRoles: [admin] }\n bypass-default-filters: { allowedRoles: [corpus-curator, admin], audit: true }\n---\n\n# Research Corpus\n\nSource-of-truth for autonomous research agents. Composes AgentProto AIPs into a closed-loop knowledge-improvement system for any domain.\n\n## Three loops\n- **Knowledge curation** \u2014 source-scout \u2192 analyst \u2192 entries\n- **Quality gating** \u2014 quality-reviewer scores + routes (auto-promote vs human review)\n- **Retrieval-quality feedback** \u2014 every query logged; `utility` + `lift` written back to entries\n\nAll corpus-specific policy lives under `metadata.corpus.*`. The six entity types (Principle, Example, Pattern, Critique, Summary, Timeline) are domain-agnostic \u2014 topics come from sources, not from the scaffold.\n',
|
|
14
|
+
"operators/corpus-curator/OPERATOR.md": `---
|
|
15
|
+
name: Corpus Curator
|
|
16
|
+
id: corpus-curator
|
|
17
|
+
persona_summary: Promotes approved candidates to AIP-10 entries, maintains _index.md, handles deprecation + supersession. The corpus's editor-in-chief.
|
|
18
|
+
version: "1.0.0"
|
|
19
|
+
profile:
|
|
20
|
+
role: |
|
|
21
|
+
Promote candidates that pass the auto-promote gate. Review the
|
|
22
|
+
human-review queue, decide approve/reject/needs-work. Keep the
|
|
23
|
+
corpus tidy: dedupe, deprecate stale entries, resolve
|
|
24
|
+
contradictions.
|
|
25
|
+
voice: |
|
|
26
|
+
Direct, decisive, opinionated about quality bar. First-person
|
|
27
|
+
plural for institutional voice. Cites specific entry slugs when
|
|
28
|
+
discussing deprecation or supersession.
|
|
29
|
+
boundaries:
|
|
30
|
+
- Never promote an entry that fails the auto-promote gate without explicit bypass.
|
|
31
|
+
- Never deprecate without a written reason in metadata.corpus.archiveReason.
|
|
32
|
+
- Always preserve the audit chain \u2014 _log.md events are append-only.
|
|
33
|
+
governance:
|
|
34
|
+
audit_log: "audit:corpus/research/_log.md"
|
|
35
|
+
autonomy: autonomous
|
|
36
|
+
policies:
|
|
37
|
+
- "policy:corpus/research/curation"
|
|
38
|
+
skills:
|
|
39
|
+
- source-analysis
|
|
40
|
+
- taxonomy
|
|
41
|
+
- editorial-judgment
|
|
42
|
+
tools:
|
|
43
|
+
- corpus-promote-candidate
|
|
44
|
+
- corpus-log-event
|
|
45
|
+
- knowledge-query
|
|
46
|
+
participation:
|
|
47
|
+
mode: proactive
|
|
48
|
+
memory:
|
|
49
|
+
kind: operator-context
|
|
50
|
+
runtime:
|
|
51
|
+
kind: in-process
|
|
52
|
+
tags: [research, curator, corpus]
|
|
53
|
+
metadata:
|
|
54
|
+
corpus:
|
|
55
|
+
domain: research
|
|
56
|
+
overlays:
|
|
57
|
+
policy: open
|
|
58
|
+
maxActiveCount: 10
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
# Corpus Curator
|
|
62
|
+
|
|
63
|
+
Runs after the reviewer scores a candidate. Promotes auto-approved entries; queues human-review-required candidates for the team. Drives entry lifecycle (active \u2192 archived).
|
|
64
|
+
`,
|
|
65
|
+
"operators/quality-reviewer/OPERATOR.md": '---\nname: Quality Reviewer\nid: quality-reviewer\npersona_summary: Scores analyzed candidates against the corpus\'s quality + risk rubric. Decides promotionMode (auto vs human). Flags concerns the analyst missed.\nversion: "1.0.0"\nprofile:\n role: |\n Independent second pair of eyes on every analyzed candidate.\n Adversarial-by-design \u2014 assumes the analyst was too generous\n and looks for reasons NOT to promote.\n voice: |\n Critical, concrete, fair. Cites specific clauses of the\n candidate body, not vibes. Always proposes a concrete score\n (qualityScore 0-5, riskScore 0-5).\n boundaries:\n - Never promote on the analyst\'s authority \u2014 score and route.\n - Never auto-promote a candidate flagged as restricted / personal / legal.\n - Always justify a sub-2.0 quality score in reviewerNotes.\ngovernance:\n audit_log: "audit:corpus/research/_log.md"\n autonomy: supervised\n policies:\n - "policy:corpus/research/review-policy"\nskills:\n - source-analysis\n - critical-reading\ntools:\n - corpus-flag-learning\n - knowledge-query\nparticipation:\n mode: proactive\nmemory:\n kind: operator-context\nruntime:\n kind: in-process\ntags: [research, reviewer, corpus]\nmetadata:\n corpus:\n domain: research\n---\n\n# Quality Reviewer\n\nRuns after `research-analyst` produces an analyzed ITEM.md. Scores against:\n\n- **qualityScore** \u2014 accuracy, transferability, evidence strength, authority tier\n- **riskScore** \u2014 legal/IP/compliance hazards, retracted studies, contested findings\n- **promotionMode** \u2014 auto (gates pass) vs human (needs curator)\n',
|
|
66
|
+
"operators/research-analyst/OPERATOR.md": '---\nname: Research Analyst\nid: research-analyst\npersona_summary: Domain-agnostic research analyst who converts raw sources into expert principles, patterns, and critiques for the research corpus.\nversion: "1.0.0"\nprofile:\n role: |\n Convert candidate sources discovered by the scout into corpus-grade\n expert analysis: principles, patterns, critiques. Score quality and\n risk to inform promotion gates. Works across any research domain \u2014\n the topic comes from the source, not from the operator persona.\n voice: |\n Concrete, source-backed, never superlative. Cite specific numbers and\n named authors or publications. First-person plural ("we") for\n institutional voice.\n boundaries:\n - Never invent quantitative claims; cite a source or mark as opinion.\n - Never promote without quality-reviewer signoff (unless auto-promote gates pass).\n - Never edit raw sources \u2014 only entries.\ngovernance:\n audit_log: "audit:corpus/research/_log.md"\n autonomy: supervised\n policies:\n - "policy:corpus/research/curation"\nskills:\n - source-analysis\n - research-synthesis\ntools:\n - corpus-flag-learning\n - knowledge-query\nparticipation:\n mode: proactive\nmemory:\n kind: operator-context\nruntime:\n kind: in-process\ntags: [research, analyst, corpus]\nmetadata:\n corpus:\n domain: research\n knowledgeViews:\n - corpus: research\n filter:\n domain: [research]\n minQualityScore: 3.5\n defaultBoosts:\n qualityScore: { weight: 0.40 }\n temporalScore: { weight: 0.30 }\n overlays:\n policy: gated\n maxActiveCount: 5\n requireApprovalFrom: corpus-curator\n allowedKinds: [overlay, block-replacement]\n---\n\n# Research Analyst\n\nReads candidate sources from the scout, writes expert analysis as AIP-10 entries. Scores quality and risk. Signals the curator on auto-promote gate pass.\n',
|
|
67
|
+
"operators/source-scout/OPERATOR.md": '---\nname: Source Scout\nid: source-scout\npersona_summary: Curates external feeds for fresh research source material \u2014 academic papers, articles, videos, social posts, and primary documents \u2014 and archives the worth-keeping ones into sources/.\nversion: "1.0.0"\nprofile:\n role: |\n Discover new candidate sources for the research corpus. Filter\n noise vs signal at the scout stage so the analyst only sees\n promising material. Source categories: article, video, social,\n paper, primary, news.\n voice: |\n Efficient, terse, evidence-first. Names URLs + numbers, not\n adjectives. Reports findings as `{source: <id>, why: <reason>}`\n triples.\n boundaries:\n - Never re-archive an already-archived source (check content_hash).\n - Never archive content with PII unless explicitly sanitized.\n - Never archive paywalled / DMCA-restricted material without authorization.\ngovernance:\n audit_log: "audit:corpus/research/_log.md"\n autonomy: autonomous\n policies:\n - "policy:corpus/research/source-policy"\nskills:\n - web-research\n - source-analysis\ntools:\n - corpus-create-candidate\n - knowledge-query\n - web-search\nparticipation:\n mode: proactive\nmemory:\n kind: operator-context\nruntime:\n kind: in-process\ntags: [research, scout, corpus]\nmetadata:\n corpus:\n domain: research\n knowledgeViews:\n - corpus: research\n filter:\n domain: [research]\n---\n\n# Source Scout\n\nRuns on-demand or on schedule (via `source-scout` routine). Fetches configured feeds and channels, hashes content, dedups against existing sources, and writes new candidates to `_candidates.yaml`. The analyst takes over from there.\n\nSupported source categories: `article` (blog/news), `video` (YouTube, conference talks), `social` (threads, posts), `paper` (peer-reviewed), `primary` (official documents, datasets), `news` (breaking coverage).\n',
|
|
68
|
+
"routines/source-scout/ROUTINE.md": '---\nschema: routine/v1\nid: source-scout\ndescription: |\n On-demand (or scheduled) routine that runs the source-scout operator to\n discover new candidate sources across configured external feeds and channels.\n Discovered sources are archived under sources/ and rows appended to\n _candidates.yaml.\nversion: "1.0.0"\nschedule:\n kind: cron\n cron: "0 8 * * 1"\n timezone: "UTC"\n catchup: skip\ntarget:\n workflow: ingest-source\n inputs:\n feeds: [web-search, youtube, arxiv, news-api]\n maxItemsPerRun: 30\nretry:\n max_attempts: 3\n backoff: exponential\non_failure:\n create_work_item: true\n fire_event: corpus.scout.failed\nfires_events:\n - corpus.scout.completed\n - corpus.candidate.discovered\nenabled: true\ntags: [corpus, scout, weekly]\nmetadata:\n corpus:\n domain: research\n---\n\n# Source Scout Routine\n\nRuns weekly (Monday 08:00 UTC) by default; can also be triggered on-demand. Scouts external feeds for new candidate sources, archives them, and appends to `_candidates.yaml`. The candidate event downstream triggers `analyze-candidate` workflow.\n\nAdjust the `schedule` and `target.inputs.feeds` list to match your research domain\'s primary discovery channels.\n',
|
|
69
|
+
"sources/fresh/nature-review-2026-06.md": '---\nschema: knowledge.source/v1\nid: nature-review-2026-06\npath: sources/fresh/nature-review-2026-06.md\ntitle: Systematic review of replication failures in social science \u2014 June 2026\ncaptured_at: "2026-06-10T09:00:00Z"\ncaptured_by: source-scout\ncontent_hash: sha256:b2e4f8a1c3d5e7f9a1b3c5d7e9f1a3b5c7d9e1f3a5b7c9d1e3f5a7b9c1d3e5f7\nauthority: primary\nlanguage: en\ntags: [systematic-review, replication, methodology, social-science]\nmetadata:\n corpus:\n originalUrl: https://example.com/nature/reviews/replication-crisis-2026\n archiveTier: hot\n archivedBy: source-scout\n snapshotPath: sources/fresh/nature-review-2026-06.snapshot.mhtml\n---\n\n# Systematic review: replication failures in social science (2026)\n\nCaptured from a peer-reviewed Nature Reviews article in June 2026. Meta-analysis of 847 attempted replications across psychology, economics, and political science (2010\u20132026).\n\n## Key findings\n- Only 39 % of original findings replicated at p < 0.05 in pre-registered replications\n- Effect sizes in successful replications averaged 68 % of originals\n- Primary driver of non-replication: underpowered original studies, not fraud\n\n## Methodology note\nAuthors applied a hierarchical Bayesian model to account for heterogeneity across domains. Pre-registered analysis plan at OSF (osf.io/example123).\n\n## Relevance\nFoundational reference for any research corpus reasoning about evidentiary quality, source authority, and confidence thresholds.\n',
|
|
70
|
+
"workflows/analyze-candidate/WORKFLOW.md": '---\nname: Analyze Corpus Candidate\nid: analyze-candidate\ndescription: |\n Convert a discovered corpus candidate into an analyzed ITEM.md with\n expert analysis, quality score, and risk score. Triggered by the\n source-scout when it appends a row to _candidates.yaml.\nversion: "1.0.0"\ninputs:\n type: object\n required: [candidateId, sourcePath]\n properties:\n candidateId: { type: string, pattern: "^[a-z0-9][a-z0-9-]*$" }\n sourcePath: { type: string }\noutputs:\n type: object\n required: [itemPath, status]\n properties:\n itemPath: { type: string }\n status: { type: string, enum: [analyzed, rejected, needs-work] }\n qualityScore: { type: number }\n riskScore: { type: number }\nsteps:\n - id: load-source\n kind: tool\n tool: knowledge.read_source\n name: Load source bytes from sources/\n inputs: { type: object, properties: { sourceId: { type: string } } }\n next: analyze\n - id: analyze\n kind: tool\n tool: research-analyst.analyze\n name: Run research-analyst operator over the source\n next: score\n - id: score\n kind: tool\n tool: quality-reviewer.score\n name: Compute quality + risk scores\n next: gate\n - id: gate\n kind: branch\n name: Decide promotionMode (auto vs human)\n description: Check auto-promote gate against KNOWLEDGE.md.metadata.corpus.autoPromote\n branches:\n - { when: "output.qualityScore >= 4.2 && output.riskScore <= 1.5", next: "auto-promote" }\n - { when: "true", next: "human-review" }\n - id: auto-promote\n kind: tool\n tool: corpus-curator-promote\n name: Promote to AIP-10 entry\n - id: human-review\n kind: approval\n name: Queue for human curator\n prompt: Review and approve or reject this candidate.\n approvers:\n - { role: corpus-curator }\ntags: [corpus, workflow, analysis]\nmetadata:\n corpus:\n domain: research\n triggeredBy: source-scout\n---\n\n# Analyze Candidate workflow\n\nConverts a discovered candidate into an analyzed ITEM.md. The research-analyst operator runs the actual analysis; this workflow orchestrates the pipeline (load \u2192 analyze \u2192 score \u2192 gate).\n',
|
|
71
|
+
"workflows/ingest-source/WORKFLOW.md": '---\nname: Ingest source\nid: ingest-source\ndescription: |\n Fetch + hash + dedup + archive a single source. Output: a new\n candidate row in _candidates.yaml (or no-op if duplicate).\nversion: "1.0.0"\ninputs:\n type: object\n required: [sourceUrl]\n properties:\n sourceUrl: { type: string }\n category: { type: string, enum: [article, video, social, paper, primary, news] }\noutputs:\n type: object\n required: [outcome]\n properties:\n outcome: { type: string, enum: [archived, duplicate, rejected] }\n sourceId: { type: string }\n candidateId: { type: string }\nsteps:\n - id: fetch\n kind: tool\n tool: web-fetch\n name: Fetch source content\n - id: hash\n kind: tool\n tool: hash-content\n name: Compute sha256 content_hash\n - id: dedup\n kind: branch\n name: Dedup against existing sources\n branches:\n - { when: "output.duplicate === true", next: "done-dup" }\n - { when: "true", next: "archive" }\n - id: archive\n kind: tool\n tool: corpus-archive-source\n name: Write source frontmatter + body to sources/<category>/<slug>.md\n - id: create-candidate\n kind: tool\n tool: createCorpusCandidate\n name: Append discovered row to _candidates.yaml\n - id: done-dup\n kind: tool\n tool: corpus-log-event\n name: Log dedup hit (no-op outcome)\ntags: [corpus, ingest, scout]\nmetadata:\n corpus:\n domain: research\n triggeredBy: source-scout\n---\n\n# Ingest source workflow\n\nStep 1 of the corpus loop. Single-source entry point. Called by the `source-scout` routine once per discovered URL. The `category` input (article | video | social | paper | primary | news) drives the archive path under `sources/`.\n',
|
|
72
|
+
"workflows/promote-corpus-item/WORKFLOW.md": '---\nname: Promote corpus item\nid: promote-corpus-item\ndescription: |\n Lift an approved candidate into a published AIP-10 entry. Writes\n the entry file, regenerates _index.md, ships chunks to the\n backing engine, appends a promotion event. Wraps the kit\'s\n CorpusPromoter.promote().\nversion: "1.0.0"\ninputs:\n type: object\n required: [candidateId, entrySlug, entryKind, entryPath, frontmatter, body]\n properties:\n candidateId: { type: string }\n entrySlug: { type: string }\n entryKind: { type: string, enum: [principle, example, pattern, critique, summary, timeline] }\n entryPath: { type: string }\n frontmatter: { type: object }\n body: { type: string }\n bypassGate: { type: boolean }\noutputs:\n type: object\n required: [entryPath, gatePassed]\n properties:\n entryPath: { type: string }\n versionToken: { type: string }\n chunkCount: { type: integer }\n gatePassed: { type: boolean }\n bypassed: { type: boolean }\nsteps:\n - id: promote\n kind: tool\n tool: promoteCorpusCandidate\n name: Atomic promote (lock + write + index + chunks + event)\ntags: [corpus, promote]\nmetadata:\n corpus:\n domain: research\n triggeredBy: corpus-curator\n---\n\n# Promote corpus item workflow\n\nStep 3 of the corpus loop. Single-step wrapper for callers that want the workflow shape; the underlying `CorpusPromoter` does the multi-file transaction.\n'
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
// src/research/index.ts
|
|
76
|
+
var ResearchCorpusPreset = Object.freeze({
|
|
77
|
+
slug: "research",
|
|
78
|
+
title: "Research Expert Corpus",
|
|
79
|
+
description: "Domain-agnostic research knowledge \u2014 principles, patterns, critiques. Composes AIP-10/18/9/15/41 into a closed-loop discovery-and-improvement system.",
|
|
80
|
+
files: RESEARCH_PRESET_FILES
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
export { RESEARCH_PRESET_FILES, ResearchCorpusPreset };
|
|
84
|
+
//# sourceMappingURL=index.mjs.map
|
|
85
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/research/files.ts","../../src/research/index.ts"],"names":[],"mappings":";;;;;;AAQO,IAAM,qBAAA,GAA0D,OAAO,MAAA,CAAO;AAAA,EACnF,4CAAA,EAA8C,q/DAAA;AAAA,EAC9C,4DAAA,EAA8D,u4CAAA;AAAA,EAC9D,kDAAA,EAAoD,okEAAA;AAAA,EACpD,oDAAA,EAAsD,+pEAAA;AAAA,EACtD,2DAAA,EAA6D,8zDAAA;AAAA,EAC7D,cAAA,EAAgB,ojHAAA;AAAA,EAChB,sCAAA,EAAwC,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;;AAAA;AAAA,CAAA;AAAA,EACxC,wCAAA,EAA0C,imDAAA;AAAA,EAC1C,wCAAA,EAA0C,o5DAAA;AAAA,EAC1C,oCAAA,EAAsC,u4DAAA;AAAA,EACtC,kCAAA,EAAoC,ksCAAA;AAAA,EACpC,wCAAA,EAA0C,89CAAA;AAAA,EAC1C,yCAAA,EAA2C,8nEAAA;AAAA,EAC3C,qCAAA,EAAuC,yrDAAA;AAAA,EACvC,2CAAA,EAA6C;AAC/C,CAAC;;;ACJM,IAAM,oBAAA,GAAqC,OAAO,MAAA,CAAO;AAAA,EAC9D,IAAA,EAAM,UAAA;AAAA,EACN,KAAA,EAAO,wBAAA;AAAA,EACP,WAAA,EACE,4JAAA;AAAA,EACF,KAAA,EAAO;AACT,CAAC","file":"index.mjs","sourcesContent":["/**\n * AUTO-GENERATED build artifact — DO NOT COMMIT, DO NOT EDIT.\n *\n * Regenerated from @agentproto/corpus/test/fixtures/research/\n * by the prebuild / precheck-types / pretest / predev hooks on\n * this package. To change the preset content, edit the fixtures.\n */\n\nexport const RESEARCH_PRESET_FILES: Readonly<Record<string, string>> = Object.freeze({\n \"collections/corpus-candidate/COLLECTION.md\": \"---\\nschema: collection.schema/v1\\nname: corpus-candidate\\ntitle: Corpus Candidate\\ndescription: |\\n Candidate corpus item awaiting analysis and promotion to an AIP-10 entry.\\n Discovered candidates live in `_candidates.yaml` sidecar; materialized\\n ITEM.md files appear only after transition out of `discovered`.\\nversion: 1.0.0\\ninitialStatus: discovered\\nstatuses:\\n - { id: discovered, label: Discovered, transitionsTo: [analyzed, rejected] }\\n - { id: analyzed, label: Analyzed, transitionsTo: [approved, rejected, needs-work] }\\n - { id: needs-work, label: Needs Work, transitionsTo: [analyzed, rejected] }\\n - { id: approved, label: Approved, terminal: true }\\n - { id: rejected, label: Rejected, terminal: true }\\nidentity:\\n slugSource: id\\n filingPath: \\\"collections/corpus-candidate/{slug}/ITEM.md\\\"\\nfields:\\n - { name: sourcePath, type: string, required: true }\\n - { name: sourceUrl, type: url }\\n - { name: targetEntryPath, type: string }\\n - { name: corpusKind, type: enum, enum: [principle, example, pattern, critique, summary, timeline], required: true }\\n - { name: qualityScore, type: number }\\n - { name: riskScore, type: number }\\n - { name: promotionMode, type: enum, enum: [auto, human] }\\n - { name: contentHash, type: string }\\n - { name: reviewerNotes, type: text }\\nlints:\\n - { id: required-field-source-path, kind: required-field, appliesTo: \\\"*\\\", severity: error, params: { fields: [sourcePath] } }\\n - { id: required-field-corpus-kind, kind: required-field, appliesTo: \\\"*\\\", severity: error, params: { fields: [corpusKind] } }\\nmetadata:\\n corpus:\\n description: Used by source-scout (writes), research-analyst (writes), quality-reviewer (scores), corpus-curator (promotes).\\n---\\n\\n# Corpus Candidate collection\\n\\nHolds candidates discovered by the scout, analyzed by the analyst, scored by the reviewer, and promoted by the curator. State machine enforced by `statuses[].transitionsTo`. Domain-agnostic — the `corpusKind` field drives which entry type the analyst targets.\\n\",\n \"collections/corpus-candidate/nature-review-2026-06/ITEM.md\": \"---\\nschema: collection.item/v1\\ncollection: corpus-candidate\\nid: nature-review-2026-06\\ntitle: Replication crisis systematic review — pattern extraction\\nstatus: analyzed\\nsourcePath: sources/fresh/nature-review-2026-06.md\\nsourceUrl: https://example.com/nature/reviews/replication-crisis-2026\\ntargetEntryPath: entries/patterns/2026/systematic-review-pattern.md\\ncorpusKind: pattern\\ncontentHash: sha256:b2e4f8a1c3d5e7f9a1b3c5d7e9f1a3b5c7d9e1f3a5b7c9d1e3f5a7b9c1d3e5f7\\ntags: [methodology, replication, systematic-review]\\ncreatedAt: \\\"2026-06-10T09:00:00Z\\\"\\nupdatedAt: \\\"2026-06-10T10:30:00Z\\\"\\nmetadata:\\n corpus:\\n qualityScore: 4.5\\n riskScore: 0.8\\n promotionMode: auto\\n---\\n\\n# Candidate: Replication crisis systematic review\\n\\nCandidate extracted from a peer-reviewed Nature Reviews article. The pattern (hierarchical Bayesian meta-analysis for heterogeneous replication studies) generalizes across empirical research domains. Analyst recommends auto-promotion.\\n\\n## Analysis\\n- Primary-authority source (peer-reviewed journal, pre-registered)\\n- Methodology (hierarchical Bayesian meta-analysis) is domain-portable\\n- No legal or intellectual-property risk identified\\n- 847-study sample provides robust effect-size estimates\\n\\n## Decision\\n- promotionMode: auto\\n- gates pass: qualityScore 4.5 ≥ 4.2, riskScore 0.8 ≤ 1.5, archive hash present, all required fields populated\\n\",\n \"entries/critiques/2026/selection-bias-failure.md\": \"---\\nschema: knowledge.entry/v1\\nslug: selection-bias-failure\\nkind: critique\\ntitle: Selection bias as a driver of non-replication\\nupdated_at: \\\"2026-06-10T10:30:00Z\\\"\\nsources:\\n - nature-review-2026-06\\nconfidence: 0.90\\ntags: [methodology, bias, replication, failure-mode]\\nmetadata:\\n corpus:\\n status: active\\n qualityScore: 4.4\\n riskScore: 0.5\\n domain: research\\n temporal:\\n firstSeen: \\\"2011-01-01T00:00:00Z\\\"\\n lastSeen: \\\"2026-06-10T10:30:00Z\\\"\\n mentions:\\n - { at: \\\"2011-01-01T00:00:00Z\\\", sourceId: nature-review-2026-06, weight: 1.0 }\\n - { at: \\\"2026-06-10T10:30:00Z\\\", sourceId: nature-review-2026-06, weight: 1.0 }\\n promotionMode: human\\n promotedAt: \\\"2026-06-10T10:30:00Z\\\"\\n promotedBy: corpus-curator\\n---\\n\\n## Summary\\nStudies that select their sample on the outcome variable or restrict inclusion to high-effect subgroups produce inflated effect sizes that fail to replicate in unselected populations.\\n\\n## Why it fails\\nWhen inclusion criteria correlate with the outcome, the sample is not representative of the target population. The estimated effect is an artifact of the selection process, not a property of the population. Replication studies that sample more broadly will find smaller or null effects.\\n\\n## Failure modes\\n- **Outcome-dependent sampling**: recruiting only people who experienced the effect being studied.\\n- **Subgroup cherry-picking**: reporting the subgroup with the largest effect after observing the data.\\n- **Survivor bias in longitudinal studies**: only measuring participants who completed the study.\\n- **Publication bias at meta-analysis level**: including only published (positive) studies.\\n\\n## Use when\\n- Evaluating a new source for corpus inclusion: check whether sample selection is described.\\n- Scoring riskScore for an entry: unexplained heterogeneity across replications raises riskScore.\\n- Writing critique entries that expose methodological limitations in existing literature.\\n\\n## Avoid when\\n- The selection IS the design (e.g., case studies of rare diseases where selection is inherent).\\n\",\n \"entries/patterns/2026/systematic-review-pattern.md\": \"---\\nschema: knowledge.entry/v1\\nslug: systematic-review-pattern\\nkind: pattern\\ntitle: Systematic review with hierarchical Bayesian meta-analysis\\nupdated_at: \\\"2026-06-10T10:30:00Z\\\"\\nsources:\\n - nature-review-2026-06\\nconfidence: 0.88\\ntags: [methodology, meta-analysis, bayesian, replication]\\nmetadata:\\n corpus:\\n status: active\\n qualityScore: 4.5\\n riskScore: 0.6\\n domain: research\\n temporal:\\n firstSeen: \\\"2018-01-01T00:00:00Z\\\"\\n lastSeen: \\\"2026-06-10T10:30:00Z\\\"\\n mentions:\\n - { at: \\\"2018-01-01T00:00:00Z\\\", sourceId: nature-review-2026-06, weight: 1.0 }\\n - { at: \\\"2026-06-10T10:30:00Z\\\", sourceId: nature-review-2026-06, weight: 1.0 }\\n promotionMode: auto\\n promotedAt: \\\"2026-06-10T10:30:00Z\\\"\\n promotedBy: corpus-curator\\n---\\n\\n## Summary\\nSystematic reviews achieve reliable effect-size estimates when they: (1) pre-register inclusion criteria, (2) apply hierarchical Bayesian pooling to account for between-study heterogeneity, and (3) report credible intervals rather than p-values.\\n\\n## Why it works\\nHierarchical (random-effects) Bayesian models shrink extreme estimates toward the population mean — the replication crisis showed that underpowered studies with extreme point estimates drive non-replication. Pre-registration eliminates post-hoc analysis flexibility.\\n\\n## Transferable pattern\\n1. Pre-register: hypothesis, inclusion/exclusion criteria, analysis plan.\\n2. Screen independently: two reviewers screen abstracts; resolve conflicts by consensus.\\n3. Pool with hierarchical Bayes: τ² estimates between-study variance; shrink estimates accordingly.\\n4. Report 95 % credible intervals, not just posterior means.\\n5. Conduct sensitivity analysis: exclude low-quality studies, check robustness.\\n\\n## Use when\\n- Synthesizing a body of empirical literature with heterogeneous study designs.\\n- The corpus needs a high-confidence summary of a contested empirical question.\\n- Effect-size estimation matters, not just directional conclusions.\\n\\n## Avoid when\\n- Fewer than 10 primary studies exist (insufficient for pooling).\\n- The research question is qualitative or interpretive rather than quantitative.\\n\",\n \"entries/principles/2026/primary-sources-beat-synthesis.md\": \"---\\nschema: knowledge.entry/v1\\nslug: primary-sources-beat-synthesis\\nkind: principle\\ntitle: Primary sources beat synthesis\\nupdated_at: \\\"2026-06-10T10:30:00Z\\\"\\nsources:\\n - nature-review-2026-06\\nconfidence: 0.92\\ntags: [methodology, evidence, authority, sourcing]\\nmetadata:\\n corpus:\\n status: active\\n qualityScore: 4.7\\n riskScore: 0.4\\n domain: research\\n temporal:\\n firstSeen: \\\"2015-01-01T00:00:00Z\\\"\\n lastSeen: \\\"2026-06-10T10:30:00Z\\\"\\n mentions:\\n - { at: \\\"2015-01-01T00:00:00Z\\\", sourceId: nature-review-2026-06, weight: 1.0 }\\n - { at: \\\"2026-06-10T10:30:00Z\\\", sourceId: nature-review-2026-06, weight: 1.0 }\\n promotionMode: human\\n promotedAt: \\\"2026-06-10T10:30:00Z\\\"\\n promotedBy: corpus-curator\\n---\\n\\n## Summary\\nWhen a synthesis contradicts its primary sources, trust the primary sources. Systematic reviews compress information; compression loses detail that sometimes reverses the conclusion.\\n\\n## Why it works\\nSynthesis introduces two layers of error: sampling bias in study selection and aggregation error in effect-size combination. Primary data carries neither of these artefacts by construction.\\n\\n## Transferable pattern\\n- Cite primary studies, not meta-analyses, when a claim is contested.\\n- When a meta-analysis conflicts with a landmark primary study, read the primary study.\\n- Record confidence lower when your only source is a secondary synthesis.\\n\\n## Use when\\n- Evaluating evidentiary strength of a claim for corpus promotion.\\n- Deciding authority tier for a new source (primary vs secondary vs rumour).\\n- Writing confidence scores on entries derived from secondary sources.\\n\\n## Avoid when\\n- The domain has no accessible primary literature (policy documents, grey literature).\\n- Speed matters more than precision and a trusted synthesis is available.\\n\",\n \"KNOWLEDGE.md\": \"---\\nschema: knowledge.workspace/v1\\nname: research-corpus\\ntitle: Research Expert Corpus\\ndescription: |\\n Domain-agnostic research knowledge for autonomous agents. Composes AIP-10 (knowledge),\\n AIP-18 (curation collections), AIP-9 (operators), AIP-15 (workflows), and AIP-41\\n (routines) into an autonomous discovery-and-improvement loop.\\nversion: 1.0.0\\nentityTypes:\\n - { name: Principle, description: \\\"Durable finding or research rule\\\" }\\n - { name: Example, description: \\\"Concrete source-derived example or case study\\\" }\\n - { name: Pattern, description: \\\"Reusable transferable methodology or mechanic\\\" }\\n - { name: Critique, description: \\\"Negative example, failure mode, or methodological flaw\\\" }\\n - { name: Summary, description: \\\"Compressed synthesis of a source or topic cluster\\\" }\\n - { name: Timeline, description: \\\"Time-sensitive trend or field evolution\\\" }\\nsources:\\n retention: forever\\n signing: optional\\n hashAlgo: sha256\\n authorityDefault: secondary\\nlints:\\n - { id: require-source-on-examples, kind: require-source, appliesTo: Example, severity: error }\\n - { id: min-confidence-principles, kind: min-confidence, appliesTo: Principle, severity: warn, params: { min: 0.6 } }\\n - { id: max-age-timelines, kind: max-age, appliesTo: Timeline, severity: warn, params: { days: 730 } }\\n - { id: max-age-summaries, kind: max-age, appliesTo: Summary, severity: warn, params: { days: 180 } }\\n - { id: broken-ref-all, kind: broken-ref, appliesTo: \\\"*\\\", severity: error }\\n - { id: orphan-all, kind: orphan, appliesTo: \\\"*\\\", severity: info }\\ncuration:\\n tone: \\\"neutral, expert, source-backed\\\"\\n depth: medium\\n autoLink: byName\\n conflictResolution: authority\\nqueryHints:\\n preferRecent: true\\n preferAuthoritative: true\\nmetadata:\\n corpus:\\n version: 1\\n domain: research\\n entryLayout:\\n kind: hierarchical\\n groupBy: entityType\\n autoPromote:\\n enabled: true\\n requires:\\n qualityScore: { min: 4.2 }\\n riskScore: { max: 1.5 }\\n hasArchiveHash: true\\n requiredFields: [why_it_works, transferable_pattern, use_when, avoid_when]\\n notRestricted: true\\n temporal:\\n defaultHalfLifeDays: 365\\n scoreFormula: max-mention-decay\\n retrievalBoosts:\\n qualityScore: { weight: 0.30 }\\n temporalScore: { weight: 0.20 }\\n mentionCount: { weight: 0.10 }\\n confidence: { weight: 0.15 }\\n retrievalDefaults:\\n status: active\\n minQualityScore: 3.5\\n minTemporalScore: 0.1\\n accessModes:\\n read: { allowedRoles: [\\\"*\\\"] }\\n cite: { allowedRoles: [\\\"*\\\"] }\\n flag-learning: { allowedRoles: [\\\"*\\\"], rateLimit: { perOperator: 20, window: \\\"24h\\\" } }\\n curate: { allowedRoles: [corpus-curator, admin] }\\n promote: { allowedRoles: [corpus-curator, admin] }\\n admin-reindex: { allowedRoles: [admin] }\\n bypass-default-filters: { allowedRoles: [corpus-curator, admin], audit: true }\\n---\\n\\n# Research Corpus\\n\\nSource-of-truth for autonomous research agents. Composes AgentProto AIPs into a closed-loop knowledge-improvement system for any domain.\\n\\n## Three loops\\n- **Knowledge curation** — source-scout → analyst → entries\\n- **Quality gating** — quality-reviewer scores + routes (auto-promote vs human review)\\n- **Retrieval-quality feedback** — every query logged; `utility` + `lift` written back to entries\\n\\nAll corpus-specific policy lives under `metadata.corpus.*`. The six entity types (Principle, Example, Pattern, Critique, Summary, Timeline) are domain-agnostic — topics come from sources, not from the scaffold.\\n\",\n \"operators/corpus-curator/OPERATOR.md\": \"---\\nname: Corpus Curator\\nid: corpus-curator\\npersona_summary: Promotes approved candidates to AIP-10 entries, maintains _index.md, handles deprecation + supersession. The corpus's editor-in-chief.\\nversion: \\\"1.0.0\\\"\\nprofile:\\n role: |\\n Promote candidates that pass the auto-promote gate. Review the\\n human-review queue, decide approve/reject/needs-work. Keep the\\n corpus tidy: dedupe, deprecate stale entries, resolve\\n contradictions.\\n voice: |\\n Direct, decisive, opinionated about quality bar. First-person\\n plural for institutional voice. Cites specific entry slugs when\\n discussing deprecation or supersession.\\n boundaries:\\n - Never promote an entry that fails the auto-promote gate without explicit bypass.\\n - Never deprecate without a written reason in metadata.corpus.archiveReason.\\n - Always preserve the audit chain — _log.md events are append-only.\\ngovernance:\\n audit_log: \\\"audit:corpus/research/_log.md\\\"\\n autonomy: autonomous\\n policies:\\n - \\\"policy:corpus/research/curation\\\"\\nskills:\\n - source-analysis\\n - taxonomy\\n - editorial-judgment\\ntools:\\n - corpus-promote-candidate\\n - corpus-log-event\\n - knowledge-query\\nparticipation:\\n mode: proactive\\nmemory:\\n kind: operator-context\\nruntime:\\n kind: in-process\\ntags: [research, curator, corpus]\\nmetadata:\\n corpus:\\n domain: research\\n overlays:\\n policy: open\\n maxActiveCount: 10\\n---\\n\\n# Corpus Curator\\n\\nRuns after the reviewer scores a candidate. Promotes auto-approved entries; queues human-review-required candidates for the team. Drives entry lifecycle (active → archived).\\n\",\n \"operators/quality-reviewer/OPERATOR.md\": \"---\\nname: Quality Reviewer\\nid: quality-reviewer\\npersona_summary: Scores analyzed candidates against the corpus's quality + risk rubric. Decides promotionMode (auto vs human). Flags concerns the analyst missed.\\nversion: \\\"1.0.0\\\"\\nprofile:\\n role: |\\n Independent second pair of eyes on every analyzed candidate.\\n Adversarial-by-design — assumes the analyst was too generous\\n and looks for reasons NOT to promote.\\n voice: |\\n Critical, concrete, fair. Cites specific clauses of the\\n candidate body, not vibes. Always proposes a concrete score\\n (qualityScore 0-5, riskScore 0-5).\\n boundaries:\\n - Never promote on the analyst's authority — score and route.\\n - Never auto-promote a candidate flagged as restricted / personal / legal.\\n - Always justify a sub-2.0 quality score in reviewerNotes.\\ngovernance:\\n audit_log: \\\"audit:corpus/research/_log.md\\\"\\n autonomy: supervised\\n policies:\\n - \\\"policy:corpus/research/review-policy\\\"\\nskills:\\n - source-analysis\\n - critical-reading\\ntools:\\n - corpus-flag-learning\\n - knowledge-query\\nparticipation:\\n mode: proactive\\nmemory:\\n kind: operator-context\\nruntime:\\n kind: in-process\\ntags: [research, reviewer, corpus]\\nmetadata:\\n corpus:\\n domain: research\\n---\\n\\n# Quality Reviewer\\n\\nRuns after `research-analyst` produces an analyzed ITEM.md. Scores against:\\n\\n- **qualityScore** — accuracy, transferability, evidence strength, authority tier\\n- **riskScore** — legal/IP/compliance hazards, retracted studies, contested findings\\n- **promotionMode** — auto (gates pass) vs human (needs curator)\\n\",\n \"operators/research-analyst/OPERATOR.md\": \"---\\nname: Research Analyst\\nid: research-analyst\\npersona_summary: Domain-agnostic research analyst who converts raw sources into expert principles, patterns, and critiques for the research corpus.\\nversion: \\\"1.0.0\\\"\\nprofile:\\n role: |\\n Convert candidate sources discovered by the scout into corpus-grade\\n expert analysis: principles, patterns, critiques. Score quality and\\n risk to inform promotion gates. Works across any research domain —\\n the topic comes from the source, not from the operator persona.\\n voice: |\\n Concrete, source-backed, never superlative. Cite specific numbers and\\n named authors or publications. First-person plural (\\\"we\\\") for\\n institutional voice.\\n boundaries:\\n - Never invent quantitative claims; cite a source or mark as opinion.\\n - Never promote without quality-reviewer signoff (unless auto-promote gates pass).\\n - Never edit raw sources — only entries.\\ngovernance:\\n audit_log: \\\"audit:corpus/research/_log.md\\\"\\n autonomy: supervised\\n policies:\\n - \\\"policy:corpus/research/curation\\\"\\nskills:\\n - source-analysis\\n - research-synthesis\\ntools:\\n - corpus-flag-learning\\n - knowledge-query\\nparticipation:\\n mode: proactive\\nmemory:\\n kind: operator-context\\nruntime:\\n kind: in-process\\ntags: [research, analyst, corpus]\\nmetadata:\\n corpus:\\n domain: research\\n knowledgeViews:\\n - corpus: research\\n filter:\\n domain: [research]\\n minQualityScore: 3.5\\n defaultBoosts:\\n qualityScore: { weight: 0.40 }\\n temporalScore: { weight: 0.30 }\\n overlays:\\n policy: gated\\n maxActiveCount: 5\\n requireApprovalFrom: corpus-curator\\n allowedKinds: [overlay, block-replacement]\\n---\\n\\n# Research Analyst\\n\\nReads candidate sources from the scout, writes expert analysis as AIP-10 entries. Scores quality and risk. Signals the curator on auto-promote gate pass.\\n\",\n \"operators/source-scout/OPERATOR.md\": \"---\\nname: Source Scout\\nid: source-scout\\npersona_summary: Curates external feeds for fresh research source material — academic papers, articles, videos, social posts, and primary documents — and archives the worth-keeping ones into sources/.\\nversion: \\\"1.0.0\\\"\\nprofile:\\n role: |\\n Discover new candidate sources for the research corpus. Filter\\n noise vs signal at the scout stage so the analyst only sees\\n promising material. Source categories: article, video, social,\\n paper, primary, news.\\n voice: |\\n Efficient, terse, evidence-first. Names URLs + numbers, not\\n adjectives. Reports findings as `{source: <id>, why: <reason>}`\\n triples.\\n boundaries:\\n - Never re-archive an already-archived source (check content_hash).\\n - Never archive content with PII unless explicitly sanitized.\\n - Never archive paywalled / DMCA-restricted material without authorization.\\ngovernance:\\n audit_log: \\\"audit:corpus/research/_log.md\\\"\\n autonomy: autonomous\\n policies:\\n - \\\"policy:corpus/research/source-policy\\\"\\nskills:\\n - web-research\\n - source-analysis\\ntools:\\n - corpus-create-candidate\\n - knowledge-query\\n - web-search\\nparticipation:\\n mode: proactive\\nmemory:\\n kind: operator-context\\nruntime:\\n kind: in-process\\ntags: [research, scout, corpus]\\nmetadata:\\n corpus:\\n domain: research\\n knowledgeViews:\\n - corpus: research\\n filter:\\n domain: [research]\\n---\\n\\n# Source Scout\\n\\nRuns on-demand or on schedule (via `source-scout` routine). Fetches configured feeds and channels, hashes content, dedups against existing sources, and writes new candidates to `_candidates.yaml`. The analyst takes over from there.\\n\\nSupported source categories: `article` (blog/news), `video` (YouTube, conference talks), `social` (threads, posts), `paper` (peer-reviewed), `primary` (official documents, datasets), `news` (breaking coverage).\\n\",\n \"routines/source-scout/ROUTINE.md\": \"---\\nschema: routine/v1\\nid: source-scout\\ndescription: |\\n On-demand (or scheduled) routine that runs the source-scout operator to\\n discover new candidate sources across configured external feeds and channels.\\n Discovered sources are archived under sources/ and rows appended to\\n _candidates.yaml.\\nversion: \\\"1.0.0\\\"\\nschedule:\\n kind: cron\\n cron: \\\"0 8 * * 1\\\"\\n timezone: \\\"UTC\\\"\\n catchup: skip\\ntarget:\\n workflow: ingest-source\\n inputs:\\n feeds: [web-search, youtube, arxiv, news-api]\\n maxItemsPerRun: 30\\nretry:\\n max_attempts: 3\\n backoff: exponential\\non_failure:\\n create_work_item: true\\n fire_event: corpus.scout.failed\\nfires_events:\\n - corpus.scout.completed\\n - corpus.candidate.discovered\\nenabled: true\\ntags: [corpus, scout, weekly]\\nmetadata:\\n corpus:\\n domain: research\\n---\\n\\n# Source Scout Routine\\n\\nRuns weekly (Monday 08:00 UTC) by default; can also be triggered on-demand. Scouts external feeds for new candidate sources, archives them, and appends to `_candidates.yaml`. The candidate event downstream triggers `analyze-candidate` workflow.\\n\\nAdjust the `schedule` and `target.inputs.feeds` list to match your research domain's primary discovery channels.\\n\",\n \"sources/fresh/nature-review-2026-06.md\": \"---\\nschema: knowledge.source/v1\\nid: nature-review-2026-06\\npath: sources/fresh/nature-review-2026-06.md\\ntitle: Systematic review of replication failures in social science — June 2026\\ncaptured_at: \\\"2026-06-10T09:00:00Z\\\"\\ncaptured_by: source-scout\\ncontent_hash: sha256:b2e4f8a1c3d5e7f9a1b3c5d7e9f1a3b5c7d9e1f3a5b7c9d1e3f5a7b9c1d3e5f7\\nauthority: primary\\nlanguage: en\\ntags: [systematic-review, replication, methodology, social-science]\\nmetadata:\\n corpus:\\n originalUrl: https://example.com/nature/reviews/replication-crisis-2026\\n archiveTier: hot\\n archivedBy: source-scout\\n snapshotPath: sources/fresh/nature-review-2026-06.snapshot.mhtml\\n---\\n\\n# Systematic review: replication failures in social science (2026)\\n\\nCaptured from a peer-reviewed Nature Reviews article in June 2026. Meta-analysis of 847 attempted replications across psychology, economics, and political science (2010–2026).\\n\\n## Key findings\\n- Only 39 % of original findings replicated at p < 0.05 in pre-registered replications\\n- Effect sizes in successful replications averaged 68 % of originals\\n- Primary driver of non-replication: underpowered original studies, not fraud\\n\\n## Methodology note\\nAuthors applied a hierarchical Bayesian model to account for heterogeneity across domains. Pre-registered analysis plan at OSF (osf.io/example123).\\n\\n## Relevance\\nFoundational reference for any research corpus reasoning about evidentiary quality, source authority, and confidence thresholds.\\n\",\n \"workflows/analyze-candidate/WORKFLOW.md\": \"---\\nname: Analyze Corpus Candidate\\nid: analyze-candidate\\ndescription: |\\n Convert a discovered corpus candidate into an analyzed ITEM.md with\\n expert analysis, quality score, and risk score. Triggered by the\\n source-scout when it appends a row to _candidates.yaml.\\nversion: \\\"1.0.0\\\"\\ninputs:\\n type: object\\n required: [candidateId, sourcePath]\\n properties:\\n candidateId: { type: string, pattern: \\\"^[a-z0-9][a-z0-9-]*$\\\" }\\n sourcePath: { type: string }\\noutputs:\\n type: object\\n required: [itemPath, status]\\n properties:\\n itemPath: { type: string }\\n status: { type: string, enum: [analyzed, rejected, needs-work] }\\n qualityScore: { type: number }\\n riskScore: { type: number }\\nsteps:\\n - id: load-source\\n kind: tool\\n tool: knowledge.read_source\\n name: Load source bytes from sources/\\n inputs: { type: object, properties: { sourceId: { type: string } } }\\n next: analyze\\n - id: analyze\\n kind: tool\\n tool: research-analyst.analyze\\n name: Run research-analyst operator over the source\\n next: score\\n - id: score\\n kind: tool\\n tool: quality-reviewer.score\\n name: Compute quality + risk scores\\n next: gate\\n - id: gate\\n kind: branch\\n name: Decide promotionMode (auto vs human)\\n description: Check auto-promote gate against KNOWLEDGE.md.metadata.corpus.autoPromote\\n branches:\\n - { when: \\\"output.qualityScore >= 4.2 && output.riskScore <= 1.5\\\", next: \\\"auto-promote\\\" }\\n - { when: \\\"true\\\", next: \\\"human-review\\\" }\\n - id: auto-promote\\n kind: tool\\n tool: corpus-curator-promote\\n name: Promote to AIP-10 entry\\n - id: human-review\\n kind: approval\\n name: Queue for human curator\\n prompt: Review and approve or reject this candidate.\\n approvers:\\n - { role: corpus-curator }\\ntags: [corpus, workflow, analysis]\\nmetadata:\\n corpus:\\n domain: research\\n triggeredBy: source-scout\\n---\\n\\n# Analyze Candidate workflow\\n\\nConverts a discovered candidate into an analyzed ITEM.md. The research-analyst operator runs the actual analysis; this workflow orchestrates the pipeline (load → analyze → score → gate).\\n\",\n \"workflows/ingest-source/WORKFLOW.md\": \"---\\nname: Ingest source\\nid: ingest-source\\ndescription: |\\n Fetch + hash + dedup + archive a single source. Output: a new\\n candidate row in _candidates.yaml (or no-op if duplicate).\\nversion: \\\"1.0.0\\\"\\ninputs:\\n type: object\\n required: [sourceUrl]\\n properties:\\n sourceUrl: { type: string }\\n category: { type: string, enum: [article, video, social, paper, primary, news] }\\noutputs:\\n type: object\\n required: [outcome]\\n properties:\\n outcome: { type: string, enum: [archived, duplicate, rejected] }\\n sourceId: { type: string }\\n candidateId: { type: string }\\nsteps:\\n - id: fetch\\n kind: tool\\n tool: web-fetch\\n name: Fetch source content\\n - id: hash\\n kind: tool\\n tool: hash-content\\n name: Compute sha256 content_hash\\n - id: dedup\\n kind: branch\\n name: Dedup against existing sources\\n branches:\\n - { when: \\\"output.duplicate === true\\\", next: \\\"done-dup\\\" }\\n - { when: \\\"true\\\", next: \\\"archive\\\" }\\n - id: archive\\n kind: tool\\n tool: corpus-archive-source\\n name: Write source frontmatter + body to sources/<category>/<slug>.md\\n - id: create-candidate\\n kind: tool\\n tool: createCorpusCandidate\\n name: Append discovered row to _candidates.yaml\\n - id: done-dup\\n kind: tool\\n tool: corpus-log-event\\n name: Log dedup hit (no-op outcome)\\ntags: [corpus, ingest, scout]\\nmetadata:\\n corpus:\\n domain: research\\n triggeredBy: source-scout\\n---\\n\\n# Ingest source workflow\\n\\nStep 1 of the corpus loop. Single-source entry point. Called by the `source-scout` routine once per discovered URL. The `category` input (article | video | social | paper | primary | news) drives the archive path under `sources/`.\\n\",\n \"workflows/promote-corpus-item/WORKFLOW.md\": \"---\\nname: Promote corpus item\\nid: promote-corpus-item\\ndescription: |\\n Lift an approved candidate into a published AIP-10 entry. Writes\\n the entry file, regenerates _index.md, ships chunks to the\\n backing engine, appends a promotion event. Wraps the kit's\\n CorpusPromoter.promote().\\nversion: \\\"1.0.0\\\"\\ninputs:\\n type: object\\n required: [candidateId, entrySlug, entryKind, entryPath, frontmatter, body]\\n properties:\\n candidateId: { type: string }\\n entrySlug: { type: string }\\n entryKind: { type: string, enum: [principle, example, pattern, critique, summary, timeline] }\\n entryPath: { type: string }\\n frontmatter: { type: object }\\n body: { type: string }\\n bypassGate: { type: boolean }\\noutputs:\\n type: object\\n required: [entryPath, gatePassed]\\n properties:\\n entryPath: { type: string }\\n versionToken: { type: string }\\n chunkCount: { type: integer }\\n gatePassed: { type: boolean }\\n bypassed: { type: boolean }\\nsteps:\\n - id: promote\\n kind: tool\\n tool: promoteCorpusCandidate\\n name: Atomic promote (lock + write + index + chunks + event)\\ntags: [corpus, promote]\\nmetadata:\\n corpus:\\n domain: research\\n triggeredBy: corpus-curator\\n---\\n\\n# Promote corpus item workflow\\n\\nStep 3 of the corpus loop. Single-step wrapper for callers that want the workflow shape; the underlying `CorpusPromoter` does the multi-file transaction.\\n\",\n})\n","/**\n * Research corpus preset.\n *\n * Pure TS data — `files` is inlined from the M0 fixture workspace at\n * build time via `scripts/gen-research.mjs`. The M0 conformance test\n * proves every file validates against the actual AgentProto JSON\n * Schemas, so a host that writes these to disk gets a known-good\n * starter workspace.\n *\n * Usage:\n *\n * import { ResearchCorpusPreset } from \"@agentproto/corpus-presets/research\"\n * for (const [rel, content] of Object.entries(ResearchCorpusPreset.files)) {\n * await fs.writeFile(path.join(workspaceRoot, rel), content)\n * }\n */\n\nimport type { CorpusPreset } from \"@agentproto/corpus\"\nimport { RESEARCH_PRESET_FILES } from \"./files.js\"\n\nexport const ResearchCorpusPreset: CorpusPreset = Object.freeze({\n slug: \"research\",\n title: \"Research Expert Corpus\",\n description:\n \"Domain-agnostic research knowledge — principles, patterns, critiques. Composes AIP-10/18/9/15/41 into a closed-loop discovery-and-improvement system.\",\n files: RESEARCH_PRESET_FILES,\n})\n\n// Re-export the raw file map for callers that want it directly.\nexport { RESEARCH_PRESET_FILES }\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentproto/corpus-presets",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "@agentproto/corpus-presets — catalog of starter workspaces for the AIP-10 corpus runtime. Subpath exports per vertical (marketing, sales, …). Each preset is pure TS data — host iterates `files` and writes via FsPort. Mirrors @agentproto/role-catalog.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agentproto",
|
|
@@ -34,6 +34,11 @@
|
|
|
34
34
|
"import": "./dist/marketing/index.mjs",
|
|
35
35
|
"default": "./dist/marketing/index.mjs"
|
|
36
36
|
},
|
|
37
|
+
"./research": {
|
|
38
|
+
"types": "./dist/research/index.d.ts",
|
|
39
|
+
"import": "./dist/research/index.mjs",
|
|
40
|
+
"default": "./dist/research/index.mjs"
|
|
41
|
+
},
|
|
37
42
|
"./package.json": "./package.json"
|
|
38
43
|
},
|
|
39
44
|
"agentproto-corpus-preset": {
|
|
@@ -44,6 +49,12 @@
|
|
|
44
49
|
"entry": "./dist/marketing/index.mjs",
|
|
45
50
|
"export": "MarketingCorpusPreset",
|
|
46
51
|
"description": "Marketing knowledge corpus — principles, patterns, critiques, playbooks. Composes AIP-10/12/18/9/15/41 into a closed-loop improvement system."
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"slug": "research",
|
|
55
|
+
"entry": "./dist/research/index.mjs",
|
|
56
|
+
"export": "ResearchCorpusPreset",
|
|
57
|
+
"description": "Domain-agnostic research knowledge corpus — principles, patterns, critiques. Composes AIP-10/18/9/15/41 into a closed-loop discovery-and-improvement system."
|
|
47
58
|
}
|
|
48
59
|
]
|
|
49
60
|
},
|
|
@@ -57,7 +68,7 @@
|
|
|
57
68
|
},
|
|
58
69
|
"sideEffects": false,
|
|
59
70
|
"dependencies": {
|
|
60
|
-
"@agentproto/corpus": "0.
|
|
71
|
+
"@agentproto/corpus": "0.2.0"
|
|
61
72
|
},
|
|
62
73
|
"devDependencies": {
|
|
63
74
|
"@types/node": "^25.6.2",
|
|
@@ -67,15 +78,16 @@
|
|
|
67
78
|
"@agentproto/tooling": "0.1.0-alpha.0"
|
|
68
79
|
},
|
|
69
80
|
"scripts": {
|
|
70
|
-
"predev": "node scripts/gen-marketing.mjs",
|
|
81
|
+
"predev": "node scripts/gen-marketing.mjs && node scripts/gen-research.mjs",
|
|
71
82
|
"dev": "tsup --watch",
|
|
72
|
-
"prebuild": "node scripts/gen-marketing.mjs",
|
|
83
|
+
"prebuild": "node scripts/gen-marketing.mjs && node scripts/gen-research.mjs",
|
|
73
84
|
"build": "tsup",
|
|
74
|
-
"clean": "rm -rf dist src/marketing/files.ts",
|
|
75
|
-
"precheck-types": "node scripts/gen-marketing.mjs",
|
|
85
|
+
"clean": "rm -rf dist src/marketing/files.ts src/research/files.ts",
|
|
86
|
+
"precheck-types": "node scripts/gen-marketing.mjs && node scripts/gen-research.mjs",
|
|
76
87
|
"check-types": "tsc --noEmit",
|
|
77
|
-
"pretest": "node scripts/gen-marketing.mjs",
|
|
88
|
+
"pretest": "node scripts/gen-marketing.mjs && node scripts/gen-research.mjs",
|
|
78
89
|
"test": "vitest run --passWithNoTests",
|
|
79
|
-
"gen:marketing": "node scripts/gen-marketing.mjs"
|
|
90
|
+
"gen:marketing": "node scripts/gen-marketing.mjs",
|
|
91
|
+
"gen:research": "node scripts/gen-research.mjs"
|
|
80
92
|
}
|
|
81
93
|
}
|