feat(mentor): promote & consult Learnings (#26)
CI / ci (push) Canceled after 0s

Only the writer's explicit confirmation promotes a Fix Card into a
Learning — one confirm, one entry, never a repetition counter. The
Learning is a plain markdown file under <home>/learnings/<type>s/
carrying the card's teaching fields (pattern, problem, diagnostic
question, the demonstration example) plus promotion provenance; the
instance-bound anchor and mechanical replacement stay on the card.
Every pass consults these files via query_learnings; the Learnings
pane replaces its placeholder. Promote consults the on-disk card as
the truth and rejects symlinked learnings paths before any write
(finish-audit round). Dismiss/decay follows in #27.

Closes #26
This commit is contained in:
AlexKucera committed 2026-10-21 12:13:24 +02:00
1 parent 154bb8a114
commit 0e5c28ad95
18 files changed
+1133 -82

No files matched your search

+33 -15
View File
@@ -114,6 +114,8 @@ private struct CardRow: View {
@Environment(AppGateState.self) private var gate
/// The row's own blocking ask; Apply arms it, the sheet answers it.
@State private var asking = false
/// #26: the promotion ask — Promote arms it, its sheet answers it.
@State private var promoting = false
var body: some View {
let stale = card.anchorStatus == .stale
@@ -131,25 +133,34 @@ private struct CardRow: View {
Text(meta)
.font(.system(size: 11, design: DesignTokens.mono))
.foregroundStyle(stale ? .orange : DesignTokens.muted)
if open {
// The actions this card offers (#25 S3.3): mechanical +
// valid → Apply (opens the blocking ask) and Skip;
if open || card.promotedAt == nil {
// The actions this card offers (#25 S3.3, #26 S4.1):
// mechanical + valid → Apply (the blocking ask) and Skip;
// demonstration → Done and Skip (never Apply, ADR-0006);
// stale anchor → Skip only.
// stale anchor → Skip only. Promote (its own ask) sits
// between the primary action and Skip, and outlives the
// card — closed cards keep it until promoted (#26: the
// Learning is the durable artifact).
HStack(spacing: 8) {
if stale {
SkipButton(card: card)
} else if card.lane == .mechanical {
Button("Apply") { asking = true }
if open, !stale {
if card.lane == .mechanical {
Button("Apply") { asking = true }
.buttonStyle(.bordered)
.controlSize(.small)
} else {
Button("Done") {
gate.posts.doneCard(card, home: gate.museionHome)
}
.buttonStyle(.bordered)
.controlSize(.small)
SkipButton(card: card)
} else {
Button("Done") {
gate.posts.doneCard(card, home: gate.museionHome)
}
.buttonStyle(.bordered)
.controlSize(.small)
}
if card.promotedAt == nil {
Button("Promote") { promoting = true }
.buttonStyle(.bordered)
.controlSize(.small)
}
if open {
SkipButton(card: card)
}
}
@@ -165,11 +176,15 @@ private struct CardRow: View {
.sheet(isPresented: $asking) {
ApplyAskSheet(card: card, posts: gate.posts, home: gate.museionHome)
}
// #26: Promote is its own blocking ask — one confirm, one Learning.
.sheet(isPresented: $promoting) {
PromoteAskSheet(card: card, posts: gate.posts, home: gate.museionHome)
}
}
/// rank · pass · lane · emitter, plus the card's truth markers: the
/// stale anchor, the trust level on appliable mechanical cards (S2.5),
/// and the close status once closed.
/// the close status, and the promotion stamp (#26).
private var meta: String {
var value = "\(card.lane.rawValue) · \(card.emitter.rawValue)"
if let pass = card.provenance?.pass {
@@ -187,6 +202,9 @@ private struct CardRow: View {
if card.status != .open {
value += " · \(card.status.rawValue)"
}
if card.promotedAt != nil {
value += " · promoted"
}
return value
}
}