Content
# Policy Sentinel Agent
Turn workplace questions into cited policy guidance and audit-ready action.
Policy Sentinel Agent is an Enterprise Agents hackathon submission that reviews synthetic workplace requests against synthetic company policy, then produces cited guidance, risk flags, safe next steps, exception paths, follow-up tasks, and audit-ready records.
## Track Fit
- Track: Enterprise Agents
- Primary Microsoft IQ layer: Work IQ
- Bonus evidence: MCP App scaffold, external MCP-style read/write server, OAuth security scaffold
- Data posture: synthetic data only
## Safe Claim
Policy Sentinel Agent includes a Microsoft 365 Copilot Declarative Agent scaffold, MCP App-ready configuration, external MCP server demo, OAuth security scaffold, and deterministic local fallback for reliable judging.
This repository does not include real Microsoft 365 credentials, tenant IDs, Azure keys, customer data, personally identifiable information, confidential policy, or production logs.
This repository does not claim a live Microsoft 365 Copilot deployment, live Foundry deployment, or live production OAuth integration.
## Demo Scenario
Synthetic request:
```text
A manager wants to approve a contractor using a personal email address and skip security review because the project is urgent. What should we do?
```
Expected decision: do not approve as-is. The generated brief explains the high-risk policy issues, cites synthetic policy documents, and recommends safe follow-up actions.
## Quick Start
Run the deterministic local demo:
```bash
PYTHONPATH="$PWD/src" python3 -m policy_sentinel_agent demo
```
Generate the full judge evidence pack:
```bash
PYTHONPATH="$PWD/src" python3 -m policy_sentinel_agent export
```
Run the final repository readiness check:
```bash
PYTHONPATH="$PWD/src" python3 -m policy_sentinel_agent final-check
```
Run all smoke checks:
```bash
python3 tests/test_all_smoke.py
```
Expected success markers:
```text
POLICY_SENTINEL_DEMO_OK
POLICY_SENTINEL_EXPORT_OK
POLICY_SENTINEL_FINAL_CHECK_OK
POLICY_SENTINEL_ALL_SMOKE_OK
```
## What The Demo Generates
The export command creates safe synthetic artifacts under `demo/output/`:
- `policy_sentinel_brief.md`
- `action_plan.md`
- `audit_log_summary.md`
- `risk_register.md`
- `work_iq_alignment.md`
- `mcp_bonus_evidence.md`
- `final_report.html`
- `release_manifest.json`
- `judge_evidence_console.md`
## Agent Workflow
The deterministic local workflow is sequential and judge-readable:
1. Request Intake Agent
2. Policy Retrieval Agent
3. Risk Analysis Agent
4. Action Planner Agent
5. Safety Verifier Agent
The workflow is implemented locally for reliable judging and does not require cloud credentials.
## MCP Evidence
MCP-style read and write evidence lives in `mcp-server/tools.py` and `mcp-server/server.py`.
Read tools:
- `search_policy`
- `get_policy_document`
- `get_employee_context`
- `get_prior_exception_patterns`
Write tools:
- `create_policy_task`
- `append_audit_event`
- `create_exception_request`
- `update_risk_register`
The MCP smoke test writes to temporary copied JSON files so committed demo data is not dirtied during verification.
Run:
```bash
PYTHONPATH="$PWD/mcp-server" python3 tests/test_mcp_tools.py
```
Expected output:
```text
MCP_TOOLS_SMOKE_OK
```
## OAuth And Security Scaffold
OAuth guard evidence lives in:
- `src/policy_sentinel_agent/oauth_guard.py`
- `tests/test_oauth_guard.py`
- `docs/security/oauth_scaffold.md`
- `config/oauth.example.json`
Run:
```bash
PYTHONPATH="$PWD/src" python3 tests/test_oauth_guard.py
python3 tests/test_secret_hygiene.py
```
Expected output:
```text
OAUTH_GUARD_SMOKE_OK
SECRET_HYGIENE_OK
```
## Microsoft 365 Copilot Scaffold
Copilot-style scaffold evidence lives in:
- `copilot-agent/declarativeAgent.scaffold.json`
- `copilot-agent/mcp_app_manifest.scaffold.json`
- `copilot-agent/instructions.md`
- `docs/microsoft_iq_alignment.md`
Run:
```bash
python3 tests/test_copilot_scaffold.py
```
Expected output:
```text
COPILOT_SCAFFOLD_SMOKE_OK
```
## Work IQ Alignment
Policy Sentinel Agent aligns with Work IQ by reasoning over workplace context: roles, policy requests, approvals, tasks, risks, exception paths, and audit history. The current project uses synthetic local data to demonstrate the workflow safely.
## Safety Position
- Synthetic data only
- No real credentials
- No tenant IDs
- No access tokens
- No refresh tokens
- No private keys
- No customer data
- No confidential internal policy
- No unsupported live deployment claims
## Judge Evidence Files
- `docs/release_manifest.md`
- `docs/demo_video_script.md`
- `docs/final_submission_checklist.md`
- `docs/checkpoints/phase_0_checkpoint.md` through `docs/checkpoints/phase_5_checkpoint.md`
- `demo/output/judge_evidence_console.md` generated by export
## Final Submission Gate
Before submission, run:
```bash
PYTHONPATH="$PWD/src" python3 -m policy_sentinel_agent export
PYTHONPATH="$PWD/src" python3 -m policy_sentinel_agent final-check
python3 tests/test_all_smoke.py
python3 tests/test_secret_hygiene.py
```
Required output:
```text
POLICY_SENTINEL_EXPORT_OK
POLICY_SENTINEL_FINAL_CHECK_OK
POLICY_SENTINEL_ALL_SMOKE_OK
SECRET_HYGIENE_OK
```
## Freeze Rule
After README, final-check, all-smoke, secret hygiene, demo script, and submission text are ready, stop feature work. Only fix proven blockers.