External Context Providers
External context providers turn nucleus directives into promoted artifacts inside the context packet. They keep planning deterministic while enabling rich retrieval strategies.
Adapter basics
import {ExternalContextProviderAdapter, Tool} from '@ddse/acm-sdk';
const contextProvider = new ExternalContextProviderAdapter();
contextProvider.register(new FilesystemSnapshotTool(), {
match: directive => directive.startsWith('filesystem:'),
buildInput: directive => ({ path: directive.slice('filesystem:'.length) || '.' })
});
Directive flow
- Planner or runtime encounters missing context.
- Nucleus emits a directive (e.g.,
filesystem:/workspace/README.md). - Adapter matches the directive, executes the tool, and promotes the artifact to the context packet.
- Planner resumes with the enriched context.
Promotion rules
- Tools should return
{ type, content, promote?: boolean }. - When
promoteistrue, the artifact is added to the context packet automatically. - Use
typenamespaced strings (e.g.,crm.profile,log.snapshot) for easier downstream filtering.
Best practices
- Keep tooling idempotent so replays can regenerate the same artifacts.
- Sanitize responses to avoid injecting sensitive data into the context packet.
- Log directive fulfilment in the ledger for auditability.
- Combine with MCP servers to reach external knowledge bases safely.
References
- Core Concepts → Context
- Integrations → MCP
- AI Coder tasks for advanced usage