feat: API catalog surface, protocol v2 tooling, MCP expansion, on+re update
## Summary
Session 2026-03-23. Closes the loop between handler code and discoverability
across all three surfaces (browser, CLI, MCP agent) via compile-time inventory
registration. Adds protocol v2 update tooling, extends MCP from 21 to 29 tools,
and brings the self-description up to date.
## API Catalog Surface (#[onto_api] proc-macro)
- crates/ontoref-derive: new proc-macro crate; `#[onto_api(method, path,
description, auth, actors, params, tags)]` emits `inventory::submit!(ApiRouteEntry{...})`
at link time
- crates/ontoref-daemon/src/api_catalog.rs: `catalog()` — pure fn over
`inventory::iter::<ApiRouteEntry>()`, zero runtime allocation
- GET /api/catalog: returns full annotated HTTP surface as JSON
- templates/pages/api_catalog.html: new page with client-side filtering by
method, auth, path/description; detail panel per route (params table,
feature flag); linked from dashboard card and nav
- UI nav: "API" link (</> icon) added to mobile dropdown and desktop bar
- inventory = "0.3" added to workspace.dependencies (MIT, zero transitive deps)
## Protocol Update Mode
- reflection/modes/update_ontoref.ncl: 9-step DAG (5 detect parallel, 2 update
idempotent, 2 validate, 1 report) — brings any project from protocol v1 to v2
by adding manifest.ncl and connections.ncl if absent, scanning ADRs for
deprecated check_hint, validating with nickel export
- reflection/templates/update-ontology-prompt.md: 8-phase reusable prompt for
agent-driven ontology enrichment (infrastructure → audit → core.ncl →
state.ncl → manifest.ncl → connections.ncl → ADR migration → validation)
## CLI — describe group extensions
- reflection/bin/ontoref.nu: `describe diff [--fmt] [--file]` and
`describe api [--actor] [--tag] [--auth] [--fmt]` registered as canonical
subcommands with log-action; aliases `df` and `da` added; QUICK REFERENCE
and ALIASES sections updated
## MCP — two new tools (21 → 29 total)
- ontoref_api_catalog: filters catalog() output by actor/tag/auth; returns
{ routes, total } — no HTTP roundtrip, calls inventory directly
- ontoref_file_versions: reads ProjectContext.file_versions DashMap per slug;
returns BTreeMap<filename, u64> reload counters
- insert_mcp_ctx: audited and updated from 15 to 28 entries in 6 groups
- HelpTool JSON: 8 new entries (validate_adrs, validate, impact, guides,
bookmark_list, bookmark_add, api_catalog, file_versions)
- ServerHandler::get_info instructions updated to mention new tools
## Web UI — dashboard additions
- Dashboard: "API Catalog" card (9th); "Ontology File Versions" section showing
per-file reload counters from file_versions DashMap
- dashboard_mp: builds BTreeMap<String, u64> from ctx.file_versions and injects
into Tera context
## on+re update
- .ontology/core.ncl: describe-query-layer and adopt-ontoref-tooling descriptions
updated; ontoref-daemon updated ("11 pages", "29 tools", API catalog,
per-file versioning, #[onto_api]); new node api-catalog-surface (Yang/Practice)
with 3 edges; artifact_paths extended across 3 nodes
- .ontology/state.ncl: protocol-maturity blocker updated (protocol v2 complete);
self-description-coverage catalyst updated with session 2026-03-23 additions
- ADR-007: "API Surface Discoverability via #[onto_api] Proc-Macro" — Accepted
## Documentation
- README.md: crates table updated (11 pages, 29 MCP tools, ontoref-derive row);
MCP representative table expanded; API Catalog, Semantic Diff, Per-File
Versioning paragraphs added; update_ontoref onboarding section added
- CHANGELOG.md: [Unreleased] section with 4 change groups
- assets/web/src/index.html: tool counts 19→29 (EN+ES), page counts 12→11
(EN+ES), daemon description paragraph updated with API catalog + #[onto_api]
88 lines
3.9 KiB
Plaintext
88 lines
3.9 KiB
Plaintext
let d = import "../defaults.ncl" in
|
|
let ncl_export = import "../templates/step-nickel-export.ncl" in
|
|
|
|
d.make_mode String {
|
|
id = "coder-workflow",
|
|
trigger = "Manage .coder/ process memory — initialize authors, record structured entries, triage markdown, publish and graduate knowledge",
|
|
|
|
preconditions = [
|
|
"ONTOREF_PROJECT_ROOT is set",
|
|
"reflection/modules/coder.nu is accessible via ONTOREF_ROOT",
|
|
"Nushell >= 0.110.0 is available",
|
|
],
|
|
|
|
steps = [
|
|
{
|
|
id = "init-author",
|
|
action = "Initialize an author workspace with inbox/ and author.ncl. Each human, agent, or CI actor gets their own workspace.",
|
|
cmd = "./ontoref coder init <author> --actor Human|AgentClaude|AgentCustom|CI",
|
|
actor = 'Both,
|
|
on_error = { strategy = 'Stop },
|
|
},
|
|
{
|
|
id = "record-json",
|
|
action = "Write a structured JSON entry to entries.jsonl. Use for insights, summaries, completed features, decisions. Entries are immediately queryable via coder log.",
|
|
cmd = "./ontoref coder record <author> '<content>' --title '<title>' --kind info --category insights --tags '[tag1,tag2]' --relates_to '[nodo-id]' --trigger '<why>' --domain Architecture",
|
|
actor = 'Both,
|
|
depends_on = [{ step = "init-author" }],
|
|
on_error = { strategy = 'Continue },
|
|
},
|
|
{
|
|
id = "dump-markdown",
|
|
action = "Copy or paste markdown files into .coder/<author>/inbox/. Zero ceremony — just dump. Files are named YYYY-MM-DD-description.{kind}.md where kind is done|plan|info|review|audit|commit.",
|
|
actor = 'Human,
|
|
depends_on = [{ step = "init-author" }],
|
|
on_error = { strategy = 'Continue },
|
|
},
|
|
{
|
|
id = "triage",
|
|
action = "Classify inbox/ files into categories (insights, features, bugfixes, investigations, decisions, reviews, resources). Generates companion NCL with validated metadata. Use --interactive for manual review.",
|
|
cmd = "./ontoref coder triage <author> --interactive",
|
|
actor = 'Both,
|
|
depends_on = [{ step = "dump-markdown" }],
|
|
on_error = { strategy = 'Continue },
|
|
},
|
|
{
|
|
id = "query",
|
|
action = "Query JSONL entries across authors and categories. Filter by tag, kind, domain, or author. Export as JSON, JSONL, or CSV for external tools.",
|
|
cmd = "./ontoref coder log --author <author> --tag <tag> --domain <domain>",
|
|
actor = 'Both,
|
|
depends_on = [{ step = "record-json" }],
|
|
on_error = { strategy = 'Continue },
|
|
},
|
|
{
|
|
id = "publish",
|
|
action = "Promote entries from an author workspace to .coder/general/<category>/. Files are prefixed with author name for attribution.",
|
|
cmd = "./ontoref coder publish <author> <category>",
|
|
actor = 'Human,
|
|
depends_on = [{ step = "triage" }],
|
|
on_error = { strategy = 'Continue },
|
|
},
|
|
{
|
|
id = "graduate",
|
|
action = "Copy graduated entries from .coder/ to a committed path (reflection/knowledge/). Only categories marked graduable=true in context.ncl are eligible.",
|
|
cmd = "./ontoref coder graduate general/insights --target reflection/knowledge",
|
|
actor = 'Human,
|
|
depends_on = [{ step = "publish" }],
|
|
on_error = { strategy = 'Stop },
|
|
},
|
|
ncl_export {
|
|
id = "validate-ontology-core",
|
|
action = "After creating new systems or schemas, register them in .ontology/core.ncl with artifact_paths. Validate core.ncl exports without contract errors.",
|
|
file = ".ontology/core.ncl",
|
|
},
|
|
ncl_export {
|
|
id = "validate-ontology-state",
|
|
action = "Update state.ncl if maturity changed. Validate state.ncl exports without contract errors.",
|
|
file = ".ontology/state.ncl",
|
|
depends_on = [{ step = "validate-ontology-core" }],
|
|
},
|
|
],
|
|
|
|
postconditions = [
|
|
"coder authors lists all active author workspaces",
|
|
"coder log returns queryable structured entries",
|
|
"New systems have nodes in .ontology/core.ncl with artifact_paths",
|
|
],
|
|
}
|