Commit f520db7
Feat/claude code updates (#74)
* feat(core): add ModificationObject and Modify decision variant
Add support for the `modify` decision verb:
- Add ModificationObject struct with priority field (1-100, higher wins)
- Add modifications field to DecisionSet
- Add FinalDecision::Modify variant with reason, updated_input, agent_messages
- Add helper methods: has_modifications(), is_modify(), updated_input(), is_ask()
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat(core): add Modify synthesis with module refactoring
Implement Modify decision synthesis with priority-based merge:
- Add Modify between Ask and AllowOverride in priority hierarchy
- Implement merge_modifications() with deep merge and priority resolution
- Add collect_modification_agent_messages() for context extraction
Refactor synthesis into module structure:
- Extract tests (~340 lines) to synthesis/tests.rs
- Extract merge logic (~80 lines) to synthesis/merge_input_updates.rs
- Reduce mod.rs from 720 to ~310 lines
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat(harness): add EngineDecision::Modify variant
Add Modify variant to EngineDecision enum with reason and updated_input
fields for harness-level handling of modify decisions.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat(harness): handle Modify decision in all harness adapters
Update adapt_decision() in all harnesses:
- ClaudeHarness: Full support with EngineDecision::Modify
- FactoryHarness: Full support with EngineDecision::Modify
- CursorHarness: Treat Modify as Allow (no updatedInput support)
- OpenCodeHarness: Treat Modify as Allow
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat(claude-code): add Modify support to response builders
Handle EngineDecision::Modify in all Claude Code response builders:
- pre_tool_use.rs: Set permissionDecision=allow with updatedInput
- context_injection.rs: Treat as Allow with context
- feedback_loop.rs: Treat as Allow
- generic.rs: Treat as Allow
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat(factory): add Modify support to response builders
Handle EngineDecision::Modify in all Factory response builders:
- pre_tool_use.rs: Set permissionDecision=allow with updatedInput
- context_injection.rs: Treat as Allow
- feedback_loop.rs: Treat as Allow
- generic.rs: Treat as Allow
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat(cursor): handle Modify decision in response builders
Treat EngineDecision::Modify as Allow in Cursor response builders
(Cursor protocol does not support updatedInput):
- before_mcp_execution.rs: Modify → Allow
- before_read_file.rs: Modify → Allow
- before_shell_execution.rs: Modify → Allow
- before_submit_prompt.rs: Modify → Continue
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat(core): handle Modify in engine and debug output
Update engine and debug modules for Modify decision:
- engine/mod.rs: Add FinalDecision::Modify cases in match statements
- debug.rs: Add Modify case for debug file output
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat(validator): add DecisionVerb::Modify for PreToolUse
Add Modify to decision-event validation matrix:
- Add DecisionVerb::Modify enum variant
- Update all(), from_rego_name(), rego_name(), description()
- Add Modify to PreToolUse compatibility list only
- Add incompatibility message for non-PreToolUse events
- Add test_modify_only_pre_tool_use test
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat(rego): add modifications collection to evaluate templates
Add "modifications": collect_verbs("modify") to decision_set in all
system evaluate.rego templates:
- cupcake-cli/src/main.rs (SYSTEM_EVALUATE_TEMPLATE)
- fixtures/{claude,cursor,factory,opencode}/system/evaluate.rego
- examples/fixtures/system/evaluate.rego
- cupcake-core/tests/fixtures/{system_evaluate,global_system_evaluate}.rego
- cupcake-py/test-fixtures/.cupcake/policies/system/evaluate.rego
- cupcake-ts/test-fixtures/.cupcake/policies/claude/system/evaluate.rego
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* test(factory): add modify decision integration test
Add test_modify_decision_generates_allow_with_updated_input test
to verify modify decisions correctly generate allow responses with
updatedInput field in Factory harness.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* docs: add modify verb documentation
Update documentation to reflect the new `modify` decision verb:
- reference/policies/custom.md: Add modify to decision verbs table with
example showing priority-based input transformation
- reference/harnesses/claude-code.md: Add Can Modify column to events
table, document updatedInput response format
- reference/harnesses/factory-ai.md: Update to note Claude Code now also
supports input modification
- reference/harnesses/cursor.md: Add input modification row noting it's
not supported in Cursor
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* docs(readme): add Modify decision to Decisions & Feedback section
Update main README to document the new modify decision type that allows
policies to transform tool input before execution. Also fixed context
injection note to include Factory AI support.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* refactor: remove allow_override decision verb
Remove the allow_override decision verb which was designed for an
unimplemented "deny-by-default" mode. In the current allow-by-default
architecture, Claude never sees the permissionDecisionReason when the
decision is "allow", making this feature non-functional.
Changes:
- Remove AllowOverride from DecisionVerb enum and FinalDecision
- Remove allow_override from DecisionSet struct
- Remove from synthesis logic and harness adapters
- Update all evaluate.rego templates to remove allow_overrides
- Update tests that used allow_override to use add_context instead
- Update documentation to remove allow_override references
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* readme updates
* Fix SLSA badge link in README
Updated SLSA badge link in README.md.
* readme updates
* readme updates
* readme updates
* readme updates
* Add PermissionRequest hook event and deprecate block for PreToolUse
PermissionRequest is a new Claude Code hook that fires when the user is
shown a permission dialog, allowing policies to auto-approve or auto-deny.
PermissionRequest implementation:
- New event payload with tool_name, tool_input, tool_use_id fields
- Response format uses nested decision object with behavior (allow/deny),
updatedInput, message, and interrupt fields
- No "ask" behavior - this IS the ask dialog
- Supported verbs: halt, deny, block, modify (no ask, no add_context)
Deprecation warning for block + PreToolUse:
- Using 'block' for PreToolUse now emits a deprecation warning
- Users should migrate to 'deny' for pre-execution rejection
- 'block' is for post-execution feedback loops (PostToolUse)
- This will become an error in a future version
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Add permission_mode, tool_use_id, and notification_type fields to Claude Code events
Implements new input fields from Claude Code hooks specification:
- permission_mode: Added to CommonEventData (all events) with PermissionMode enum
- tool_use_id: Added to PreToolUse and PostToolUse payloads
- notification_type: Added to Notification payload with NotificationType enum
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Add SOC/SIEM telemetry export and consolidate docs
Telemetry feature:
- Add TelemetryConfig to rulebook (enabled, format, destination)
- Add JSON serialization to DebugCapture for structured export
- Wire up telemetry in CLI eval command
Documentation:
- Consolidate watchdog docs into single reference page
- Add enterprise section (global-config, policy-registry, soc-siem, enterprise-pro)
- Reorganize nav structure
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Fix clippy warnings and formatting in catalog code
Auto-fixed uninlined format args warnings from clippy.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* add amp to readme
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>1 parent ed4375d commit f520db7
92 files changed
Lines changed: 2849 additions & 1049 deletions
File tree
- .github/workflows
- cupcake-cli
- src
- tests
- cupcake-core
- benches
- src
- catalog
- engine
- synthesis
- harness
- events/claude_code
- response
- claude_code
- cursor
- factory
- validator
- tests
- fixtures
- cupcake-py/test-fixtures/.cupcake/policies
- system
- cupcake-ts/test-fixtures/.cupcake/policies/claude
- system
- docs
- agents/opencode
- docs
- enterprise
- reference
- harnesses
- policies
- watchdog
- examples/fixtures/system
- fixtures
- claude/system
- cursor/system
- factory/system
- opencode/system
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 | |
|---|---|---|---|
| |||
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
175 | | - | |
| 175 | + | |
176 | 176 | | |
177 | 177 | | |
178 | 178 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
36 | 36 | | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
44 | 45 | | |
45 | | - | |
| 46 | + | |
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
176 | | - | |
| 176 | + | |
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
| |||
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
192 | | - | |
| 192 | + | |
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
| |||
305 | 305 | | |
306 | 306 | | |
307 | 307 | | |
308 | | - | |
| 308 | + | |
309 | 309 | | |
310 | 310 | | |
311 | 311 | | |
| |||
338 | 338 | | |
339 | 339 | | |
340 | 340 | | |
341 | | - | |
| 341 | + | |
342 | 342 | | |
343 | 343 | | |
344 | 344 | | |
| |||
393 | 393 | | |
394 | 394 | | |
395 | 395 | | |
396 | | - | |
397 | | - | |
398 | | - | |
| 396 | + | |
| 397 | + | |
399 | 398 | | |
400 | 399 | | |
401 | 400 | | |
| |||
486 | 485 | | |
487 | 486 | | |
488 | 487 | | |
489 | | - | |
| 488 | + | |
490 | 489 | | |
491 | 490 | | |
492 | 491 | | |
| |||
504 | 503 | | |
505 | 504 | | |
506 | 505 | | |
507 | | - | |
| 506 | + | |
508 | 507 | | |
509 | 508 | | |
510 | 509 | | |
| |||
560 | 559 | | |
561 | 560 | | |
562 | 561 | | |
563 | | - | |
| 562 | + | |
564 | 563 | | |
565 | 564 | | |
566 | 565 | | |
| |||
621 | 620 | | |
622 | 621 | | |
623 | 622 | | |
624 | | - | |
625 | | - | |
626 | | - | |
627 | | - | |
| 623 | + | |
628 | 624 | | |
629 | 625 | | |
630 | 626 | | |
| |||
663 | 659 | | |
664 | 660 | | |
665 | 661 | | |
666 | | - | |
| 662 | + | |
667 | 663 | | |
668 | 664 | | |
669 | 665 | | |
| |||
681 | 677 | | |
682 | 678 | | |
683 | 679 | | |
684 | | - | |
| 680 | + | |
685 | 681 | | |
686 | 682 | | |
687 | 683 | | |
| |||
692 | 688 | | |
693 | 689 | | |
694 | 690 | | |
695 | | - | |
696 | | - | |
697 | | - | |
698 | | - | |
| 691 | + | |
699 | 692 | | |
700 | 693 | | |
701 | 694 | | |
702 | 695 | | |
703 | 696 | | |
704 | 697 | | |
705 | 698 | | |
706 | | - | |
707 | | - | |
| 699 | + | |
708 | 700 | | |
709 | 701 | | |
710 | 702 | | |
711 | 703 | | |
712 | 704 | | |
713 | 705 | | |
714 | | - | |
| 706 | + | |
715 | 707 | | |
716 | 708 | | |
717 | 709 | | |
718 | 710 | | |
719 | 711 | | |
720 | 712 | | |
721 | 713 | | |
722 | | - | |
| 714 | + | |
723 | 715 | | |
724 | 716 | | |
725 | 717 | | |
| |||
740 | 732 | | |
741 | 733 | | |
742 | 734 | | |
743 | | - | |
| 735 | + | |
744 | 736 | | |
745 | 737 | | |
746 | 738 | | |
| |||
818 | 810 | | |
819 | 811 | | |
820 | 812 | | |
821 | | - | |
| 813 | + | |
822 | 814 | | |
823 | 815 | | |
824 | 816 | | |
825 | | - | |
| 817 | + | |
826 | 818 | | |
827 | 819 | | |
828 | 820 | | |
| |||
844 | 836 | | |
845 | 837 | | |
846 | 838 | | |
847 | | - | |
| 839 | + | |
848 | 840 | | |
849 | 841 | | |
850 | 842 | | |
| |||
859 | 851 | | |
860 | 852 | | |
861 | 853 | | |
862 | | - | |
| 854 | + | |
863 | 855 | | |
864 | 856 | | |
865 | 857 | | |
866 | 858 | | |
867 | 859 | | |
868 | 860 | | |
869 | 861 | | |
870 | | - | |
| 862 | + | |
871 | 863 | | |
872 | 864 | | |
873 | 865 | | |
| |||
884 | 876 | | |
885 | 877 | | |
886 | 878 | | |
887 | | - | |
| 879 | + | |
888 | 880 | | |
889 | | - | |
| 881 | + | |
890 | 882 | | |
891 | | - | |
| 883 | + | |
892 | 884 | | |
893 | 885 | | |
894 | 886 | | |
| |||
0 commit comments