Skip to content

feat: promotion candidate detector and pk candidates list|accept|reject - #36

Merged
GQAdonis merged 2 commits into
mainfrom
feat/promotion-candidates
Oct 4, 2026
Merged

GQAdonis merged 2 commits into
mainfrom
feat/promotion-candidates

Conversation

@GQAdonis

@GQAdonis GQAdonis commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Change C1a of team-aware-learning-memory-impl. Promotion beyond a project is now auto-proposed and human-confirmed (skill-system design §3).

  • Worker detector: pk-learning-worker/src/promotion.rs runs after the job loop in run-once.
    • It fingerprints lessons as word-trigram shingles into ~/.prometheus/learning-index/lessons.jsonl, with project and source evidence.
    • It proposes a candidate when a lesson recurs (Jaccard ≥ 0.6) across ≥ 2 projects, is tagged global without a [GLOBAL]/[USER] marker, or names a dependency or CLI and has no repo-relative path.
    • Candidates are written atomically to ~/.prometheus/promotion-candidates/pending/<id>.json, with an evidence list. Proposal is idempotent, and a candidate already accepted or rejected is never re-proposed.
  • New subcommand pk candidates list|accept|reject --kind promotion|skill (frozen surface: additive):
    • accept upserts the lesson into the shared KB as promoted-<id> and commits the shared prompt snapshot.
    • It then queues a schemaVersion 2 add_memory op in the learning-queue outbox, keyed @global/@global (or @user:<hash>/@user for a user-scoped candidate). payloadHash is the SHA-256 of the arguments.
    • Finally it moves the file to accepted/. reject moves the file to rejected/.
    • For --kind skill, list and reject work. accept exits non-zero with "not yet supported".
  • OpenSpec: openspec/changes/promotion-candidates/. It covers the proposal with its consumers table, the design (including a known race and the noise trade-off), the spec, and the tasks.
  • No dependency change. Cargo.lock is unchanged.

Commits

  • ec23551 RED: the OpenSpec change and both integration tests. They were not executed at that commit, because the repository's implementation-first policy defers test runs.
  • d7905e4 GREEN: the implementation, plus rustfmt applied to the test file.

Test plan (local, serialized Cargo)

  • verify.sh runs cargo test -p pk-learning-worker --test promotion (1 passed) and cargo test -p pk-cli --test candidates (2 passed): verify OK.
  • cargo test --locked -p pk-cli --test context --test context_scoring --test tags_and_type: 3 + 3 + 1 passed.
  • cargo test --locked -p pk-learning-worker --test attribution --test worker: 2 + 5 passed.
  • cargo clippy --locked -p pk-learning-worker --bins --test promotion --test attribution --test worker -- -D warnings: clean.
  • cargo clippy --locked -p pk-cli --all-targets -- -D warnings -A clippy::too_many_arguments: clean.
  • Verifier gate: cargo fmt --all -- --check, cargo clippy --workspace --all-targets --locked -- -D warnings, cargo test --workspace --locked. Two failures already exist on origin/main, and the gate will hit them:
  • Downstream handoff note for prometheus-skill-system: the pk pin, docs/guide/13-tools-reference.md, and kbd-open.sh/reflector surfacing of pending candidates.

Review status: builder-context only, not independent.

🤖 Generated with Claude Code

GQAdonis and others added 2 commits October 4, 2026 07:58
OpenSpec change openspec/changes/promotion-candidates and the two
integration tests, committed before the implementation per the team's
RED/GREEN rule. Without the implementation the worker writes no
candidates and pk has no candidates subcommand, so both tests fail.
They were not executed at this commit (implementation-first policy).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ct (GREEN)

pk-learning-worker: after draining jobs, run-once fingerprints lessons
(word-trigram shingles) into ~/.prometheus/learning-index/lessons.jsonl
and proposes candidates under ~/.prometheus/promotion-candidates/pending
when a lesson recurs (Jaccard >= 0.6) across >= 2 projects, is tagged
global without a marker, or names a dependency/CLI with no repo-relative
path. Writes are atomic and idempotent; decided candidates are never
re-proposed.

pk-cli: new 'pk candidates list|accept|reject --kind promotion|skill'.
accept upserts into the shared KB, commits the shared prompt snapshot,
queues a schemaVersion 2 add_memory op for @global (or @user:<hash>) in
the learning-queue outbox, and moves the file to accepted/. Skill accept
is refused until skill promotion lands.

OpenSpec: openspec/changes/promotion-candidates. No dependency or
Cargo.lock change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@GQAdonis
GQAdonis merged commit c2ebc7f into main Oct 4, 2026
0 of 3 checks passed
@GQAdonis GQAdonis mentioned this pull request Oct 4, 2026
3 tasks done
@GQAdonis
GQAdonis deleted the feat/promotion-candidates branch October 11, 2026 14:30
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.

1 participant