Write an adapter
Third parties can plug a context framework into ProAgents without modifying the core questioning engine. This is the ecosystem contract.
Minimum viable adapter
js
// my-framework.mjs
export default class MyFramework {
name = "my-framework";
version = "1.0.0";
capabilities = ["search", "context"];
description = "retrieval over my team's runbooks";
async discover(roots) {
// Called once per session. Index whatever you need here.
this.root = roots[0];
}
async retrieve(query) {
// query: { task, scopes?, maxBytes?, depth? }
return {
framework: this.name,
snippets: [
{
path: "runbooks/incidents.md",
text: "...the relevant excerpt...",
reason: "matched: incident, escalation",
confidence: 0.8, // your honest score
stale: false, // can you tell? say so
provenance: ["my-framework", "runbooks/incidents.md"],
},
],
truncated: false,
totalBytes: 128,
};
}
}Use it
bash
# local module path
proagent init --intent "..." --context-framework ./my-framework.mjs
# or from a git URL (shallow-cloned to a temp dir)
proagent init --intent "..." --context-framework https://github.com/example/my-frameworkContract rules
- Export shape — default export may be a class or an instance; a named
frameworkexport also works. Anything with aretrieve(query)function is accepted. - Declare capabilities honestly —
proagent context frameworksreports them; the engine and skill generation adapt to what is actually available. - Metadata is not optional decoration —
confidence,staleandprovenanceare how the system treats your output as derived knowledge. Fill them truthfully. - Respect the budget —
maxBytesis a hard budget;depthis an escalation level (0 = scoped summary, higher = deeper). Progressive disclosure beats dumps. - Deterministic when possible — same repo state + same query should give the same result. Agents and CI rely on it.
- No side effects — discovery/indexing may write caches, but retrieval must be read-only against the sources.
What the core guarantees you
- Your adapter is loaded lazily and isolated: a throwing adapter degrades to empty results, never to a crashed session
capabilitiesare surfaced to the operator before use- The engine never mutates itself based on framework output — context is data, not code
Publishing
Ship your adapter as its own npm package (recommended name: proagent-context-<name>), or point users at a git URL. To have it listed as a first-class optional adapter, open a PR adding it to the registry's optional table — same pattern as ACC.
