@prodero/curator 0.0.0-stage → 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 (137) hide show
  1. package/ARCHITECTURE.md +298 -0
  2. package/CHANGELOG.md +16 -0
  3. package/CONTRIBUTING.md +9 -0
  4. package/LICENSE +21 -0
  5. package/README.md +94 -2
  6. package/SECURITY.md +7 -0
  7. package/bin/prodero +7 -0
  8. package/dist/cli.js +228 -0
  9. package/dist/context-instructions.js +2 -0
  10. package/dist/contracts.js +50 -0
  11. package/dist/conversation-presentation.js +262 -0
  12. package/dist/core/agent-instructions.js +39 -0
  13. package/dist/core/applicability-label.js +11 -0
  14. package/dist/core/applicability.js +143 -0
  15. package/dist/core/bootstrap.js +129 -0
  16. package/dist/core/consolidation.js +315 -0
  17. package/dist/core/constants.js +21 -0
  18. package/dist/core/context-allocation.js +54 -0
  19. package/dist/core/context-snapshot.js +12 -0
  20. package/dist/core/context.js +489 -0
  21. package/dist/core/curation-clauses.js +68 -0
  22. package/dist/core/curation-evidence.js +98 -0
  23. package/dist/core/curation-graphical.js +105 -0
  24. package/dist/core/curation-review-presentation.js +4 -0
  25. package/dist/core/curation-review-state.js +62 -0
  26. package/dist/core/curation-review.js +573 -0
  27. package/dist/core/curation-revision.js +106 -0
  28. package/dist/core/curation-semantic-contract.js +239 -0
  29. package/dist/core/curation-semantic-jobs.js +280 -0
  30. package/dist/core/diagnostics.js +17 -0
  31. package/dist/core/format.js +114 -0
  32. package/dist/core/ids.js +6 -0
  33. package/dist/core/imports.js +169 -0
  34. package/dist/core/index.js +93 -0
  35. package/dist/core/instruction-review.js +86 -0
  36. package/dist/core/integrity-files.js +174 -0
  37. package/dist/core/intelligence.js +95 -0
  38. package/dist/core/knowledge-analysis.js +46 -0
  39. package/dist/core/knowledge-authority.js +143 -0
  40. package/dist/core/knowledge-curation.js +316 -0
  41. package/dist/core/knowledge-engine.js +475 -0
  42. package/dist/core/knowledge-graph.js +191 -0
  43. package/dist/core/knowledge-lifecycle.js +212 -0
  44. package/dist/core/knowledge-management.js +113 -0
  45. package/dist/core/knowledge-migration.js +84 -0
  46. package/dist/core/knowledge-policy.js +38 -0
  47. package/dist/core/knowledge-provenance.js +90 -0
  48. package/dist/core/knowledge-write-policy.js +85 -0
  49. package/dist/core/language.js +14 -0
  50. package/dist/core/matching.js +6 -0
  51. package/dist/core/memory-index.js +239 -0
  52. package/dist/core/memory-intelligence.js +288 -0
  53. package/dist/core/memory-link-repair.js +66 -0
  54. package/dist/core/memory-operations.js +122 -0
  55. package/dist/core/memory-pressure.js +212 -0
  56. package/dist/core/memory-sync-curator.js +62 -0
  57. package/dist/core/memory-sync.js +463 -0
  58. package/dist/core/memory-transformation-bundle.js +163 -0
  59. package/dist/core/memory-transformation-proposal.js +135 -0
  60. package/dist/core/memory-transformation.js +108 -0
  61. package/dist/core/memory.js +186 -0
  62. package/dist/core/migrations.js +569 -0
  63. package/dist/core/path-scope.js +27 -0
  64. package/dist/core/plugin-files.js +116 -0
  65. package/dist/core/project-root.js +39 -0
  66. package/dist/core/project.js +634 -0
  67. package/dist/core/promotion.js +279 -0
  68. package/dist/core/reconciliation.js +61 -0
  69. package/dist/core/secrets.js +67 -0
  70. package/dist/core/semantic-safety.js +33 -0
  71. package/dist/core/session-index.js +112 -0
  72. package/dist/core/session-review.js +150 -0
  73. package/dist/core/sessions.js +289 -0
  74. package/dist/core/settings.js +76 -0
  75. package/dist/core/skill-curation.js +239 -0
  76. package/dist/core/skill-polish.js +41 -0
  77. package/dist/core/skills.js +368 -0
  78. package/dist/core/storage.js +408 -0
  79. package/dist/core/sync-transaction.js +254 -0
  80. package/dist/core/telemetry.js +64 -0
  81. package/dist/core/templates.js +53 -0
  82. package/dist/core/types.js +2 -0
  83. package/dist/core/update.js +320 -0
  84. package/dist/curation-review-adapter.js +92 -0
  85. package/dist/diagnostic-boundary.js +54 -0
  86. package/dist/filesystem/permissions.js +39 -0
  87. package/dist/hosts/adapters.js +119 -0
  88. package/dist/hosts/files.js +133 -0
  89. package/dist/hosts/manager.js +150 -0
  90. package/dist/hosts/public-entry.js +47 -0
  91. package/dist/hosts/runtime-command.js +66 -0
  92. package/dist/hosts/runtime.js +139 -0
  93. package/dist/hosts/wizard.js +114 -0
  94. package/dist/knowledge-table.js +38 -0
  95. package/dist/mcp-development.js +69 -0
  96. package/dist/mcp-workspace.js +141 -0
  97. package/dist/memory-presentation.js +172 -0
  98. package/dist/plugins/api.js +2 -0
  99. package/dist/plugins/context.js +20 -0
  100. package/dist/plugins/mcp.js +72 -0
  101. package/dist/plugins/registry.js +106 -0
  102. package/dist/presentation-cards.js +32 -0
  103. package/dist/presentation-server.js +79 -0
  104. package/dist/presentation-trace.js +174 -0
  105. package/dist/presentation.js +412 -0
  106. package/dist/providers/mcp-sampling.js +45 -0
  107. package/dist/server.js +656 -0
  108. package/dist/settings-definition.js +22 -0
  109. package/dist/skill-instructions.js +2 -0
  110. package/dist-ui/index.html +214 -0
  111. package/docs/APPLICABILITY.md +151 -0
  112. package/docs/COMPATIBILITY.md +49 -0
  113. package/docs/CONTEXT-SELECTION-V2.md +61 -0
  114. package/docs/CURATION-APP-REVIEW.md +156 -0
  115. package/docs/CURATION-CLAUSE-REFINEMENT.md +45 -0
  116. package/docs/IMPORTER-CURATION.md +142 -0
  117. package/docs/KNOWLEDGE-AUTHORITY.md +165 -0
  118. package/docs/KNOWLEDGE-SCHEMA-V2.md +150 -0
  119. package/docs/MIGRATIONS.md +99 -0
  120. package/docs/PRIVACY.md +28 -0
  121. package/docs/RECOVERY.md +56 -0
  122. package/docs/RELEASING.md +40 -0
  123. package/docs/hosts.md +134 -0
  124. package/docs/plugins.md +83 -0
  125. package/docs/ui-themes.md +43 -0
  126. package/instructions/AGENTS.md +33 -0
  127. package/package.json +88 -4
  128. package/plugins/migrate_ai_studio/README.md +101 -0
  129. package/plugins/migrate_ai_studio/index.cjs +396 -0
  130. package/plugins/migrate_ai_studio/instructions/audit.md +25 -0
  131. package/plugins/migrate_ai_studio/instructions/classify.md +41 -0
  132. package/plugins/migrate_ai_studio/instructions/migrate.md +34 -0
  133. package/plugins/migrate_ai_studio/instructions/verify.md +20 -0
  134. package/plugins/migrate_ai_studio/plugin.json +11 -0
  135. package/plugins/migrate_ai_studio/schema.cjs +20 -0
  136. package/plugins/migrate_ai_studio/ui/dist/index.html +77 -0
  137. package/prodero.release.json +5 -0
@@ -0,0 +1,298 @@
1
+ # Prodero Architecture
2
+
3
+ ## Primary experience
4
+
5
+ Users interact with Prodero primarily through their coding agent.
6
+
7
+ ```text
8
+ User
9
+ ↓ natural language or App action
10
+ Coding Agent
11
+ ↓ MCP
12
+ Prodero MCP Server
13
+ ↓
14
+ Prodero Core
15
+ ↓
16
+ .prodero/
17
+ ```
18
+
19
+ MCP is both the agent-native API and the primary UI boundary. The MCP App is an inline project-intelligence surface, not a separate web dashboard.
20
+
21
+ ## One Core, multiple adapters
22
+
23
+ ```text
24
+ Prodero Core
25
+ │
26
+ ┌────────────┼────────────┐
27
+ │ │ │
28
+ MCP CLI Tests
29
+ │
30
+ primary UX
31
+ ```
32
+
33
+ `src/core/` owns project behavior. `src/server.ts` and `src/cli.ts` translate transport inputs and outputs only. UI actions call names from `src/contracts.ts`; MCP handlers invoke Core functions directly and never shell out to CLI commands.
34
+
35
+ Context budgeting remains centralized in `src/core/context.ts`. It selects applicable Required first, then strongly matching Skills, Relevant knowledge and any remaining matching Skills. The configurable total budget and internal safety caps bound delivery. The main item limit never counts required instructions. Required-budget overflow is explicit in warnings, Attention, and the prepared-context snapshot rather than being hidden as ordinary saturation. Current snake-case configuration keys coexist with legacy camel-case keys at the project adapter boundary.
36
+
37
+ The CLI remains a bootstrap, development/debugging, CI/automation, and graceful-degradation adapter.
38
+
39
+ ## MCP discovery and App lifecycle
40
+
41
+ `prodero_open` is associated with `ui://prodero/status.html`. It awaits the existing
42
+ Core detailed status and bounded Bootstrap Context without starting a session.
43
+ Agent lifecycle tools (`prodero_prepare` and `prodero_session_close`) use
44
+ `ui://prodero/lifecycle.html`. Both resources serve the same single-file bundle;
45
+ `action` and `uiState` choose the final view.
46
+
47
+ The presentation boundary is:
48
+
49
+ ```text
50
+ resolve the selected root and presentation settings
51
+ → await Core state (config/init, caches/indexes, counts, context as applicable)
52
+ → buildViewModel
53
+ → return one completed tool result
54
+ → App toolresult handler renders once
55
+ ```
56
+
57
+ `completeStatus` in `src/server.ts` delegates to `getDetailedProjectStatus`; it is
58
+ shared by open and the explicit detailed-status endpoint. No second collector was
59
+ introduced. The presentation adapter pins the resolved root for its handler and
60
+ builds the ViewModel only after that handler completes. UI and text open consume
61
+ identical completed state (`phase: ready`, `hydrationRequired: false`). A failed
62
+ required state read is an error, not a successful partial snapshot or onboarding.
63
+
64
+ `prodero_status` remains a tiny, side-effect-free identity/status query with no App
65
+ resource. It does not enumerate knowledge/sessions, migrate, rebuild caches, or use
66
+ the network, in either UI preference or text mode. Its legacy `phase: initial`
67
+ means summary-only, not a promise of later hydration: `hydrationRequired` is false
68
+ and the text ViewModel explicitly says detailed statistics were not requested.
69
+ `prodero_status_details` remains an explicit data-only endpoint. User navigation
70
+ back to Status awaits this endpoint before adopting and rendering its full result.
71
+
72
+ The App does not render project content at startup, infer uninitialized from null
73
+ state, hydrate automatically, or check releases in the background. Release status
74
+ starts as `not-checked` and is an optional user action. The prior paint-scheduled
75
+ hydration path and text-only fallback collector have been removed. User actions
76
+ can still update their existing App; initial tool delivery makes no follow-up RPC.
77
+
78
+ Prepare already awaited Sync, the shared Context Engine and complete project
79
+ statistics before returning Context Ready/Attention. That sequencing is retained;
80
+ removing the App's pre-toolresult render also fixes the false initial screen for
81
+ prepare. The Context Engine remains independent of session lifecycle.
82
+
83
+ Initialization and sync actions call the same MCP tools available to agents without Apps. Their structured results include fresh status so the existing UI refreshes in place after each mutation.
84
+
85
+ For source-local development, `scripts/mcp-dev.ts` builds the App with stdout suppressed, then starts the TypeScript MCP server over stdio. Suppression is a protocol requirement: stdout belongs exclusively to MCP messages.
86
+
87
+ ## Progressive context and fallback order
88
+
89
+ ```text
90
+ MCP tools/resources
91
+ ↓ if unavailable
92
+ Prodero CLI
93
+ ↓ final fallback
94
+ .prodero/index.md and linked files
95
+ ```
96
+
97
+ Agents begin with the compact index, apply required global knowledge, and load only task-relevant knowledge and skills. They do not recursively load `.prodero/`.
98
+
99
+ ## Memory lifecycle
100
+
101
+ ```text
102
+ prepare → context + explicit agent-held session ID
103
+ ↓
104
+ session_record (batched) → sessions/<sortable-unique-id>.md
105
+ ↓
106
+ session_close → deterministic learning; next prepare → pending recovery
107
+ ↓
108
+ local/memory/mem_<sortable-unique-id>.md
109
+ ↓ deterministic router + lexical resolver
110
+ index.md / compact task context
111
+ ↓
112
+ next agent session
113
+ ```
114
+
115
+ `src/core/sessions.ts` validates state transitions and atomically serializes structured MCP observations into readable Markdown. Each observation gets a stable `obs_...` ID; canonical provenance is `source session + observation ID`. Different agents use different session files, with no mutable registry. Recording into a closed session fails; repeated close without new entries is idempotent.
116
+
117
+ `consolidation.ts` converts structured observations into candidates behind a deterministic consolidator boundary. `memory.ts` owns atomic canonical records. `index.ts` generates a concise derived router, while `context.ts` returns required global knowledge and a bounded keyword-matched contextual set.
118
+
119
+ Deterministic Sync compares ordered, whitespace-normalized content within the same scope/category boundary for exact duplicates. Retrieval bag-of-words keys are never equality keys. Only an identical complete-sentence prefix with compatible protected constraints may be extended without intelligence; lexical overlap alone remains separate. Repeated complete sentences are removed without dropping provenance. Explicit `supersedes` metadata is required for replacement; incompatible decision-like records sharing an explicit title/topic become `disputed`. No source session or historical memory is deleted.
120
+
121
+ Each checkpoint is immutable and references its prior checkpoint, exact processed session snapshots, created/updated/superseded/duplicate/conflict memory IDs, and a summary. Synchronization state is therefore derived without a mutable global cursor.
122
+
123
+ ## Incremental complexity invariant
124
+
125
+ > Sync cost should primarily scale with new or changed unsynchronized knowledge, not total project history.
126
+
127
+ `session-index.ts` maintains an ignored, rebuildable cache of checkpoint-derived processed hashes and session filesystem stamps. Checkpoints remain authoritative. On a warm path, unchanged synchronized session bodies are not reread; only new/changed pending bodies are parsed and passed to consolidation. A missing or invalid cache is rebuilt locally from checkpoints and Markdown without changing correctness.
128
+
129
+ `memory-index.ts` stores ignored, rebuildable canonical summaries and token signals. For every new candidate it selects at most 24 potentially related items using scope, `scope_ref`, category, explicit relationships, normalized title/content, and token overlap. Only those bodies are loaded for deeper consolidation. This same boundary can later contain an LLM consolidator without placing all canonical memory into one model context.
130
+
131
+ `ensureDerivedStateRoot()` centralizes creation of `.prodero/.cache/` without creating or changing canonical knowledge. Memory and session indexes detect missing, incompatible, or invalid derived JSON, remove only that disposable file, rebuild from canonical state, and atomically replace it from a same-directory temporary file. Individual indexes remain lazy. Cache payloads contain relative filenames and content-derived metadata, never absolute worktree paths. Consequently every Git worktree owns its own ignored derived state, and missing cache is a normal cold-start condition for status, context, prepare, and Sync.
132
+
133
+ ## Local and Versioned Knowledge
134
+
135
+ Knowledge has one Markdown schema and two storage/sharing layers. v0.1 trust model: Local Knowledge is Git-ignored working state, not a security boundary against the connected agent. Versioned Knowledge is Git-shareable project state; the agent may create, promote and maintain it. Review/preview/approval steps are workflow safeguards, not authenticated human authorization; approved=true does not prove human consent. Curator does not commit or push. Users must review repository changes before committing or pushing. `.prodero/local/memory/` is the default target for session consolidation and conversational remember; the whole local area, session files, checkpoints, transactions, and derived caches are ignored by Git. `.prodero/memory/` is Versioned Knowledge and changes only through explicit imports, low-level repository maintenance, or an approved promotion review.
136
+
137
+ `MemoryCatalog` indexes both roots with a derived `layer` and relative path, rejects duplicate stable IDs across layers, and presents one bounded search/graph/context space. The derived `.prodero/index.md` contains Versioned Knowledge routes, a pointer to ignored `local/index.md`, and active skill titles/paths from both layers. It can therefore disclose Local skill metadata. This repository ignores the root index; runtime initialization does not install that exclusion universally. Inspect generated routers before sharing them and keep private ones ignored. Active local supersession metadata shadows an older versioned item during retrieval without mutating the shared file.
138
+
139
+ Promotion is a preview-then-apply workflow (not a Git commit or human-authorization boundary). Recommendations combine recurrence, age, importance, category, relationships, and divergence from current Versioned Knowledge. Preview compares bounded local candidates against current versioned items, optionally reusing the provider-neutral reconciliation interface for semantic judgment, and emits new/merge/supersede/covered/conflict dispositions plus exact source revisions. Core validates the complete preview hash and every revision after the workflow approval flag is supplied, then applies local lifecycle updates and versioned writes in the existing journaled transaction with the checkpoint last. Pulls or concurrent edits therefore invalidate stale reviews instead of overwriting team knowledge.
140
+
141
+ Set `PRODERO_DEBUG_TIMINGS=1` during local MCP development to emit fast response, detailed status, index/cache, telemetry, and update-check timings to stderr. These diagnostics never enter the normal UI and are development observations, not performance guarantees.
142
+
143
+ Filesystem/stat/checkpoint discovery, status counts, pending detection, index routing, and token estimates are deterministic local operations and make no LLM/API call. Context Selection v2 retains the 6,000 estimated-token resolver budget and treats 2,000 tokens as a Required reserve, using the model-neutral `ceil(UTF-8 bytes / 4)` strategy. Applicable Required can borrow total capacity, with independent safety ceilings of 16,000 tokens / 128 records. Relevant uses a soft target of 8, deterministic marginal-value continuation and a 128-record safety ceiling. Strongly matching Skills receive capacity before Relevant, retaining 4 / 1,500 limits. Undelivered Required produces blocking `required-incomplete`; Open/Bootstrap and the derived router retain their compact limits. See [Context Selection v2](docs/CONTEXT-SELECTION-V2.md). Counts are explicitly estimated; these are Prodero-supplied task-context limits, never the model context window.
144
+
145
+ `memory-index.ts` caches per-item token, freshness, and provenance-count signals alongside lexical metadata. Context totals and selectivity sum cached summaries; only bounded selected bodies are loaded. Required globals are deterministically priority-ranked under separate item and token bounds, and omissions retain exact reason/count/token diagnostics. Ordinary Relevant omissions are nonblocking; incomplete Required delivery blocks readiness; only bounded metadata for omitted required items is disclosed. Query retrieval uses deterministic lexical scoring and greedy scope/category diversity. Non-critical active `state` records older than 180 days are retained but demoted and surfaced when selected. Detailed memory health counts stale, disputed, historical, missing-provenance, and oversized items; fast status still touches none of the corpus.
146
+
147
+ Sync telemetry is derived from the same pending candidates already in consolidation. `rawSessionTokens` counts durable observation content in the current batch. `canonicalTokensAdded` counts newly created canonical title + content and newly appended consolidation text, excluding duplicates and unrelated existing knowledge. Compression is `1 - canonical/raw` only when canonical is smaller; larger output is an explicit expansion and zero raw input is unavailable. The result also aliases lifecycle-friendly counts (`sessionsProcessed`, `observationsProcessed`, `knowledgeCreated`, `knowledgeConsolidated`, `knowledgeSuperseded`) while preserving the existing bounded result fields.
148
+
149
+ Prodero-owned metrics and host usage are separate contracts. `ProderoContextMetrics` contains local project/context estimates. Optional `AgentUsageTelemetry` and `AgentUsageAdapter` are an extension boundary for supported future hosts/providers; `agentUsage` is `null` by default, is never inferred, and does not enter canonical memory.
150
+
151
+ `prodero_open` is the startup entry exposed to conversational launchers because MCP hosts do not provide a universal chat-start hook. It reads the existing unified memory catalog, derives `kind: instruction` and `enforcement: required` for compatible instruction records, returns only applicable active or disputed instructions under fixed item/token bounds, and reports deterministic conflicts rather than choosing between them. These instructions become model-visible tool results after the call; they are not system-level instructions. `prodero_prepare` remains the independent work-lifecycle entry: it recovers pending observations (excluding an explicitly reused active session), resolves required instructions and task context even when open was skipped, and creates or explicitly reuses the agent-held active session ID. The ID is invisible to the human and never stored in shared server state. Sync Memory is a separate user-initiated improve/share workflow. CLI `sync` starts or resumes it and may recover pending observations; `sync-sessions` performs only closed-session recovery.
152
+
153
+ The shared Context Engine is `src/core/context.ts::prepareContext`, which resolves
154
+ configuration and delegates to the existing `getContext` retrieval/ranking/budgeting
155
+ pipeline. Session lifecycle depends on it; the engine imports no session lifecycle.
156
+ `prodero_recall` (CLI `recall`) returns its `ContextResult` without initialization,
157
+ migration, synchronization, session creation or any cache writes. Prepare uses the
158
+ same engine after its normal automatic Sync and then associates a work session.
159
+ Purpose is an explicit ranking policy, not another retrieval implementation.
160
+ See [context selection and compatibility](docs/CONTEXT-SELECTION-V2.md).
161
+
162
+ The prepared `ContextResult` is also the MCP App's transparency snapshot. Core attaches the prepared session ID to that same object; it does not copy canonical bodies or persist an authoritative snapshot. Selected knowledge carries per-item token estimates and the exact lexical, title, scope, priority, diversity, and stale signals that contributed to its deterministic rank. Omitted candidates carry bounded summary metadata only, never eagerly loaded bodies. `View context` is a local UI state toggle over the received tool result, so opening it performs no tool call and cannot drift from what the agent received. Missing snapshot identity renders a graceful unavailable state without resolver fallback.
163
+
164
+ Canonical knowledge remains flat under `memory/`; scope, category, priority, and status belong in metadata. The schema is intentionally small:
165
+
166
+ - scope: `global`, `module`, `task`;
167
+ - category: `principle`, `invariant`, `decision`, `constraint`, `lesson`, `state`, `instruction`;
168
+ - priority: `critical`, `important`, `normal`, `contextual`;
169
+ - status: `active`, `superseded`, `deprecated`, `consolidated`, `duplicate`, `disputed`.
170
+
171
+ The deterministic implementation is conservative and remains the default. The optional experimental Knowledge Engine below adds a provider-neutral reasoning boundary through the existing MCP lifecycle.
172
+
173
+ Runtime distribution uses npm. The read-only npm release adapter reports installed/latest versions, availability and an exact manual command; an unavailable registry is never treated as current. `prodero_update` returns instructions and does not modify packages or project integration. Development checkout/manifest staging adapters require explicit development opt-in and are not production self-update.
174
+
175
+ Package upgrades leave project `.prodero` storage in place. Required schema migrations use an ordered registry with durable recovery backups outside disposable cache, canonical validation and transaction-aware writes. State advances only after successful completion. Managed integration changes are restricted to initialization, explicit maintenance or required migrations; ordinary Local activity stays Git-clean. Prodero never commits repository changes.
176
+
177
+ ## Dogfooding and safe experiments
178
+
179
+ The public repository starts with project configuration and empty Versioned store placeholders. Development knowledge and skills remain Local, Git-ignored and absent from the public tree. Runtime state and all `.prodero` data are excluded from the npm artifact.
180
+
181
+ Development scripts and fixtures are excluded from the package. The clean release gate rebuilds tests, packs public resources and validates an isolated production-only installation. See docs/RELEASING.md.
182
+
183
+ ## Scanner boundary
184
+
185
+ Scanning remains a future Core capability shared by MCP and CLI. The current UI may show a disabled roadmap action, but no scan tool or fabricated scan result exists.
186
+
187
+ ## Local-first guarantees
188
+
189
+ Cloud services, accounts, hosted databases, remote MCP, and the App UI are optional. Without the runtime, `AGENTS.md` and the repository's Markdown and structured files remain accessible through ordinary tools and Git.
190
+
191
+
192
+ ## Optional Knowledge Engine (experimental)
193
+
194
+ > LLM reasons; Prodero Core validates and applies.
195
+ >
196
+ > Intelligence processing is bounded by changed knowledge, not total project history.
197
+ >
198
+ > Prodero remains usable in deterministic fallback mode.
199
+
200
+ ```text
201
+ Knowledge ingestion:
202
+ new unsynchronized session observations → DISTILL → evidence-grounded candidate proposals
203
+
204
+ Knowledge integration:
205
+ candidate → local bounded related-memory discovery → RECONCILE
206
+ → whole-plan validation → staged canonical overlay
207
+
208
+ Knowledge integrity:
209
+ affected overlay + bounded neighbors → one AUDIT → validated corrections / Attention
210
+ → atomic writes + checkpoint
211
+ ```
212
+
213
+ The audit sees safely applied changes in an in-memory overlay. Disk changes are deliberately delayed until all reconciliation and audit proposals pass validation. A later invalid action therefore cannot leave earlier actions partially applied. Candidates are not canonical truth.
214
+
215
+ ### Provider and supported development path
216
+
217
+ `src/core/intelligence.ts` defines `IntelligenceProvider` with `distill`, `reconcile`, and `audit`, each accepting a bounded typed input and an abort signal, returning an unknown structured result that Core validates. Providers receive no filesystem/root handle. The only transport adapter is `src/providers/mcp-sampling.ts`: standard MCP `sampling/createMessage`, enabled only when the client advertises `sampling` in negotiated capabilities. It uses basic text sampling, `includeContext: none`, no tools, a bounded output and timeout; the host controls model choice and permissions. JSON is parsed strictly, never extracted from prose or code fences. Sampling does not guarantee JSON output, so unsupported/malformed results safely leave sessions pending.
218
+
219
+ This mechanism is specified by [MCP sampling (2025-11-25)](https://modelcontextprotocol.io/specification/2025-11-25/client/sampling) and documented by [VS Code's MCP guide](https://code.visualstudio.com/api/extension-guides/ai/mcp). The installed SDK uses this supported protocol path. It is not a promise that every coding host supports sampling. [Codex's MCP documentation](https://developers.openai.com/codex/mcp) does not establish portable sampling support; check `prodero_status_details.knowledgeEngine.samplingAvailable` on the actual freshly connected runtime. Current development validates the transport with an SDK sampling client whose model responses are deterministic test doubles; this is not evidence of successful real-model semantic behavior.
220
+
221
+ Configuration remains optional in `.prodero/config.json`:
222
+
223
+ ```json
224
+ "knowledgeEngine": { "mode": "assisted" }
225
+ ```
226
+
227
+ Omission or `mode: deterministic` retains local deterministic behavior. In assisted mode without a negotiated provider, Sync uses conservative deterministic fallback and records `fallbackReason`. No API key is required and no vendor SDK is installed. A provider rejection, timeout, malformed result, unsupported claim or invalid plan does **not** silently fall back: no semantic plan/checkpoint is committed and sessions remain pending for retry. The unchanged lifecycle is `prepare → automatic Sync → context → record → close → next prepare`; Sync Memory remains a separate improve/share workflow, while `sync-sessions` is the low-level closed-session recovery command. Fast Status never calls a provider, reads journals, enumerates corpora or adds hydration work. Capability/mode diagnostics live in Status details and Sync telemetry.
228
+
229
+ ### Phase contracts and safety limits
230
+
231
+ DISTILL accepts only new observation evidence: source `session#observation` identity, session ID, content, original title/category/scope/priority, candidate kind and explicit supersession hints. Prior checkpoint observation hashes exclude previously processed observations even when an open session later changes. Older checkpoints remain readable; they lack observation hashes, so legacy changed sessions can conservatively reprocess old evidence. Unchanged historical session bodies never enter model inputs.
232
+
233
+ The strict result is `{candidates: [...]}`. Each candidate has a batch-local ID, `kind` (`knowledge`, `skill_candidate`, `instruction_candidate`), canonical fields, `sources`, exact evidence excerpts and `supersedes`. All source IDs must belong to the input batch. Every input observation must be represented, even when several sources collapse into one candidate. The provider can compact repeated wording or omit non-durable sentences, but cannot silently drop an entire observation's provenance.
234
+
235
+ This first implementation intentionally limits factual bodies to **extractive complete sentences** from source content. Titles may be composed; factual-body paraphrasing is not enabled. Reconciliation MERGE must preserve all distinct complete source sentences; NO_CHANGE requires extractive coverage, in addition to polarity/direction safeguards. This sacrifices some semantic compression for deterministic grounding. Exact excerpts and constraint guards prevent unsupported factual sentences; they are not a general proof of semantic entailment or an exhaustive contradiction detector in every language. Core also rejects changes in protected negation, direction/order, numeric versions, enablement, permission, timing and modality. The permanent regression tests include caching negation and reversed frontend/backend dependencies.
236
+
237
+ RECONCILE accepts one candidate and only the bounded related canonical bodies chosen by the existing lexical catalog. Its result is `{actions: [action]}` with exactly one action. Actions use `action`, `sources`, nullable `canonical`, a concise `reason`, and an optional backward-compatible `classification`:
238
+
239
+ - CREATE creates an active candidate with Core-generated identity.
240
+ - MERGE integrates two compatible active sources and unions provenance; audit merges retain the other record as historical `consolidated` knowledge.
241
+ - SUPERSEDE requires explicit source supersession hints or grounded complete-replacement proofs (an already recorded supersession edge during audit); old content remains with historical status.
242
+ - CONFLICT preserves incompatible evidence as linked disputed records.
243
+ - NO_CHANGE adds provenance only; audit duplicates retain the other historical record.
244
+ - LINK keeps distinct knowledge and relates it.
245
+ - UNCERTAIN preserves unresolved evidence as active related knowledge; only an explicit `potential_conflict` classification makes it disputed. It never forces compression.
246
+
247
+ Core validates exact schemas, source membership, target IDs within supplied context, state transitions, scope/category and priority authority, evidence excerpts, protected constraints, complete-source retention in merges, and the 2,000 estimated-token canonical body/title limit. Disk IDs are generated by Core, never from provider paths. Canonical symlinks/path traversal are rejected. All underlying session observations remain intact. Optional typed evidence references support future file/test/commit/documentation/user-instruction evidence; only session-observation references are populated now. No scanner is introduced.
248
+
249
+ Skill candidates retain their existing stable observation-derived IDs, candidate status and review lifecycle. Intelligence cannot activate them or turn them into knowledge. Inferred global instruction proposals are retained in checkpoint `instructionCandidates`, with their original session evidence, excluded from required context; there is no automatic promotion; the existing instruction-review tool provides the review workflow. Normal non-candidate observations retain the existing product's explicit scope/priority authority.
250
+
251
+ ### Bounded affected-area audit
252
+
253
+ `AuditInput` is also the future explicit Memory Area Audit extension point, with no scheduler or whole-project sweep. The affected area starts with staged created/changed/historical/conflicted items, then explicit relationships and catalog-selected neighbors. A deterministic policy triggers **one** audit when nontrivial reconciliation merged, superseded, linked, conflicted or was uncertain, or at least three records were touched. Exact duplicates and trivial no-change batches skip it.
254
+
255
+ Audit returns `status: clean | changes_proposed | uncertain`, typed issues (`contradiction`, `duplicate`, `obsolete`, `unsafe_merge`, `fragmentation`, `constraint_loss`, `uncertain`), and corrective actions. Corrections use the same mutation validator and can only reference supplied area IDs; CREATE and historical reactivation are prohibited. Unresolved issues become disputed records. Truncated review is reported as Attention, never whole-project coherence. There is no recursive audit or hidden retry loop. Coherent means only the bounded reviewed area.
256
+
257
+ Centralized hard limits in `INTELLIGENCE_LIMITS`:
258
+
259
+ | Boundary | Maximum |
260
+ |---|---:|
261
+ | Distill input JSON | 4,000 estimated tokens |
262
+ | Observations / candidates per batch | 12 / 12 |
263
+ | Related memories per reconciliation | 12 |
264
+ | Reconcile input JSON | 8,000 estimated tokens |
265
+ | Audit area | 16 items |
266
+ | Audit input JSON including changes/evidence | 12,000 estimated tokens |
267
+ | Output per call | 32,000 UTF-8 bytes |
268
+ | Sampling generation limit | 4,000 host output tokens |
269
+ | Provider timeout | 45 seconds |
270
+
271
+ Input JSON budgets cover content/metadata; the adapter adds a small fixed protocol prompt/schema. Oversized single observations stay pending instead of being cut mid-constraint. Oversized pending sets are batched; memory candidates and audit input are trimmed before provider invocation. A cold local index may scan bodies to rebuild, but those historical bodies are never all transmitted. Computation/model cost scales with changed evidence, not full history.
272
+
273
+ ### Application, recovery and explainability
274
+
275
+ Every Sync holds a per-worktree process lock in `.prodero/.transactions/`. Assisted plans contain before hashes and validated after-images. A durable `pending.json` write-ahead journal survives deletion of disposable `.cache/`; atomic file replacement applies the validated plan and writes its immutable checkpoint **last**. Subsequent Sync/prepare recovers a partially applied journal before doing new reasoning. A diverged before-image stops recovery with an explicit error instead of overwriting concurrent user edits. Stale process locks are reclaimed only when the owner no longer exists. A lock without owner metadata requires inspection. This is recoverable multi-file application, not a filesystem-wide atomic snapshot: readers can see intermediate files during interrupted application until Sync recovers. Journals/locks are local runtime state, self-ignored for Git and not shared between worktrees.
276
+
277
+ Checkpoint records retain concise phase/action/source/target/reason metadata, original canonical before-images for affected existing records, processed observation hashes, review candidates and phase telemetry. No hidden chain-of-thought or full model transcript is persisted. Existing source sessions, provenance, checkpoint chain and indexes remain authoritative; caches remain rebuildable.
278
+
279
+ Telemetry records phase calls, sessions/observations/candidates, input/output estimates, candidate comparisons, action counts, bounded audit size/truncation/issues/corrections and result. Actual provider usage is optional and separate; basic MCP sampling exposes no standardized billing usage, so it is left absent. Session Learned retains product labels and adds only a compact audit result/Attention; it is not an LLM trace viewer.
280
+
281
+
282
+ ### Knowledge reconciliation categories
283
+
284
+ `src/core/reconciliation.ts` owns classification normalization, bounded semantic reconciliation and presentation signals. Session review, assisted Sync and assisted publication previews call the same `reconcileCandidate` path. UI displays the returned severity and review flag; it does not detect conflicts.
285
+
286
+ Reconciliation actions optionally carry `classification`: `state_transition` (an update), `refinement`, `duplicate`, `supporting`, or `potential_conflict`. `unresolved` means evidence needs semantic interpretation, and `independent` means distinct related knowledge. These last two are informational fallback categories, not conflicts. Classification is retained in the existing checkpoint reasoning records; no knowledge schema migration is required.
287
+
288
+ Meaning and storage action are separate. A newer implementation or intentionally adapted test can establish `state_transition` even when old tests passed. Full replacement still requires existing grounded supersession proofs. Partial updates can use LINK and preserve complementary older claims. Refinement can MERGE subject to existing extractive safeguards, or LINK when a safe merge is unavailable. Duplicate/supporting evidence uses NO_CHANGE only when existing content covers it. Only incompatible claims about the same state without evidence establishing the current claim are `potential_conflict` and disputed.
289
+
290
+ Old provider actions without classification remain supported: SUPERSEDE maps to state_transition, MERGE to refinement, NO_CHANGE to supporting (exact equality uses duplicate), CONFLICT to potential_conflict, UNCERTAIN to unresolved, and CREATE/LINK to independent. Existing stored disputed records and their history remain readable; they are not silently reinterpreted or automatically cleared.
291
+
292
+ In deterministic mode or without a sampling provider, explicit supersedes IDs, exact equality and complete source-sentence containment supply limited classifications. Other differences remain unresolved and both records stay active. Titles, token overlap, polarity, numbers and storage timestamps alone never establish a conflict. Users can enable the existing assisted engine for semantic classification; optional review falls back to neutral deterministic signals on provider failure, while Sync retains its fail-without-commit behavior.
293
+
294
+ Only potential_conflict uses warning styling. State transitions say “Knowledge evolution detected — newer evidence updates earlier project state.” Refinements say “Knowledge refined — newer evidence adds detail to earlier knowledge.” Unresolved evidence says “Related evidence will be reconciled during consolidation.” Instruction/skill proposals and invalid observations retain their existing review workflow without being classified as knowledge conflicts.
295
+
296
+ ## Migration Foundation
297
+
298
+ Project structure and canonical knowledge have independent versions under `.prodero/config.json`. The existing Core migration engine owns ordered planning, approval-bound execution, staging, backup integrity, shared locking, rollback and diagnostic history. Open, Prepare, MCP/text and CLI consume that engine. See [Migration Foundation](docs/MIGRATIONS.md) for version transitions and lifecycle boundaries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,16 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0 — Public Preview (unreleased)
4
+
5
+ - Host-scoped package/dev runtime switching with read-only previews, explicit manual-dev migration, format 1 receipt compatibility and transactional rollback.
6
+
7
+ - Persistent Local and Versioned Knowledge with shared lexical and scope-safe graph retrieval.
8
+ - Conversational remember, search, replacement and Local forget; session learning and consolidation.
9
+ - Knowledge Management App: filtering, inspection, revision-checked editing/retirement and reviewed Local promotion. Text fallback for hosts without Apps.
10
+ - Compact context preparation, project skills, plugin integration and existing theme choices.
11
+ - Storage validation, CRLF support, durable migration backups, disposable cache recovery, journaled Sync and cross-process session mutation protection.
12
+ - Local/Versioned Git boundary, conservative lifecycle secret screening and consistent path scopes.
13
+ - npm artifact installation, manual package-manager updates, explicit MCP roots and a clean artifact release gate.
14
+ - Interactive `prodero install` wizard with agent status, install/update selection, confirmation and readable results. Replaces install host arguments and `--all`; recognizes manual Codex `prodero-dev` connections without adding a duplicate server.
15
+
16
+ Preview limitations and actual verification coverage are recorded in docs/COMPATIBILITY.md. This entry does not announce publication.
@@ -0,0 +1,9 @@
1
+ # Contributing and support
2
+
3
+ Use Node 22.14+ within 22.x, npm and Git. Run `npm ci` then `npm test`; tests rebuild the server and Apps before executing. Run `npm run release:gate` for packaging/isolated-install changes. Keep fixes small and include a regression test for changed persistence or tool contracts.
4
+
5
+ Preserve canonical `.prodero` data, Local/Versioned boundaries, secret screening and exact preview/review workflow safeguards and user review of repository changes before commit/push. Do not commit local sessions, caches, checkpoints, credentials or private project knowledge. Tests should use temporary repositories, not your working project's memory.
6
+
7
+ Once the repository is public, use its GitHub Issues for reproducible bugs and feature requests. Include Prodero/Node/OS/host versions, the command or tool, expected/actual behavior and a minimal synthetic reproduction. Redact project data and secrets; do not attach your whole `.prodero` directory. For vulnerabilities follow [SECURITY.md](SECURITY.md) instead.
8
+
9
+ There is no response-time or compatibility SLA during Public Preview. Please discuss broad changes before implementing them. Contributions are under the existing MIT license.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Prodero
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,95 @@
1
- # Temporary Holding Version
1
+ # Prodero Curator
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ **Project memory for AI coding agents, through chat.**
4
+
5
+ Curator keeps useful decisions, conventions and lessons available across coding sessions. Ask your agent to remember something, retrieve relevant context or review what should be shared with your team.
6
+
7
+ **v0.1.0 Public Preview.** Curator runs locally and connects to your coding agent through MCP. The terminal is for installation and maintenance; everyday work happens in conversation.
8
+
9
+ ## Why Curator exists
10
+
11
+ A new coding session often means explaining the same architecture, constraints and past mistakes again. Chat history alone is hard to reuse across tasks and teammates. Curator stores durable project knowledge and selects relevant context for the agent’s next task.
12
+
13
+ ## How it works
14
+
15
+ Tell your agent:
16
+
17
+ > Remember that API tests should use our shared fixtures. Apply this to the `tests/` path.
18
+
19
+ The agent saves Local Knowledge through Curator’s MCP tools. In a later session, ask it to work on API tests: Curator can include that convention when the agent prepares context for the task. You can inspect or edit the saved item at any time.
20
+
21
+ Curator relies on the agent following its runtime instructions to prepare tasks, record useful outcomes and close sessions. It does not watch every conversation or guarantee that every detail will be remembered.
22
+
23
+ ## Install
24
+
25
+ Requires **Node.js 22.14+ in the 22.x line**, npm and Git. See [compatibility](docs/COMPATIBILITY.md) for verified platforms.
26
+
27
+ ```sh
28
+ npm install --global @prodero/curator@0.1.0
29
+ prodero install
30
+ ```
31
+
32
+ The interactive wizard lets you choose a coding agent and review its MCP setup. Installation configures the agent; it does not initialize your projects.
33
+
34
+ ## Open your coding agent
35
+
36
+ Restart the agent, open your repository and type:
37
+
38
+ ```text
39
+ prodero
40
+ ```
41
+
42
+ The agent opens Curator through MCP. In a new project, choose **Initialize Prodero**. Review the generated project files, including the managed `AGENTS.md` instructions and Git-ignore rules.
43
+
44
+ Where the host supports MCP Apps, Curator provides a graphical interface. Otherwise, use text mode: **“Show Prodero as text.”** You do not need to memorize CLI commands.
45
+
46
+ ## Everyday use
47
+
48
+ Ask your connected agent in ordinary language:
49
+
50
+ - “What do we know about our API test setup?”
51
+ - “Remember why we chose this approach.”
52
+ - “Update the saved testing convention to use the new fixture directory.”
53
+ - “Show the knowledge relevant to this bug before we start.”
54
+ - “Review which Local lessons would be useful to share with the team.”
55
+
56
+ Use **Knowledge** to search, inspect and edit saved items. **Sync Memory** lets you choose **Improve memory**, **Share knowledge**, or both, then start the workflow. Eligible Local improvements can apply within that workflow; sharing presents proposed Versioned changes for review. Normal session learning does not require running Sync Memory.
57
+
58
+ ## Main capabilities
59
+
60
+ - **Task context:** bounded selection of relevant knowledge and reusable skills.
61
+ - **Session continuity:** recorded outcomes become Local Knowledge when sessions close; preparation can recover pending observations.
62
+ - **Knowledge management:** search, applicability, sources, relationships and revision-aware editing.
63
+ - **Skills:** reusable procedures, with Local candidates and review workflows for Versioned skills.
64
+ - **Team knowledge:** Git-shareable Markdown that you review alongside repository changes.
65
+
66
+ ## Local and Versioned Knowledge
67
+
68
+ **Local Knowledge** is Git-ignored working state. **Versioned Knowledge** is Git-shareable project state. Curator retrieves both; cloning a repository brings committed Versioned Knowledge, not ignored Local data.
69
+
70
+ Local does **not** mean inaccessible to the connected agent. The agent may create, promote and maintain Versioned Knowledge. Review and approval steps are workflow safeguards, not authenticated human authorization. Curator does not commit or push: review repository changes before sharing them.
71
+
72
+ The generated `.prodero/index.md` can include active **Local skill titles and paths**. It is not automatically ignored in every project. Keep it ignored when those details are private, and review generated files before committing. See [storage and privacy](docs/PRIVACY.md).
73
+
74
+ ## Supported agents and limitations
75
+
76
+ **Codex CLI is verified; Claude Code is experimental.** Claude Code also needs a project `CLAUDE.md` importing `@AGENTS.md`; the installer does not create it. Cursor is detection-only, and there is no Claude Desktop installer.
77
+
78
+ MCP Apps, workspace roots and sampling support vary by host. Text mode supports core workflows, but App-only curation review/apply is unavailable through the text gateway. See the [host/runtime matrix](docs/COMPATIBILITY.md) and [setup guide](docs/hosts.md).
79
+
80
+ ## Privacy and security
81
+
82
+ Knowledge and session history are plaintext project files. Keep secrets out of Curator: credential screening is best-effort, not complete data-loss prevention. Forgetting an item does not securely erase history, backups or Git.
83
+
84
+ Retrieved context reaches your connected agent. Optional assisted operations can send selected content through host sampling to its model; deterministic workflows do not require sampling. Curator requires neither cloud synchronization nor embeddings. See [privacy](docs/PRIVACY.md) and [security reporting](SECURITY.md).
85
+
86
+ ## Documentation and contributing
87
+
88
+ - [Setup, updates and advanced CLI commands](docs/hosts.md) · [Recovery](docs/RECOVERY.md)
89
+ - [Architecture](ARCHITECTURE.md) · [Context selection](docs/CONTEXT-SELECTION-V2.md)
90
+ - [Themes](docs/ui-themes.md) · [Plugins](docs/plugins.md)
91
+ - [Contributing](CONTRIBUTING.md) · [Changelog](CHANGELOG.md) · [Release verification](docs/RELEASING.md)
92
+
93
+ Preview interfaces and schemas may evolve. Back up the whole `.prodero` directory before upgrading; follow the linked maintenance and recovery guidance.
94
+
95
+ Curator is [MIT licensed](LICENSE).
package/SECURITY.md ADDED
@@ -0,0 +1,7 @@
1
+ # Security reporting
2
+
3
+ Do not post credentials, private project memory or exploitable vulnerability details in public issues.
4
+
5
+ For the public repository, use GitHub's **Security → Report a vulnerability** private reporting flow. Enabling and verifying that flow is a mandatory pre-publication step. Until the repository and private reporting are available, no public vulnerability intake channel is established; arrange a private channel with the maintainer before transmitting sensitive details. Do not invent an email address or assume an issue is private.
6
+
7
+ Include affected versions, impact and a minimal synthetic reproduction. There is no guaranteed response time during Public Preview. See docs/PRIVACY.md for plaintext storage, host sampling and the limits of secret screening and forget.
package/bin/prodero ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ // Capture the host launch context before loading either runtime or any build code.
3
+ import { captureLocalStdioContext } from '../dist/mcp-workspace.js';
4
+ const mcp = process.argv.slice(2).some(arg => arg === 'mcp' || arg === '--stdio');
5
+ const context = mcp ? captureLocalStdioContext() : undefined;
6
+ const { main } = await import('../dist/cli.js');
7
+ await main(context);