Key points
- Supported kinds:
architecture,guardrail,policy,adr,guideline,runbook,reference,example. guardrailandpolicyare blocking kinds. They apply to goals, commands, direct scripts, file writes, MCP calls, MCP arguments, and conditions.- Use exactly one of
ref(a managedteam/document) orpath(repo-local, loaded at the run commit). - A managed
refrequiresknowledge_context.usepermission on that document. required: truefails the run before execution when resolution or authorization fails.- Resolved content is snapshotted on the run, so later document edits never rewrite run history.
- Documents, and the Notion/Confluence/wiki connections they attach to, are Git-owned:
knowledge/connections/<team>/<connection>.yamldefines a connection, and a mirrored document declaressource.type: external_pagewith the page reference and sync settings. - The mirrored page body, sync status, and cached content stay runtime state, so an upstream page edit is never reported as configuration drift.
Field reference
knowledge_context[].kindknowledge refstringRequiredNone
Document kind. guardrail and policy are blocking kinds that also validate direct scripts.
kind: guardrailarchitecture, guardrail, policy, adr, guideline, runbook, reference, example
- Matching is case-insensitive; unsupported kinds fail validation.
services/nopsai/pkg/validation/pipeline.go
knowledge_context[].refknowledge refstringConditionalNone
Managed document reference in team/document form.
ref: security/repo-check- Exactly one of
reforpathmust be set. - Must be relative and contain at least two segments.
- Segments may not be empty,
., or...
Requires knowledge_context.use on the referenced document.
services/nopsai/pkg/validation/pipeline.go
knowledge_context[].pathknowledge refstringConditionalNone
Repository-local document loaded from the run repository at the run commit.
path: .nopsai/docs/backend.md- Exactly one of
reforpathmust be set. - Must be a relative path without
.or..segments.
services/nopsai/pkg/validation/pipeline.go
knowledge_context[].requiredknowledge refbooleanOptionalfalse
When true, the run fails before execution if the document cannot be resolved or authorized.
required: trueLeaving this false lets a run proceed without a guardrail the author expected to be applied.
Examples
knowledge_context:
- kind: guardrail
ref: security/repo-check
required: true
- kind: architecture
path: .nopsai/docs/backend.mdHow it works
Pipeline, step, and task knowledge context are merged, not replaced. The most specific level adds to what the broader levels already supply.
Blocking kinds are pinned by scope at run start and recomputed as pipeline, step, and task scopes begin. Emergency policy response cancels active runs rather than mutating already-resolved policy.
A script step with blocking context has its exact command LLM-validated before execution. That is why llm_enabled: false rejects such a combination.
Implementation evidence
services/nopsai/pkg/validation/pipeline.goKind, ref, and path validation.
doc/knowledge-context.mdGitOps layout, runtime snapshots, and access checks.

