Skip to content

feat(learning): suggest learning updates from recurring issues - #400

Draft
nshki wants to merge 4 commits into
nshki/feat/hub/reviewer-verified-outcomesfrom
nshki/feat/learning/propose-learning-updates
Draft

nshki wants to merge 4 commits into
nshki/feat/hub/reviewer-verified-outcomesfrom
nshki/feat/learning/propose-learning-updates

Conversation

@nshki

@nshki nshki commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Why

Scores now show when an agent followed a learning and the Build still had a problem. Today someone has to notice that pattern and rewrite the learning by hand. If the same problem keeps coming back, the learning store should suggest better wording, explain why, and let a person decide.

What changes

The learning package gains replica-learning propose-update <memory-id>. For example, agents followed "Keep form labels visible" in two Builds but still put labels beside the fields. The command might suggest "Show a visible label above every form field" and point to the scores that led to it.

The command looks only at scores of the learning's current version, and only those based on a Build's diff or a reviewer's confirmation. Each Build counts once. Copilot is asked only when at least two Builds had the agent follow the learning and still score 1 or 2. Copilot groups the issues, names each group, and drafts new wording. A group becomes a suggestion only when it shows up in more Builds than went well. Runs with too little evidence, or nothing new since the last suggestion, spend nothing.

A person then runs apply-update or dismiss-update. Applying saves the suggested wording, or the person's edit, as the learning's next version, just like edit. A suggestion goes stale when the learning changes or a newer suggestion names the same issue. A dismissed issue comes back only with two new Builds, one of them confirmed by a reviewer.

The store contract, both reference stores, the conformance suite, and the README cover the new suggestion records. Hub doesn't run this yet. That comes in the next PR.

flowchart LR
    S[Scores for current version] --> G{Same problem in 2+ Builds?}
    G -- no --> N[No suggestion, nothing spent]
    G -- yes --> C[Copilot groups issues and drafts wording]
    C --> K{More problem Builds than good ones?}
    K -- no --> N
    K -- yes --> P[Suggestion with its evidence]
    P --> A[apply-update: new version]
    P --> D[dismiss-update]
Loading

Needs design review

  • Only the current version of a learning gets suggestions.
  • Copilot groups issues and drafts the wording. It names each issue, and earlier names are passed back in so it can reuse them.
  • A Build is counted by its commit. Evidence against a suggestion is scores of 3 or 4, also counted by commit.
  • Only scores based on a Build's diff or a reviewer's confirmation count.
  • "Too little evidence" and "up to date" are run results, not stored suggestions.
  • A newer suggestion for the same issue makes older ones stale.
  • Applying edits the learning, then records the decision. These two writes aren't atomic, but retrying with the same operation ID is safe, so applying now requires one.
  • Apply and dismiss on the same suggestion aren't serialized in the package. Hub runs every learning decision under one lock, so they can't overlap there. Other hosts calling the CLI directly could race.
  • "Up to date" is judged by time: any score at or before the newest suggestion for the version counts as seen. This avoids storing every score a run looked at.
  • A dismissed issue comes back only with two Builds first scored after the dismissal, one confirmed by a reviewer.
  • A host should run propose-update only after new scores arrive, because runs where Copilot suggests nothing aren't recorded.

@nshki
nshki added this pull request to stack #367 November 26, 2026 10:08
@nshki
nshki requested an adaptive review from Copilot November 26, 2026 10:08
@nshki
nshki force-pushed the nshki/feat/learning/propose-learning-updates branch from 5d4ee23 to 951f177 Compare November 26, 2026 10:10
Comment thread packages/learning/src/updates.mjs Resolved
Comment thread packages/learning/src/updates.mjs Resolved
@nshki
nshki force-pushed the nshki/feat/learning/propose-learning-updates branch from 951f177 to a022c57 Compare November 26, 2026 10:14
Comment thread packages/learning/src/updates.mjs Resolved
Comment thread packages/learning/src/updates.mjs Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Critical consent-enforcement gaps expose withheld learning content and allow unauthorized model use, while non-atomic application can commit edits from dismissed or stale proposals.

14 open issues
What changed in this PR

Adds a human-reviewed update workflow to the learning package. Recurring problems in scored Builds can prompt Copilot to suggest clearer learning text; Hub integration remains deferred.

Changes:

  • Uses current-version score evidence to group recurring issues and draft new wording.
  • Adds commands to propose, list, apply, and dismiss updates.
  • Extends storage contracts, audit records, migration, deletion, documentation, and tests.
File Description
packages/​learning/​test/​updates.test.mjs Tests evidence thresholds, grouping, and dismissal suppression.
packages/​learning/​test/​fixtures/​json-file-provider.mjs Adds update streams to the test provider.
packages/​learning/​src/​validate.mjs Registers the new sealed record kinds.
packages/​learning/​src/​updates.mjs Selects evidence and drafts proposals with Copilot.
packages/​learning/​src/​store.mjs Persists proposals, handles decisions, and extends deletion.
packages/​learning/​src/​scope-migration.mjs Migrates update records and referenced version digests.
packages/​learning/​src/​records.mjs Adds update schema identifiers.
packages/​learning/​src/​provider-contract.mjs Declares proposal and decision streams.
packages/​learning/​src/​cli.mjs Adds propose, list, apply, and dismiss commands.
packages/​learning/​README.md Documents update rules and the command workflow.
packages/​learning/​index.d.mts Defines update records and store method types.
packages/​learning/​contracts/​v1/​update-proposal.schema.json Defines proposed wording, evidence, and provenance.
packages/​learning/​contracts/​v1/​update-decision.schema.json Defines decisions and applied-version requirements.
packages/​learning/​contracts/​v1/​invalid/​update-decision.applied-without-version.json Adds an invalid applied-decision fixture.
packages/​learning/​contracts/​v1/​examples/​update-proposal.example.json Provides a proposal example.
packages/​learning/​contracts/​v1/​examples/​update-decision.example.json Provides an applied-decision example.
packages/​learning/​contracts/​v1/​audit-entry.schema.json Adds update operations and audit subject kinds.
packages/​learning/​conformance/​index.mjs Covers proposal idempotence, application, and staleness.

Review effort: Max (adaptive)

Comment thread packages/learning/src/store.mjs Resolved
Comment thread packages/learning/src/store.mjs Resolved
Comment thread packages/learning/src/store.mjs Resolved
Comment thread packages/learning/src/updates.mjs Resolved
Comment thread packages/learning/src/updates.mjs Resolved
Comment thread packages/learning/src/updates.mjs Resolved
Comment thread packages/learning/src/updates.mjs Resolved
Comment thread packages/learning/src/updates.mjs Resolved
Comment thread packages/learning/test/updates.test.mjs Resolved
nshki and others added 2 commits November 26, 2026 02:33
A suggested wording change and a person's decision on it are separate append-only records, so a decision never rewrites the suggestion.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 25291e01-0146-42cb-ac6d-f5e1dd5c35f5
A suggestion is stored once per issue and evidence, applied through the same edit path people use, and goes stale when the learning or its evidence changes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 25291e01-0146-42cb-ac6d-f5e1dd5c35f5
@nshki
nshki force-pushed the nshki/feat/learning/propose-learning-updates branch from a022c57 to bdd3054 Compare November 26, 2026 10:34
nshki and others added 2 commits November 26, 2026 02:34
Copilot drafts new wording only when the same problem shows up in more checked Builds than went well, so most runs spend nothing.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 25291e01-0146-42cb-ac6d-f5e1dd5c35f5
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 25291e01-0146-42cb-ac6d-f5e1dd5c35f5
@nshki
nshki force-pushed the nshki/feat/learning/propose-learning-updates branch from bdd3054 to 143025c Compare November 26, 2026 10:34
? { earlierIssues: [...known].map(([issueKey, issue]) => ({ issueKey, issue })) }
: {}),
}
const { result: answer, route, usage } = await drafter.draft({
!updateAllowed({ support, successes, dismissedBuilds, content, current: record.content })
)
continue
const stored = await store.proposeUpdate(context, {
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.

3 participants