8000 feat: V0-12 provisional Synthesis with Prompt B by kiran-brahma · Pull Request #32 · kiran-brahma/nodepad-app · GitHub
[go: up one dir, main page]

Skip to content

feat: V0-12 provisional Synthesis with Prompt B - #32

Merged
kiran-brahma merged 2 commits into
mainfrom
claude/github-issue-13-dea294
Jul 23, 2026
Merged

kiran-brahma merged 2 commits into
mainfrom
claude/github-issue-13-dea294

Conversation

@kiran-brahma
Copy link
Copy Markdown
Owner

Closes #13.

Implements the Synthesis engine. Once a Thinking Workspace holds enough organized material, the Enrichment Workflow sends a bounded, diverse Note sample and recent Synthesis history to the approved Prompt B. A valid result waits as a pending Synthesis until the thinker accepts it as a fresh thesis Note or dismisses it. Nothing is ever accepted automatically, and no source Note is mutated on any path.

What is here

src-tauri/src/synthesis.rs — the pure seam, independent of storage: Prompt B byte-for-byte (asserted by a contract test), the response schema, evaluate_eligibility against a caller-supplied clock, five-to-ten candidate selection biased by diversity then recency, the three-block user message, response validation, and the semantic-repeat invariant.

Migration 0009 — pending Syntheses with their source identities and the enrichment revision each source carried, AI provenance, the bounded novelty history, and the per-Workspace attempt checkpoint. No Relationship row is ever written for a provisional result.

workspace.rs — pending Syntheses in the snapshot with staleness derived on every read (a source edited, deleted, or moved to another Workspace); atomic accept (thesis Note + Labels + pending removal + undo entry); dismiss; and a store that refuses a result whose sources moved during inference.

lib.rs — propose_synthesis, accept_synthesis, dismiss_synthesis. Manual Workspaces and unconsented Cloud land on ineligible, never on a provider call.

Frontend — a controller that schedules attempts (durable rules stay in Rust), a panel showing each pending Synthesis beside its sources with Accept and Dismiss, and a dashed provisional mark in the graph that persists nothing.

Decisions worth review

  • "Organized Note" was undefined in the issue. A Note counts as organized when it carries a non-default Note Type or at least one Label, whoever assigned it — so manual classification reaches the threshold exactly as AI organization does.
  • "At least two represented Note Types or Labels" is read as either axis on its own. Five Notes sharing one Note Type and one Label are not diverse and do not qualify.
  • Semantic repeat is enforced deterministically (word-set overlap ≥ 0.8), not by embeddings. A repeat becomes a quiet no_insight, on the same path as found: false.
  • A failed attempt (malformed body, provider failure, stale sources) earns the cooldown but not the checkpoint, so a broken provider is not re-asked on every keystroke and a transient failure does not cost the thinker their next five organized Notes.

Verification

npm run check passes end to end: typecheck, lint, 139 frontend tests, 133 Rust tests, and the Tauri smoke build.

Reviewed on both axes with code-review (standards + spec) and audited with fallow; every actionable finding is addressed in the second commit, and introduced complexity findings are back to zero. The one remaining introduced clone is the eight-line call-and-guard shape shared by the two AI controllers, over two different commands and two different status unions.

🤖 Generated with Claude Code

kiran-brahma and others added 2 commits July 23, 2026 14:04
Implement the Synthesis engine: once a Thinking Workspace has enough
organized material, the Enrichment Workflow sends a bounded, diverse Note
sample and recent Synthesis history to the approved Prompt B, and a valid
result waits as a pending Synthesis until the thinker accepts it as a fresh
thesis Note or dismisses it.

- synthesis.rs holds the pure seam: byte-for-byte Prompt B, the response
  schema, eligibility evaluation against a caller-supplied clock, five-to-ten
  candidate selection, the three-block user message, response validation, and
  the semantic-repeat invariant.
- Migration 0009 stores pending Syntheses with their source identities and
  captured revisions, AI provenance, the bounded novelty history, and the
  per-Workspace attempt checkpoint. No Relationship row is ever written for a
  provisional result.
- A `found: false` attempt is a success: it moves the cooldown and the
  checkpoint and adds no pending content. Accept creates a thesis Note and
  removes the pending item in one transaction; dismiss removes the pending
  content and keeps only the text for novelty. A changed, deleted, or moved
  source Note makes a pending Synthesis stale and unacceptable.
- The UI shows pending Syntheses beside their sources with Accept and Dismiss,
  reports ineligible and no-insight outcomes quietly, and draws a provisional
  mark in the graph without persisting a fake Relationship.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Spec review:
- A failed attempt (malformed body, provider failure, stale sources) now
  records a cooldown-only checkpoint. Previously only `found: false` and
  semantic repeats touched `synthesis_attempts`, so a provider answering with
  nonsense was re-asked after every debounce forever. The cooldown moves; the
  five-new-Notes checkpoint deliberately does not, so a transient failure
  never costs the thinker their next five organized Notes.
- The diversity gate counted Note Types and Labels into one set, so five Notes
  sharing one default Note Type and one Label passed on a total of two. The
  two axes are now counted separately: "at least two represented Note Types
  **or** Labels" means either axis on its own, never a sum.
- The novelty history is now bounded in storage, not only on read.

Standards review:
- `extract_json_candidate` is shared with the Note Organization parser rather
  than copied; the attempt upsert and the organized-material counts each have
  one home; `store_pending_synthesis` takes `ParsedSynthesis` and
  `SourceRevision` instead of loose tuples and strings; the Assistance Policy
  travels as its own enum on both sides of the seam.
- Dropped the glossary drift the new prose introduced ("edge", "canvas").
- Removed the unused `attemptNow` / `clear` controller surface, and the
  optional-with-default `pendingSyntheses` prop.
- `useWorkspaceSnapshot` exposes `adoptSnapshot` instead of the App wrapping a
  snapshot in a resolved promise to reuse `submit`.

Fallow (introduced findings only):
- Extracted the shared request-generation guard both AI controllers use.
- The Synthesis controller now owns which Syntheses are pending here, and the
  accept and dismiss commands, so the App composes rather than coordinates.
- One `assistanceEnabled` predicate replaces three copies of the policy test.
- Simplified `statusMessage` from a seven-arm switch to a lookup.
Introduced complexity findings are back to zero. The remaining eight-line
clone between the two controllers is the call-and-guard shape around two
different commands with two different status unions; collapsing it further
would be an abstraction neither controller needs.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@kiran-brahma
kiran-brahma merged commit 822db41 into main Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

V0-12: Implement provisional Synthesis with Prompt B

1 participant

0