Skip to content

Agents.Governance: Adopt governed Instruction and per-message Preamble in the chat template #146

Closed

Description

@goodtocode

Adopt governed Instruction and per-message Preamble in the chat template

Background

This open-source template demonstrates an authenticated, governed, tool-enabled chat application using Microsoft Agent Framework with Goodtocode.Agents.Governance. Governance will define Ethics Policy, Instruction and Preamble contracts. The playbook library covers CER workflows. The template is the reference host showing how to adopt them cleanly.

Goal

Show a simple, understandable, default-safe way to embed positive values (growth, collaboration, respect, respect for natural and regional law, no direct harm) in a chat session through:

  • a session-wide Instruction (once per chat session)
  • a Preamble (before every chat message)

Scope

Instruction

  • Compose the session system instruction via governance, including the persona, the core directives and the ethics policy.
  • Apply it at the runtime boundary, as the existing governance baseline requires, before every inference.

Preamble

  • Inject the governance-composed Preamble before every user message submitted to the agent.
  • The Preamble is never rendered as a chat bubble. The persisted user/assistant bubble sequence remains the source of truth, per the Chat UX baseline.
  • Suggested prompts and tool follow-ups continue through the normal message-input path.

Default policy

  • Ship a small sample Ethics Policy (open-source, readable, tenant-agnostic) supplied through the governance policy provider abstraction. Document how adopters replace it or add jurisdiction rules.
  • Do not hard-code legal text in the template.

Governance record

  • Persist the policy id, version and hash with each governed inference record, so history can be read back into future inference context.

Architecture constraints

  • Dependency direction is preserved: Presentation -> Application -> Domain. Composition occurs in Infrastructure.AgentFramework at the agent boundary.
  • Application commands and queries stay presentation- and infrastructure-agnostic. The preamble and instruction logic lives in Infrastructure.AgentFramework, not in handlers.
  • Tools remain scoped (ScopedAgentTool) and do not access persistence directly.
  • Registration through the composition root, and no authorization bypass.

Tasks

  • Wire the governance Ethics Policy provider and Preamble composer in Infrastructure.AgentFramework
  • Apply the Preamble to every message at the agent runtime boundary
  • Ship a sample policy plus configuration (options binding with validation) for compact versus full-text preamble
  • Persist policy id, version and hash in the governance record (EF Core migration created, not applied)
  • Integration (Reqnroll) scenarios: the preamble reaches the agent on every message, the policy version is recorded, and a persona conflict does not override ethics
  • Docs: update docs/governance/ and docs/product/ with Instruction, Preamble and the adoption guide
  • README note on extending the policy

Dependencies

  • Blocked by agents-governance Phase B and C. Phase A (directive extension) enables an initial instruction-only version.

Out of scope

  • Multi-tenant or jurisdiction policy management (the closed-source Crucible fabric covers this)
  • Version bumps (maintainer-owned)

Activity

  1. changed the title [-]Adopt governed Instruction and per-message Preamble in the chat template[/-] [+]Agents.Governance: Adopt governed Instruction and per-message Preamble in the chat template[/+] on Oct 20, 2026
  2. linked a pull request that will close this issueimplemented Agent Intent #147on Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions