@itsshadowai/refinery 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +228 -0
  3. package/coral/agents/claim-scout/coral-agent.toml +23 -0
  4. package/coral/agents/decision-synthesizer/coral-agent.toml +23 -0
  5. package/coral/agents/evidence-auditor/coral-agent.toml +23 -0
  6. package/coral/agents/memory-cartographer/coral-agent.toml +23 -0
  7. package/coral/agents/proposal-editor/coral-agent.toml +23 -0
  8. package/coral/agents/run-worker.sh +19 -0
  9. package/coral/refinery-config.toml +16 -0
  10. package/dist/adapters/codex-memory.d.ts +6 -0
  11. package/dist/adapters/codex-memory.js +264 -0
  12. package/dist/adapters/codex-memory.js.map +1 -0
  13. package/dist/cli.d.ts +2 -0
  14. package/dist/cli.js +671 -0
  15. package/dist/cli.js.map +1 -0
  16. package/dist/coral/client.d.ts +107 -0
  17. package/dist/coral/client.js +214 -0
  18. package/dist/coral/client.js.map +1 -0
  19. package/dist/coral/definitions.d.ts +25 -0
  20. package/dist/coral/definitions.js +53 -0
  21. package/dist/coral/definitions.js.map +1 -0
  22. package/dist/coral/mcp.d.ts +17 -0
  23. package/dist/coral/mcp.js +71 -0
  24. package/dist/coral/mcp.js.map +1 -0
  25. package/dist/coral/review-conductor.d.ts +120 -0
  26. package/dist/coral/review-conductor.js +1290 -0
  27. package/dist/coral/review-conductor.js.map +1 -0
  28. package/dist/coral/smoke.d.ts +1 -0
  29. package/dist/coral/smoke.js +265 -0
  30. package/dist/coral/smoke.js.map +1 -0
  31. package/dist/coral/topology.d.ts +5 -0
  32. package/dist/coral/topology.js +15 -0
  33. package/dist/coral/topology.js.map +1 -0
  34. package/dist/coral/worker.d.ts +34 -0
  35. package/dist/coral/worker.js +671 -0
  36. package/dist/coral/worker.js.map +1 -0
  37. package/dist/core/adapter.d.ts +93 -0
  38. package/dist/core/adapter.js +112 -0
  39. package/dist/core/adapter.js.map +1 -0
  40. package/dist/core/artifacts.d.ts +93 -0
  41. package/dist/core/artifacts.js +200 -0
  42. package/dist/core/artifacts.js.map +1 -0
  43. package/dist/core/deliberation.d.ts +89 -0
  44. package/dist/core/deliberation.js +385 -0
  45. package/dist/core/deliberation.js.map +1 -0
  46. package/dist/core/errors.d.ts +26 -0
  47. package/dist/core/errors.js +50 -0
  48. package/dist/core/errors.js.map +1 -0
  49. package/dist/core/intents.d.ts +5 -0
  50. package/dist/core/intents.js +34 -0
  51. package/dist/core/intents.js.map +1 -0
  52. package/dist/core/live-review.d.ts +93 -0
  53. package/dist/core/live-review.js +269 -0
  54. package/dist/core/live-review.js.map +1 -0
  55. package/dist/core/model-client.d.ts +19 -0
  56. package/dist/core/model-client.js +45 -0
  57. package/dist/core/model-client.js.map +1 -0
  58. package/dist/core/paths.d.ts +16 -0
  59. package/dist/core/paths.js +43 -0
  60. package/dist/core/paths.js.map +1 -0
  61. package/dist/core/review.d.ts +93 -0
  62. package/dist/core/review.js +102 -0
  63. package/dist/core/review.js.map +1 -0
  64. package/dist/core/specialists/claim-scout.d.ts +2 -0
  65. package/dist/core/specialists/claim-scout.js +26 -0
  66. package/dist/core/specialists/claim-scout.js.map +1 -0
  67. package/dist/core/specialists/decision-synthesizer.d.ts +2 -0
  68. package/dist/core/specialists/decision-synthesizer.js +35 -0
  69. package/dist/core/specialists/decision-synthesizer.js.map +1 -0
  70. package/dist/core/specialists/evidence-auditor.d.ts +2 -0
  71. package/dist/core/specialists/evidence-auditor.js +35 -0
  72. package/dist/core/specialists/evidence-auditor.js.map +1 -0
  73. package/dist/core/specialists/harness.d.ts +2 -0
  74. package/dist/core/specialists/harness.js +13 -0
  75. package/dist/core/specialists/harness.js.map +1 -0
  76. package/dist/core/specialists/index.d.ts +8 -0
  77. package/dist/core/specialists/index.js +8 -0
  78. package/dist/core/specialists/index.js.map +1 -0
  79. package/dist/core/specialists/memory-cartographer.d.ts +2 -0
  80. package/dist/core/specialists/memory-cartographer.js +33 -0
  81. package/dist/core/specialists/memory-cartographer.js.map +1 -0
  82. package/dist/core/specialists/prompt.d.ts +3 -0
  83. package/dist/core/specialists/prompt.js +25 -0
  84. package/dist/core/specialists/prompt.js.map +1 -0
  85. package/dist/core/specialists/proposal-editor.d.ts +2 -0
  86. package/dist/core/specialists/proposal-editor.js +37 -0
  87. package/dist/core/specialists/proposal-editor.js.map +1 -0
  88. package/dist/core/specialists/types.d.ts +20 -0
  89. package/dist/core/specialists/types.js +2 -0
  90. package/dist/core/specialists/types.js.map +1 -0
  91. package/dist/env.d.ts +11 -0
  92. package/dist/env.js +53 -0
  93. package/dist/env.js.map +1 -0
  94. package/dist/mcp.d.ts +9 -0
  95. package/dist/mcp.js +147 -0
  96. package/dist/mcp.js.map +1 -0
  97. package/package.json +50 -0
  98. package/skills/refinery/SKILL.md +117 -0
  99. package/skills/refinery/agents/openai.yaml +4 -0
@@ -0,0 +1,26 @@
1
+ export const claimScoutSpecialist = {
2
+ name: "claim-scout",
3
+ kind: "local-specialist",
4
+ purpose: "Extract candidate memory claims from source evidence.",
5
+ prompt: `You are the Claim Scout specialist for Refinery.
6
+
7
+ Read only the supplied source chunks. Extract candidate memories that may matter
8
+ in future agent sessions. Prefer durable project facts, recurring workflows,
9
+ architecture decisions, and failure modes. Do not classify scope or mutation
10
+ operation here; emit source-grounded claims with source references for downstream
11
+ critique and proposal work.`,
12
+ inputContract: [
13
+ "source_chunks: ordered source excerpts with source_id, source_path, and text",
14
+ "active_memory_hints: optional compact list of active memory ids and bodies",
15
+ ],
16
+ outputContract: [
17
+ "candidates[].claim: one candidate learning stated plainly",
18
+ "candidates[].source_refs: source ids/paths supporting the claim",
19
+ "candidates[].why_future_useful: short rationale for future retrieval value",
20
+ ],
21
+ toolBoundary: {
22
+ allowedTools: ["read_source_chunk", "list_active_memory_hints", "emit_candidates"],
23
+ forbiddenTools: ["approve_proposal", "write_active_memory", "call_live_llm_endpoint"],
24
+ },
25
+ };
26
+ //# sourceMappingURL=claim-scout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claim-scout.js","sourceRoot":"","sources":["../../../src/core/specialists/claim-scout.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,oBAAoB,GAAoB;IACnD,IAAI,EAAE,aAAa;IACnB,IAAI,EAAE,kBAAkB;IACxB,OAAO,EAAE,uDAAuD;IAChE,MAAM,EAAE;;;;;;4BAMkB;IAC1B,aAAa,EAAE;QACb,8EAA8E;QAC9E,4EAA4E;KAC7E;IACD,cAAc,EAAE;QACd,2DAA2D;QAC3D,iEAAiE;QACjE,4EAA4E;KAC7E;IACD,YAAY,EAAE;QACZ,YAAY,EAAE,CAAC,mBAAmB,EAAE,0BAA0B,EAAE,iBAAiB,CAAC;QAClF,cAAc,EAAE,CAAC,kBAAkB,EAAE,qBAAqB,EAAE,wBAAwB,CAAC;KACtF;CACF,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { LocalSpecialist } from "./types.ts";
2
+ export declare const decisionSynthesizerSpecialist: LocalSpecialist;
@@ -0,0 +1,35 @@
1
+ export const decisionSynthesizerSpecialist = {
2
+ name: "decision-synthesizer",
3
+ kind: "local-specialist",
4
+ purpose: "Resolve the challenge ledger into final proposed edits, rejected candidates, and unresolved questions.",
5
+ prompt: `You are the Decision Synthesizer specialist for Refinery.
6
+
7
+ Decide whether each typed candidate should become a final memory proposal.
8
+ Resolve evidence-audit challenges, memory-map findings, endorsements, and
9
+ unresolved questions. Reject ephemeral run noise, one-off operational details,
10
+ duplicates, unsupported claims, and memories without clear future retrieval
11
+ value. Emit final proposal-shaped records only; activation is reserved for the
12
+ caller.`,
13
+ inputContract: [
14
+ "typed[].body, memory_type, proposed_scope, action, and source_refs from Proposal Editor",
15
+ "typed[].target_memory_id and optional typed[].target_memory_ids when applicable",
16
+ "debate_critique.claim_cards and debate_critique.challenge_ledger",
17
+ ],
18
+ outputContract: [
19
+ "proposals[].memory_type",
20
+ "proposals[].proposed_scope",
21
+ "proposals[].body",
22
+ "proposals[].confidence",
23
+ "proposals[].rationale",
24
+ "proposals[].source_refs",
25
+ "proposals[].action",
26
+ "proposals[].target_memory_id",
27
+ "proposals[].target_memory_ids when a merge or supersede proposal targets multiple memories",
28
+ "rejected[].reason for candidates filtered out before proposal creation",
29
+ ],
30
+ toolBoundary: {
31
+ allowedTools: ["read_typed_candidate", "score_future_usefulness", "emit_proposal"],
32
+ forbiddenTools: ["approve_proposal", "write_active_memory", "call_live_llm_endpoint"],
33
+ },
34
+ };
35
+ //# sourceMappingURL=decision-synthesizer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decision-synthesizer.js","sourceRoot":"","sources":["../../../src/core/specialists/decision-synthesizer.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,6BAA6B,GAAoB;IAC5D,IAAI,EAAE,sBAAsB;IAC5B,IAAI,EAAE,kBAAkB;IACxB,OAAO,EAAE,wGAAwG;IACjH,MAAM,EAAE;;;;;;;QAOF;IACN,aAAa,EAAE;QACb,yFAAyF;QACzF,iFAAiF;QACjF,kEAAkE;KACnE;IACD,cAAc,EAAE;QACd,yBAAyB;QACzB,4BAA4B;QAC5B,kBAAkB;QAClB,wBAAwB;QACxB,uBAAuB;QACvB,yBAAyB;QACzB,oBAAoB;QACpB,8BAA8B;QAC9B,4FAA4F;QAC5F,wEAAwE;KACzE;IACD,YAAY,EAAE;QACZ,YAAY,EAAE,CAAC,sBAAsB,EAAE,yBAAyB,EAAE,eAAe,CAAC;QAClF,cAAc,EAAE,CAAC,kBAAkB,EAAE,qBAAqB,EAAE,wBAAwB,CAAC;KACtF;CACF,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { LocalSpecialist } from "./types.ts";
2
+ export declare const evidenceAuditorSpecialist: LocalSpecialist;
@@ -0,0 +1,35 @@
1
+ export const evidenceAuditorSpecialist = {
2
+ name: "evidence-auditor",
3
+ kind: "local-specialist",
4
+ purpose: "Audit source support, provenance, truncation, duplicate risk, conflicts, and scope risk for claim cards.",
5
+ prompt: `You are the Evidence and Provenance Auditor specialist for Refinery.
6
+
7
+ Audit each claim card against the supplied source chunks and active project
8
+ memories. Classify the strongest evidence issue or endorsement as exactly one
9
+ of: novel, duplicate, refinement, contradiction, supersession, or too_weak.
10
+
11
+ Be bounded. Do not debate indefinitely, invent missing memory records, or
12
+ rewrite proposals. Choose the strongest relationship supported by the claim,
13
+ source evidence, and active-memory candidates. Use novel when no active memory
14
+ materially overlaps. Use too_weak when source support, provenance, truncation, or
15
+ future value is insufficient.`,
16
+ inputContract: [
17
+ "claim_cards[] from Claim Scout",
18
+ "source_chunks[] used as evidence",
19
+ "active_memory_candidates[]: active project memories retrieved for each claim body",
20
+ ],
21
+ outputContract: [
22
+ "findings[].body: claim body being audited",
23
+ "findings[].relation: novel | duplicate | refinement | contradiction | supersession | too_weak",
24
+ "findings[].target_memory_id: active memory id when relation targets one memory, otherwise null",
25
+ "findings[].confidence: 0..1 confidence in the relationship classification",
26
+ "findings[].rationale: short explanation grounded in source and memory evidence",
27
+ "findings[].source_refs: claim source references",
28
+ "findings[].memory_refs: objects with memory_id and provenance_kind for active memories used for the decision; never bare ids",
29
+ ],
30
+ toolBoundary: {
31
+ allowedTools: ["read_claim_card", "read_source_chunk", "search_active_memory", "emit_evidence_findings"],
32
+ forbiddenTools: ["approve_proposal", "write_active_memory", "promote_memory", "call_live_llm_endpoint"],
33
+ },
34
+ };
35
+ //# sourceMappingURL=evidence-auditor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evidence-auditor.js","sourceRoot":"","sources":["../../../src/core/specialists/evidence-auditor.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,yBAAyB,GAAoB;IACxD,IAAI,EAAE,kBAAkB;IACxB,IAAI,EAAE,kBAAkB;IACxB,OAAO,EAAE,0GAA0G;IACnH,MAAM,EAAE;;;;;;;;;;8BAUoB;IAC5B,aAAa,EAAE;QACb,gCAAgC;QAChC,kCAAkC;QAClC,mFAAmF;KACpF;IACD,cAAc,EAAE;QACd,2CAA2C;QAC3C,+FAA+F;QAC/F,gGAAgG;QAChG,2EAA2E;QAC3E,gFAAgF;QAChF,iDAAiD;QACjD,8HAA8H;KAC/H;IACD,YAAY,EAAE;QACZ,YAAY,EAAE,CAAC,iBAAiB,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,wBAAwB,CAAC;QACxG,cAAc,EAAE,CAAC,kBAAkB,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,wBAAwB,CAAC;KACxG;CACF,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { LocalSpecialist } from "./types.ts";
2
+ export declare const orderedSpecialists: LocalSpecialist[];
@@ -0,0 +1,13 @@
1
+ import { claimScoutSpecialist } from "./claim-scout.js";
2
+ import { memoryCartographerSpecialist } from "./memory-cartographer.js";
3
+ import { evidenceAuditorSpecialist } from "./evidence-auditor.js";
4
+ import { proposalEditorSpecialist } from "./proposal-editor.js";
5
+ import { decisionSynthesizerSpecialist } from "./decision-synthesizer.js";
6
+ export const orderedSpecialists = [
7
+ claimScoutSpecialist,
8
+ memoryCartographerSpecialist,
9
+ evidenceAuditorSpecialist,
10
+ proposalEditorSpecialist,
11
+ decisionSynthesizerSpecialist,
12
+ ];
13
+ //# sourceMappingURL=harness.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"harness.js","sourceRoot":"","sources":["../../../src/core/specialists/harness.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,4BAA4B,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,6BAA6B,EAAE,MAAM,2BAA2B,CAAC;AAE1E,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,oBAAoB;IACpB,4BAA4B;IAC5B,yBAAyB;IACzB,wBAAwB;IACxB,6BAA6B;CAC9B,CAAC"}
@@ -0,0 +1,8 @@
1
+ export { claimScoutSpecialist } from "./claim-scout.ts";
2
+ export { memoryCartographerSpecialist } from "./memory-cartographer.ts";
3
+ export { evidenceAuditorSpecialist } from "./evidence-auditor.ts";
4
+ export { proposalEditorSpecialist } from "./proposal-editor.ts";
5
+ export { decisionSynthesizerSpecialist } from "./decision-synthesizer.ts";
6
+ export { buildSpecialistInstructions, buildSpecialistUserPrompt, } from "./prompt.ts";
7
+ export type { LocalSpecialist, ModelCaller, SpecialistName, ToolBoundary } from "./types.ts";
8
+ export { orderedSpecialists as specialists } from "./harness.ts";
@@ -0,0 +1,8 @@
1
+ export { claimScoutSpecialist } from "./claim-scout.js";
2
+ export { memoryCartographerSpecialist } from "./memory-cartographer.js";
3
+ export { evidenceAuditorSpecialist } from "./evidence-auditor.js";
4
+ export { proposalEditorSpecialist } from "./proposal-editor.js";
5
+ export { decisionSynthesizerSpecialist } from "./decision-synthesizer.js";
6
+ export { buildSpecialistInstructions, buildSpecialistUserPrompt, } from "./prompt.js";
7
+ export { orderedSpecialists as specialists } from "./harness.js";
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/specialists/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,4BAA4B,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,6BAA6B,EAAE,MAAM,2BAA2B,CAAC;AAC1E,OAAO,EACL,2BAA2B,EAC3B,yBAAyB,GAC1B,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,kBAAkB,IAAI,WAAW,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { LocalSpecialist } from "./types.ts";
2
+ export declare const memoryCartographerSpecialist: LocalSpecialist;
@@ -0,0 +1,33 @@
1
+ export const memoryCartographerSpecialist = {
2
+ name: "memory-cartographer",
3
+ kind: "local-specialist",
4
+ purpose: "Map claims to nearby active memories, duplicate targets, supersession targets, and conflicts.",
5
+ prompt: `You are the Memory Cartographer specialist for Refinery.
6
+
7
+ Map each claim against active project memories. Identify whether the claim is
8
+ novel, duplicate, refinement, contradiction, supersession, or too_weak. When a
9
+ claim should update, replace, merge, or challenge an active memory, identify the
10
+ target memory id and cite the memory evidence used for that decision.
11
+
12
+ Do not write memory and do not make final acceptance decisions. Your output is a
13
+ cartographic relationship map for the Proposal Editor and Decision Synthesizer.`,
14
+ inputContract: [
15
+ "candidates[].claim from Claim Scout",
16
+ "candidates[].source_refs from Claim Scout",
17
+ "active_memory_hints: existing memories for target selection and duplicate/conflict checks",
18
+ ],
19
+ outputContract: [
20
+ "findings[].body: claim body being mapped",
21
+ "findings[].relation: novel | duplicate | refinement | contradiction | supersession | too_weak",
22
+ "findings[].target_memory_id: active memory id when relation targets one memory, otherwise null",
23
+ "findings[].confidence: 0..1 confidence in the relationship classification",
24
+ "findings[].rationale: short explanation grounded in claim and memory evidence",
25
+ "findings[].source_refs: claim source references",
26
+ "findings[].memory_refs: objects with memory_id and provenance_kind for active memories used for the decision; never bare ids",
27
+ ],
28
+ toolBoundary: {
29
+ allowedTools: ["read_claim_card", "list_active_memory_hints", "emit_memory_map"],
30
+ forbiddenTools: ["approve_proposal", "write_active_memory", "call_live_llm_endpoint"],
31
+ },
32
+ };
33
+ //# sourceMappingURL=memory-cartographer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory-cartographer.js","sourceRoot":"","sources":["../../../src/core/specialists/memory-cartographer.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,4BAA4B,GAAoB;IAC3D,IAAI,EAAE,qBAAqB;IAC3B,IAAI,EAAE,kBAAkB;IACxB,OAAO,EAAE,+FAA+F;IACxG,MAAM,EAAE;;;;;;;;gFAQsE;IAC9E,aAAa,EAAE;QACb,qCAAqC;QACrC,2CAA2C;QAC3C,2FAA2F;KAC5F;IACD,cAAc,EAAE;QACd,0CAA0C;QAC1C,+FAA+F;QAC/F,gGAAgG;QAChG,2EAA2E;QAC3E,+EAA+E;QAC/E,iDAAiD;QACjD,8HAA8H;KAC/H;IACD,YAAY,EAAE;QACZ,YAAY,EAAE,CAAC,iBAAiB,EAAE,0BAA0B,EAAE,iBAAiB,CAAC;QAChF,cAAc,EAAE,CAAC,kBAAkB,EAAE,qBAAqB,EAAE,wBAAwB,CAAC;KACtF;CACF,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { LocalSpecialist } from "./types.ts";
2
+ export declare function buildSpecialistInstructions(specialist: LocalSpecialist): string;
3
+ export declare function buildSpecialistUserPrompt(input: unknown): string;
@@ -0,0 +1,25 @@
1
+ export function buildSpecialistInstructions(specialist) {
2
+ return [
3
+ specialist.prompt,
4
+ "",
5
+ "Input contract:",
6
+ ...specialist.inputContract.map((item) => `- ${item}`),
7
+ "",
8
+ "Output contract:",
9
+ ...specialist.outputContract.map((item) => `- ${item}`),
10
+ "",
11
+ "Tool boundary:",
12
+ `- Allowed tools: ${specialist.toolBoundary.allowedTools.join(", ") || "none"}`,
13
+ `- Forbidden tools: ${specialist.toolBoundary.forbiddenTools.join(", ") || "none"}`,
14
+ ].join("\n");
15
+ }
16
+ export function buildSpecialistUserPrompt(input) {
17
+ return [
18
+ "Process this Refinery payload using your specialist contract.",
19
+ "",
20
+ "Return only JSON that satisfies the output contract.",
21
+ "",
22
+ JSON.stringify(input, null, 2),
23
+ ].join("\n");
24
+ }
25
+ //# sourceMappingURL=prompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../../src/core/specialists/prompt.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,2BAA2B,CAAC,UAA2B;IACrE,OAAO;QACL,UAAU,CAAC,MAAM;QACjB,EAAE;QACF,iBAAiB;QACjB,GAAG,UAAU,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,IAAI,EAAE,CAAC;QACtD,EAAE;QACF,kBAAkB;QAClB,GAAG,UAAU,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,IAAI,EAAE,CAAC;QACvD,EAAE;QACF,gBAAgB;QAChB,oBAAoB,UAAU,CAAC,YAAY,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,MAAM,EAAE;QAC/E,sBAAsB,UAAU,CAAC,YAAY,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,MAAM,EAAE;KACpF,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAED,MAAM,UAAU,yBAAyB,CAAC,KAAc;IACtD,OAAO;QACL,+DAA+D;QAC/D,EAAE;QACF,sDAAsD;QACtD,EAAE;QACF,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;KAC/B,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { LocalSpecialist } from "./types.ts";
2
+ export declare const proposalEditorSpecialist: LocalSpecialist;
@@ -0,0 +1,37 @@
1
+ export const proposalEditorSpecialist = {
2
+ name: "proposal-editor",
3
+ kind: "local-specialist",
4
+ purpose: "Turn surviving claims into typed proposal packets with replacement bodies, scope, action, and rationale.",
5
+ prompt: `You are the Proposal Editor specialist for Refinery.
6
+
7
+ Turn claim cards and memory maps into typed proposal candidates. Preserve
8
+ meaning and provenance, remove session-only phrasing, make each body
9
+ understandable without opening the original transcript, and choose the most
10
+ appropriate memory-maintenance action. Do not approve, reject, or activate
11
+ memory.`,
12
+ inputContract: [
13
+ "candidates[] from Claim Scout",
14
+ "memory_map.findings[] from Memory Cartographer",
15
+ "active_memory_hints: optional existing memories for target selection",
16
+ ],
17
+ outputContract: [
18
+ "typed[].memory_type: same value as typed[].primary_type for proposal compatibility",
19
+ "typed[].primary_type: semantic | episodic | procedural | operational | reflective",
20
+ "typed[].secondary_type: optional secondary memory type or null",
21
+ "typed[].type_confidence: 0..1 confidence in the type assignment",
22
+ "typed[].type_rationale: short explanation of the type/action decision",
23
+ "typed[].ambiguities: string list of unresolved ambiguities",
24
+ "typed[].durability: durable | ttl | ephemeral",
25
+ "typed[].ttl: TTL string when durability is ttl, otherwise null",
26
+ "typed[].proposed_scope: project for Stage A",
27
+ "typed[].action: create | update | supersede | archive | merge",
28
+ "typed[].target_memory_id: primary existing memory id when one target applies, otherwise null",
29
+ "typed[].target_memory_ids: optional list of existing memory ids for merge or supersede across multiple memories",
30
+ "typed[].source_refs: preserved evidence references",
31
+ ],
32
+ toolBoundary: {
33
+ allowedTools: ["read_claim_card", "read_memory_map", "emit_typed_candidate"],
34
+ forbiddenTools: ["approve_proposal", "write_active_memory", "call_live_llm_endpoint"],
35
+ },
36
+ };
37
+ //# sourceMappingURL=proposal-editor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proposal-editor.js","sourceRoot":"","sources":["../../../src/core/specialists/proposal-editor.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,wBAAwB,GAAoB;IACvD,IAAI,EAAE,iBAAiB;IACvB,IAAI,EAAE,kBAAkB;IACxB,OAAO,EAAE,0GAA0G;IACnH,MAAM,EAAE;;;;;;QAMF;IACN,aAAa,EAAE;QACb,+BAA+B;QAC/B,gDAAgD;QAChD,sEAAsE;KACvE;IACD,cAAc,EAAE;QACd,oFAAoF;QACpF,mFAAmF;QACnF,gEAAgE;QAChE,iEAAiE;QACjE,uEAAuE;QACvE,4DAA4D;QAC5D,+CAA+C;QAC/C,gEAAgE;QAChE,6CAA6C;QAC7C,+DAA+D;QAC/D,8FAA8F;QAC9F,iHAAiH;QACjH,oDAAoD;KACrD;IACD,YAAY,EAAE;QACZ,YAAY,EAAE,CAAC,iBAAiB,EAAE,iBAAiB,EAAE,sBAAsB,CAAC;QAC5E,cAAc,EAAE,CAAC,kBAAkB,EAAE,qBAAqB,EAAE,wBAAwB,CAAC;KACtF;CACF,CAAC"}
@@ -0,0 +1,20 @@
1
+ export type SpecialistName = "claim-scout" | "memory-cartographer" | "evidence-auditor" | "proposal-editor" | "decision-synthesizer";
2
+ export interface ToolBoundary {
3
+ allowedTools: string[];
4
+ forbiddenTools: string[];
5
+ }
6
+ export interface LocalSpecialist {
7
+ name: SpecialistName;
8
+ kind: "local-specialist";
9
+ purpose: string;
10
+ prompt: string;
11
+ inputContract: string[];
12
+ outputContract: string[];
13
+ toolBoundary: ToolBoundary;
14
+ }
15
+ export type ModelCaller = (args: {
16
+ model: import("../../env.ts").ModelConfig;
17
+ system: string;
18
+ user: string;
19
+ specialist: LocalSpecialist;
20
+ }) => Promise<string>;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/core/specialists/types.ts"],"names":[],"mappings":""}
package/dist/env.d.ts ADDED
@@ -0,0 +1,11 @@
1
+ export interface ModelConfig {
2
+ provider: string;
3
+ baseUrl: string;
4
+ modelName: string;
5
+ apiKey: string;
6
+ maxTokens?: number;
7
+ }
8
+ export declare const defaultOpenRouterMaxTokens = 8000;
9
+ export declare function loadLocalEnv(cwd?: string): Record<string, string>;
10
+ export declare function parseModelMaxTokens(value: string | undefined, fallback?: number): number;
11
+ export declare function loadModelConfig(cwd?: string): ModelConfig;
package/dist/env.js ADDED
@@ -0,0 +1,53 @@
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+ export const defaultOpenRouterMaxTokens = 8000;
4
+ function parseDotEnv(contents) {
5
+ const values = {};
6
+ for (const rawLine of contents.split(/\r?\n/)) {
7
+ const line = rawLine.trim();
8
+ if (!line || line.startsWith("#"))
9
+ continue;
10
+ const eq = line.indexOf("=");
11
+ if (eq < 0)
12
+ continue;
13
+ const key = line.slice(0, eq).trim();
14
+ let value = line.slice(eq + 1).trim();
15
+ if ((value.startsWith('"') && value.endsWith('"')) ||
16
+ (value.startsWith("'") && value.endsWith("'"))) {
17
+ value = value.slice(1, -1);
18
+ }
19
+ values[key] = value;
20
+ }
21
+ return values;
22
+ }
23
+ export function loadLocalEnv(cwd = process.cwd()) {
24
+ const envPath = path.join(cwd, ".env");
25
+ if (!fs.existsSync(envPath))
26
+ return {};
27
+ return parseDotEnv(fs.readFileSync(envPath, "utf8"));
28
+ }
29
+ export function parseModelMaxTokens(value, fallback = defaultOpenRouterMaxTokens) {
30
+ if (!value)
31
+ return fallback;
32
+ const parsed = Number.parseInt(value, 10);
33
+ if (!Number.isFinite(parsed) || parsed <= 0) {
34
+ throw new Error("REFINERY_MODEL_MAX_TOKENS or MODEL_MAX_TOKENS must be a positive integer.");
35
+ }
36
+ return parsed;
37
+ }
38
+ export function loadModelConfig(cwd = process.cwd()) {
39
+ const local = loadLocalEnv(cwd);
40
+ const read = (key) => process.env[key] ?? local[key] ?? "";
41
+ const config = {
42
+ provider: read("REFINERY_MODEL_PROVIDER") || "openrouter",
43
+ baseUrl: read("REFINERY_MODEL_BASE_URL") || "https://openrouter.ai/api/v1",
44
+ modelName: read("REFINERY_MODEL_NAME") || "deepseek/deepseek-v4-pro",
45
+ apiKey: read("OPENROUTER_API_KEY"),
46
+ maxTokens: parseModelMaxTokens(read("REFINERY_MODEL_MAX_TOKENS") || read("MODEL_MAX_TOKENS") || undefined),
47
+ };
48
+ if (!config.apiKey) {
49
+ throw new Error("OPENROUTER_API_KEY is required in environment or .env");
50
+ }
51
+ return config;
52
+ }
53
+ //# sourceMappingURL=env.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env.js","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CA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,CAAC;IAC3E,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
package/dist/mcp.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env node
2
+ type JsonRpcRequest = {
3
+ jsonrpc?: string;
4
+ id?: string | number | null;
5
+ method?: string;
6
+ params?: Record<string, unknown>;
7
+ };
8
+ export declare function handleMessage(message: JsonRpcRequest): string | null;
9
+ export {};
package/dist/mcp.js ADDED
@@ -0,0 +1,147 @@
1
+ #!/usr/bin/env node
2
+ import { buildSpecialistInstructions, buildSpecialistUserPrompt, specialists, } from "./core/specialists/index.js";
3
+ const tools = [
4
+ {
5
+ name: "refinery_list_specialists",
6
+ description: "List storage-agnostic Refinery specialist contracts.",
7
+ inputSchema: {
8
+ type: "object",
9
+ properties: {},
10
+ additionalProperties: false,
11
+ },
12
+ },
13
+ {
14
+ name: "refinery_get_specialist_contract",
15
+ description: "Return one specialist prompt, input contract, output contract, and tool boundary.",
16
+ inputSchema: {
17
+ type: "object",
18
+ properties: {
19
+ name: {
20
+ type: "string",
21
+ enum: specialists.map((specialist) => specialist.name),
22
+ },
23
+ },
24
+ required: ["name"],
25
+ additionalProperties: false,
26
+ },
27
+ },
28
+ {
29
+ name: "refinery_build_specialist_prompt",
30
+ description: "Build a stateless system/user prompt pair for a specialist over caller-provided input.",
31
+ inputSchema: {
32
+ type: "object",
33
+ properties: {
34
+ name: {
35
+ type: "string",
36
+ enum: specialists.map((specialist) => specialist.name),
37
+ },
38
+ input: {
39
+ description: "Caller-provided source slice, candidates, proposals, or context.",
40
+ },
41
+ },
42
+ required: ["name", "input"],
43
+ additionalProperties: false,
44
+ },
45
+ },
46
+ ];
47
+ function getSpecialist(name) {
48
+ if (typeof name !== "string")
49
+ throw new Error("specialist name must be a string");
50
+ const specialist = specialists.find((candidate) => candidate.name === name);
51
+ if (!specialist)
52
+ throw new Error(`Unknown specialist: ${name}`);
53
+ return specialist;
54
+ }
55
+ function textResult(text, structuredContent) {
56
+ return {
57
+ content: [{ type: "text", text }],
58
+ structuredContent,
59
+ };
60
+ }
61
+ function handleToolCall(name, args = {}) {
62
+ if (name === "refinery_list_specialists") {
63
+ const result = specialists.map((specialist) => ({
64
+ name: specialist.name,
65
+ purpose: specialist.purpose,
66
+ allowedTools: specialist.toolBoundary.allowedTools,
67
+ forbiddenTools: specialist.toolBoundary.forbiddenTools,
68
+ }));
69
+ return textResult(JSON.stringify(result, null, 2), { specialists: result });
70
+ }
71
+ if (name === "refinery_get_specialist_contract") {
72
+ const specialist = getSpecialist(args.name);
73
+ return textResult(JSON.stringify(specialist, null, 2), { specialist });
74
+ }
75
+ if (name === "refinery_build_specialist_prompt") {
76
+ const specialist = getSpecialist(args.name);
77
+ const result = {
78
+ specialist: specialist.name,
79
+ system: buildSpecialistInstructions(specialist),
80
+ user: buildSpecialistUserPrompt(args.input),
81
+ };
82
+ return textResult(JSON.stringify(result, null, 2), result);
83
+ }
84
+ throw new Error(`Unknown tool: ${name}`);
85
+ }
86
+ function response(id, result) {
87
+ return JSON.stringify({ jsonrpc: "2.0", id, result });
88
+ }
89
+ function errorResponse(id, code, message) {
90
+ return JSON.stringify({ jsonrpc: "2.0", id, error: { code, message } });
91
+ }
92
+ export function handleMessage(message) {
93
+ if (message.method === "notifications/initialized")
94
+ return null;
95
+ try {
96
+ if (message.method === "initialize") {
97
+ return response(message.id, {
98
+ protocolVersion: "2024-11-05",
99
+ capabilities: { tools: {} },
100
+ serverInfo: { name: "refinery-core", version: "0.0.1" },
101
+ });
102
+ }
103
+ if (message.method === "tools/list") {
104
+ return response(message.id, { tools });
105
+ }
106
+ if (message.method === "tools/call") {
107
+ const params = message.params ?? {};
108
+ const name = params.name;
109
+ const args = params.arguments;
110
+ if (typeof name !== "string")
111
+ throw new Error("tools/call requires tool name");
112
+ if (args !== undefined && (typeof args !== "object" || args === null || Array.isArray(args))) {
113
+ throw new Error("tools/call arguments must be an object");
114
+ }
115
+ return response(message.id, handleToolCall(name, (args ?? {})));
116
+ }
117
+ return errorResponse(message.id, -32601, `Method not found: ${message.method ?? "(missing)"}`);
118
+ }
119
+ catch (e) {
120
+ return errorResponse(message.id, -32000, e.message);
121
+ }
122
+ }
123
+ async function main() {
124
+ process.stdin.setEncoding("utf8");
125
+ let buffer = "";
126
+ for await (const chunk of process.stdin) {
127
+ buffer += chunk;
128
+ let newline = buffer.indexOf("\n");
129
+ while (newline >= 0) {
130
+ const line = buffer.slice(0, newline).trim();
131
+ buffer = buffer.slice(newline + 1);
132
+ if (line) {
133
+ const out = handleMessage(JSON.parse(line));
134
+ if (out)
135
+ process.stdout.write(out + "\n");
136
+ }
137
+ newline = buffer.indexOf("\n");
138
+ }
139
+ }
140
+ }
141
+ if (import.meta.url === `file://${process.argv[1]}`) {
142
+ main().catch((e) => {
143
+ process.stderr.write(`Fatal MCP server error: ${e.stack}\n`);
144
+ process.exit(1);
145
+ });
146
+ }
147
+ //# sourceMappingURL=mcp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp.js","sourceRoot":"","sources":["../src/mcp.ts"],"names":[],"mappings":";AACA,OAAO,EACL,2BAA2B,EAC3B,yBAAyB,EACzB,WAAW,GAEZ,MAAM,6BAA6B,CAAC;AASrC,MAAM,KAAK,GAAG;IACZ;QACE,IAAI,EAAE,2BAA2B;QACjC,WAAW,EAAE,sDAAsD;QACnE,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE,EAAE;YACd,oBAAoB,EAAE,KAAK;SAC5B;KACF;IACD;QACE,IAAI,EAAE,kCAAkC;QACxC,WAAW,EAAE,mFAAmF;QAChG,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,IAAI,EAAE;oBACJ,IAAI,EAAE,QAAQ;oBACd,IAAI,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC;iBACvD;aACF;YACD,QAAQ,EAAE,CAAC,MAAM,CAAC;Y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G,KAAK,UAAU,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;IACpD,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;QACjB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,2BAA4B,CAAW,CAAC,KAAK,IAAI,CAAC,CAAC;QACxE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
package/package.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "@itsshadowai/refinery",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "description": "Refinery — Codex-first memory review CLI.",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/xpriment626/refinery.git"
10
+ },
11
+ "homepage": "https://github.com/xpriment626/refinery#readme",
12
+ "bugs": {
13
+ "url": "https://github.com/xpriment626/refinery/issues"
14
+ },
15
+ "publishConfig": {
16
+ "access": "public"
17
+ },
18
+ "files": [
19
+ "dist",
20
+ "coral",
21
+ "skills",
22
+ "README.md",
23
+ "LICENSE",
24
+ "package.json"
25
+ ],
26
+ "bin": {
27
+ "refinery": "dist/cli.js"
28
+ },
29
+ "scripts": {
30
+ "build": "tsc -p tsconfig.build.json && node scripts/mark-bin-executable.mjs",
31
+ "cli": "node src/cli.ts",
32
+ "mcp": "node src/mcp.ts",
33
+ "coral:worker": "node src/coral/worker.ts",
34
+ "coral:smoke": "node src/coral/smoke.ts",
35
+ "test": "node --test $(find src -name '*.test.ts' -print)",
36
+ "typecheck": "tsc -p tsconfig.json --noEmit"
37
+ },
38
+ "engines": {
39
+ "node": ">=22"
40
+ },
41
+ "dependencies": {
42
+ "@ai-sdk/openai": "^3.0.67",
43
+ "@modelcontextprotocol/sdk": "^1.29.0",
44
+ "zod": "^4.4.3"
45
+ },
46
+ "devDependencies": {
47
+ "@types/node": "^26.0.1",
48
+ "typescript": "^6.0.3"
49
+ }
50
+ }