Commit a1e9fcb
bgagent
refactor(agent): decompose entrypoint.py into modular src/ package with Cedar policy engine
Decompose the monolithic agent/entrypoint.py (~2,100 lines) into 13
focused modules under agent/src/, add a Cedar-based policy engine for
tool-call governance, and fix 15 review findings across Python and CDK
TypeScript code.
Agent decomposition:
- config.py, models.py (TaskType enum), pipeline.py, runner.py,
context.py, prompt_builder.py, hooks.py, policy.py, post_hooks.py,
repo.py, shell.py, telemetry.py
- entrypoint.py retained as re-export shim for backward compatibility
Cedar policy engine (agent/src/policy.py + hooks.py):
- In-process cedarpy evaluation with deny-list model (fail-closed)
- pr_review agents denied Write/Edit; protected path and destructive
command blocking for all agents
- Per-repo custom Cedar policies via Blueprint security.cedarPolicies
- PreToolUse hook integration with Claude Agent SDK
- POLICY_DECISION telemetry events on denied decisions
Critical fixes:
- log() was silently discarding message text
- PolicyEngine changed from fail-open to fail-closed
- Hook fallbacks now deny (not silently allow) on invalid inputs
CDK changes:
- Blueprint cedarPolicies resolved to readonly property
- context-hydration: POLICY_EXTRACTORS mapping table, managedWordLists
support, formatGuardrailBlocked helper, tightened filter_type union
- cedar_policies passthrough in orchestrator and repo-config
Tests: 139 Python (6 new test files), 604 CDK (4 files updated)
Documentation: 7 docs updated for new module structure and Cedar status1 parent 06002e2 commit a1e9fcb
55 files changed
Lines changed: 3681 additions & 2175 deletions
File tree
- agent
- src
- prompts
- tests
- cdk
- src
- constructs
- test
- constructs
- handlers
- docs
- design
- guides
- src/content/docs
- design
- roadmap
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
54 | | - | |
| 53 | + | |
55 | 54 | | |
56 | 55 | | |
57 | 56 | | |
| |||
69 | 68 | | |
70 | 69 | | |
71 | 70 | | |
72 | | - | |
| 71 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | | - | |
| 84 | + | |
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
| |||
320 | 320 | | |
321 | 321 | | |
322 | 322 | | |
323 | | - | |
| 323 | + | |
324 | 324 | | |
325 | 325 | | |
326 | | - | |
327 | | - | |
328 | | - | |
329 | | - | |
330 | | - | |
331 | | - | |
332 | | - | |
333 | | - | |
334 | | - | |
335 | | - | |
336 | | - | |
337 | | - | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
338 | 352 | | |
339 | 353 | | |
340 | | - | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
341 | 362 | | |
342 | 363 | | |
343 | 364 | | |
| |||
0 commit comments