Skip to content

feat: find_activity — the registry half of find → invoke - #75

Merged
adamstankiewicz merged 11 commits into
mainfrom
feat/find-activity-mvp
Aug 30, 2026
Merged

feat: find_activity — the registry half of find → invoke#75
adamstankiewicz merged 11 commits into
mainfrom
feat/find-activity-mvp

Conversation

@adamstankiewicz

@adamstankiewicz adamstankiewicz commented Aug 30, 2026

Copy link
Copy Markdown
Owner

What & why

One new MCP tool, find_activity, that answers a learning need with ranked activity listings. The novelty: listings are generative — the registry lists capabilities that manufacture a standards-verified activity on demand, not a shelf of files. Each result carries the exact show_widget arguments that build it, so the invoke half already existed and the loop closes with zero new rendering code. Discovery is model-free once the standard resolves: verification hits the graph; ranking is deterministic coverage + keyword scoring. Topic-only calls reuse proposeFor, so "the water cycle" resolves to a verified 5-ESS2-1 the same way show_widget would.

Type of change

  • Contract change (new tool surface third parties will program against)

Breaking or contract changes

Additive only: one new tool beside show_widget; nothing existing changes shape. The listing format converges on src/lib/a2learn/manifest.ts in #79's phase 2 after both merge.

How it was verified

  • pnpm lint and rm -rf .next && npx tsc --noEmit
  • pnpm build
  • Live-verified both paths at creation: standardCode → 11 ranked listings for 3.NF.A.2 (verified); topic-only → proposed and verified 5-ESS2-1
  • Targeted re-review pass (bounded results, graph-verified path, no env/injection flags)

Merge note: touches src/app/api/mcp/route.ts, as does #76 — whichever merges second rebases; both edits are additive (a tool entry + a handler branch), so the conflict is mechanical.

Authorship

  • I understand every line of this diff
  • Agent-assisted or agent-authored: authored by Claude working interactively with @adamstankiewicz
  • No package.json / pnpm-lock.yaml changes

🤖 Generated with Claude Code

@vercel

vercel Bot commented Aug 30, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
interactive-learning-experiences Ready Ready Preview Aug 30, 2026 7:53pm

Request Review

adamstankiewicz and others added 6 commits August 30, 2026 15:27
The a2learn marketplace MVP: one new MCP tool that answers a learning
need with ranked activity listings. The novelty is that listings are
GENERATIVE — the registry lists capabilities that manufacture a
standards-verified activity on demand, not a shelf of files. Each result
is an a2learn manifest (docs/a2learn/manifest.md): the verified standard
it teaches, whether it assesses, and the exact show_widget arguments
that build it — so the invoke half already existed and the loop closes
with zero new rendering code.

Discovery is deliberately model-free once the standard resolves:
verification hits the standards graph, ranking is deterministic
coverage + keyword scoring (crude, and cheap enough that agents will
actually browse before guessing). Topic-only calls reuse buildWidget's
proposeFor (now exported) so 'the water cycle' resolves to a verified
5-ESS2-1 the same way show_widget would.

Live-verified both paths: standardCode → 11 ranked listings for 3.NF.A.2
(verified); topic-only → proposed and verified 5-ESS2-1.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…exist yet

Same rule as everywhere else: no references to the a2learn format docs
until they ship with a producer. The a2learn:0 field stays as the draft
lineage marker; this file is the normative source for the listing shape
until the format lands.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…he format when it ships

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The type is the normative source for the listing shape and crosses the
wire to model consumers — the literal fields (tier, generative,
provenance.generated) encode marketplace and registry doctrine nothing
at the use site explains, so the semantics live on the fields.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…s, deterministic ranking

Runs against the real registry and the keyless example standards source,
so verification is integration-tested offline: known code verifies with
every listing carrying kind + standardCode verbatim; a hallucinated code
lands on rejectedCodes and degrades to standard-agnostic topic listings;
check-flavored needs float assessing kinds; identical calls rank
identically.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
ActivityManifest and FindResult move to src/lib/activities/types.ts —
the wire contract importable without the finder's runtime (which reaches
the model layer through proposeFor). find.ts re-exports, so consumers
are unchanged; the module is type-only by design.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… meaning 'assess'

The ranking comment now states the design honestly: a deterministic
default ordering, not semantics — the calling model holds the real
judgment via the listing metadata. Within that tier, the intent lexicon
is grounded (revised Bloom 'evaluate' verbs + formative/summative
classroom vocabulary), matched on stems so 'assessment' and 'quizzes'
hit, with bare 'grade' deliberately excluded: topics legitimately say
'grade 4', and that boosted assessing kinds spuriously. Tests cover the
stems and pin the grade-level false-positive.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… of word lists

The proper IR answer, in the repo's idiom: need and planner descriptions
compared by cosine over provider embeddings (OpenAI via the armed
fallback key, or Bedrock Titan; Anthropic ships no embeddings endpoint,
so the default deployment falls back to lexical). Assessment intent is
read from anchor phrases by geometry — no keyword lists anywhere on the
semantic path. Registry vectors are memoized per process (the corpus is
sixteen static descriptions); only the need embeds per query.

Honesty is structural: FindResult.ranking says which ranker ran, an
embedding failure degrades to lexical instead of failing discovery, and
the lexical scorer survives only as the stated fallback.

Tested without a network: cosine behavior, similarity ordering, and
anchor-driven intent (a need with zero lexical overlap with any
assessment word still boosts assessing kinds) against a deterministic
toy embedding space; the find suite pins the fallback path and its
honest label.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Functionally verified live through the full production path (OpenRouter →
text-embedding-3-small → cosine over the real registry): time-ordering
needs rank timeline-builder first, categorizing needs rank drag-categorize
first, and the per-process vector cache holds (first call embeds the
corpus, later calls embed only the need). Bedrock embed model id becomes
env-overridable (access is per account); the fallback catch now warns
with the reason — probing found a Bedrock 403 being swallowed silently,
which would downgrade a misconfigured deployment forever without a trace.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
adamstankiewicz and others added 2 commits August 30, 2026 15:48
The manifest is the shape third parties program against, and `gradeBand`
could only ever describe K-12: an undergraduate year or a new-hire cohort
has no honest value to put in it. `audience` carries the naming authority
with the value — `[{ scheme: 'k12-us', values: ['4'] }]` — which is the
shape `standards[]` already uses, so "4" is unambiguous instead of meaning
grade 4 here and year 4 somewhere else.

Behavior change worth reviewing: the caller's free-text `gradeHint` no
longer falls back into the field. "8th grade" is not a `k12-us` value and
nothing verified it, so laundering it into a scheme would make the manifest
assert something no graph said. An absent audience reads as unstated, never
"suitable for anyone" — both rules are now tested, including the negative
control that the hint stays out.

Safe because nothing consumed the old field: find_activity wrote it and
never read it back, and ranking scores plannerDescription and the assess
anchors, not audience. Only the emitting site changes.

`StandardRef.gradeLevels` keeps its name and shape — it is an honest label
for what a K-12 source emits — and gains a comment saying what a non-grade
source does instead (leave it empty, express audience through `tags`),
since `reachesGrade` already lets unlabelled standards through rather than
gating them out on missing data.

No mcp:build: nothing here is reachable from widget components — two
type-only edits and one server-side emitter.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@adamstankiewicz
adamstankiewicz merged commit 28b06a6 into main Aug 30, 2026
3 checks passed
@adamstankiewicz
adamstankiewicz deleted the feat/find-activity-mvp branch August 30, 2026 20:11
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