An engineering playbook for governing Copilot agent sessions, CLI review commands, discussion creation, and the audit trail around automation.
Define What an Agent Session Is Allowed to Touch
Agentic Copilot workflows fail governance when nobody has written down the session boundary. Treat each agent run as a scoped work unit: which repos or paths it may edit, which commands it may execute, which secrets or environments it may never see, and what “done” means before a human reviews the result. Put those constraints in a short playbook entry that engineers can paste into prompts or session configs, not in tribal knowledge.
Separate exploratory sessions from production-bound ones. Exploratory runs may read broadly and propose diffs; production-bound runs should require a dry-run or plan step, a limited write surface, and an explicit handoff. If the agent cannot state which files it changed and why, the session is not ready for review.
Standardize CLI Review Commands
Governance sticks when review is a command, not a chat habit. Publish a small set of CLI review steps that every agent-produced change must pass before discussion or merge: format and lint, unit or smoke tests for the touched area, a diff summary limited to intended paths, and a secrets or config-scan if the change touches credentials, infra, or deploy scripts. Document the exact command names your team uses so agents and humans invoke the same checklist.
Prefer fail-closed defaults. If a required check is skipped or the agent cannot run it, the playbook should mark the run as blocked, not “probably fine.” Capture command output (or a link to it) with the session so reviewers do not re-run everything from scratch unless something looks wrong.
Route Outcomes into Discussions, Not Silent Merges
Agent work should create a discussion artifact—PR description, design note, or ticket comment—that a human can accept, reject, or redirect. That artifact should include the original goal, the plan the agent followed, the files and checks involved, open risks, and a clear ask (approve, revise scope, or abandon). Without that, automation becomes unaccountable side-channel edits.
- Goal and constraints the session started with
- What changed and what was deliberately left alone
- Which review commands ran and their outcomes
- Residual risks and who owns the final decision
Keep an Audit Trail for Every Automated Run
An audit trail is how you debug bad agent behavior and prove process later. Log session start time, operator or trigger, prompt or playbook version used, tools invoked, paths modified, review command results, and the discussion or PR id that closed the loop. Store this where engineers already look—alongside the PR or in your existing ops logs—so it is not a separate system nobody opens.
Retention and access matter as much as capture. Restrict who can re-run privileged agent sessions, redact secrets from logs, and treat audit records as read-mostly evidence: useful for incidents, onboarding, and tightening the playbook when the same class of mistake repeats. Governance is not a one-time policy document; it is the loop of session rules, CLI review, human discussion, and durable records that keep agentic Copilot work reviewable and reversible.