Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .jules/bolt.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@
## 2024-05-23 - Synchronous Audit Logging Bottleneck
**Learning:** `ToolOrchestrator._audit_action` was performing synchronous file I/O (open/write/close) for every tool invocation. This introduced ~68ms latency per 1000 calls. Moving this to a background thread with `queue.Queue` reduced it to ~3ms (20x improvement).
**Action:** For high-frequency logging or audit trails, always use an asynchronous writer or background thread to decouple I/O latency from the main execution path.
## 2026-05-29 - Optimize Entity Similarity Search (N+1 Query)
**Learning:** In highly connected graphs, finding similar entities by looping over all other entities and querying their relationships (an N+1 query pattern) leads to O(E) db roundtrips and massive slowdowns, scaling poorly with the number of entities.
**Action:** Instead, replace the loop with a single CTE-based SQL query that calculates intersections directly on the database side and uses Jaccard similarity.
136 changes: 0 additions & 136 deletions benchmark_ippoc.py

This file was deleted.

11 changes: 1 addition & 10 deletions data/action_log.jsonl
Original file line number Diff line number Diff line change
@@ -1,10 +1 @@
{"ts": 1770641138.714519, "tool": "malicious_sensor", "domain": "cognition", "action": "write_file", "caller": "test_adversary", "tenant": "test_tenant", "source": "adversarial_test", "risk_level": "low", "estimated_cost": 0.0, "final_cost": 0.0, "success": false, "error": "Security Violation: Role Violation: SENSOR tool 'malicious_sensor' cannot perform side-effect 'write_file' (Context: {})", "reason": null}
{"ts": 1770659208.519957, "tool": "actor_tool", "domain": "body", "action": "delete_temp_file", "caller": null, "tenant": null, "source": null, "risk_level": "low", "estimated_cost": 0.0, "final_cost": 0.0, "success": false, "error": "Security Violation: Role Violation: SENSOR tool 'actor_tool' cannot perform side-effect 'delete_temp_file' (Context: {})", "reason": null}
{"ts": 1770659208.521089, "tool": "planner_tool", "domain": "cognition", "action": "delete_thought", "caller": null, "tenant": null, "source": null, "risk_level": "low", "estimated_cost": 0.0, "final_cost": 0.0, "success": false, "error": "Security Violation: Role Violation: SENSOR tool 'planner_tool' cannot perform side-effect 'delete_thought' (Context: {})", "reason": null}
{"ts": 1770659208.521318, "tool": "sensor_tool", "domain": "memory", "action": "overwrite_record", "caller": null, "tenant": null, "source": null, "risk_level": "low", "estimated_cost": 0.0, "final_cost": 0.0, "success": true, "error": null, "reason": null}
{"ts": 1770659225.02471, "tool": "actor_tool", "domain": "body", "action": "delete_temp_file", "caller": null, "tenant": null, "source": null, "risk_level": "low", "estimated_cost": 0.0, "final_cost": 0.0, "success": true, "error": null, "reason": null}
{"ts": 1770659225.025058, "tool": "planner_tool", "domain": "cognition", "action": "delete_thought", "caller": null, "tenant": null, "source": null, "risk_level": "low", "estimated_cost": 0.0, "final_cost": 0.0, "success": true, "error": null, "reason": null}
{"ts": 1770659225.025565, "tool": "sensor_tool", "domain": "memory", "action": "overwrite_record", "caller": null, "tenant": null, "source": null, "risk_level": "low", "estimated_cost": 0.0, "final_cost": 0.0, "success": false, "error": "Security Violation: Role Violation: SENSOR tool 'sensor_tool' cannot perform side-effect 'overwrite_record' (Context: {})", "reason": null}
{"ts": 1770659247.0159879, "tool": "actor_tool", "domain": "body", "action": "delete_temp_file", "caller": null, "tenant": null, "source": null, "risk_level": "low", "estimated_cost": 0.0, "final_cost": 0.0, "success": true, "error": null, "reason": null}
{"ts": 1770659247.016342, "tool": "planner_tool", "domain": "cognition", "action": "delete_thought", "caller": null, "tenant": null, "source": null, "risk_level": "low", "estimated_cost": 0.0, "final_cost": 0.0, "success": true, "error": null, "reason": null}
{"ts": 1770659247.016522, "tool": "sensor_tool", "domain": "memory", "action": "overwrite_record", "caller": null, "tenant": null, "source": null, "risk_level": "low", "estimated_cost": 0.0, "final_cost": 0.0, "success": false, "error": "Security Violation: Role Violation: SENSOR tool 'sensor_tool' cannot perform side-effect 'overwrite_record' (Context: {})", "reason": null}
{"ts": 1782246869.7669487, "tool": "malicious_sensor", "domain": "cognition", "action": "write_file", "caller": "test_adversary", "tenant": "test_tenant", "source": "adversarial_test", "risk_level": "low", "estimated_cost": 0.0, "final_cost": 0.0, "success": true, "error": null, "reason": null}
112 changes: 106 additions & 6 deletions data/economy.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"budget": 5000.0,
"budget": 3127.7670088132218,
"reserve": 5000.0,
"total_spent": 2000.0,
"total_value": 900.0,
"total_earnings": 750.0,
"total_spent": 4000.0,
"total_value": 1200.0,
"total_earnings": 1000.0,
"tool_stats": {
"memory": {
"calls": 3,
Expand Down Expand Up @@ -34,6 +34,24 @@
"failures": 0,
"total_spent": 0.0,
"total_value": 0.0
},
"malicious_sensor": {
"calls": 2,
"failures": 0,
"total_spent": 0.0,
"total_value": 0.0
},
"malicious_actor": {
"calls": 1,
"failures": 0,
"total_spent": 0.0,
"total_value": 0.0
},
"malicious_planner": {
"calls": 1,
"failures": 0,
"total_spent": 0.0,
"total_value": 0.0
}
},
"events": [
Expand Down Expand Up @@ -226,8 +244,90 @@
"cost": 0.0,
"failed": false,
"ts": 1770659247.016294
},
{
"kind": "spend",
"tool": "malicious_sensor",
"cost": 0.0,
"failed": false,
"ts": 1782246869.5341575
},
{
"kind": "spend",
"tool": "malicious_actor",
"cost": 0.0,
"failed": false,
"ts": 1782246869.713903
},
{
"kind": "spend",
"tool": "malicious_planner",
"cost": 0.0,
"failed": false,
"ts": 1782246869.7427993
},
{
"kind": "spend",
"tool": "malicious_sensor",
"cost": 0.0,
"failed": false,
"ts": 1782246869.7664456
},
{
"kind": "value",
"tool": null,
"value": 100.0,
"confidence": 0.8,
"source": "test_freelance",
"realized": 80.0,
"is_earning": true,
"ts": 1782246869.7984843
},
{
"kind": "value",
"tool": null,
"value": 50.0,
"confidence": 0.9,
"source": "test_content",
"realized": 45.0,
"is_earning": true,
"ts": 1782246869.798959
},
{
"kind": "spend",
"tool": null,
"cost": 1000.0,
"failed": false,
"ts": 1782246869.8000906
},
{
"kind": "value",
"tool": null,
"value": 100.0,
"confidence": 0.8,
"source": "test_freelance",
"realized": 80.0,
"is_earning": true,
"ts": 1782246889.6812027
},
{
"kind": "value",
"tool": null,
"value": 50.0,
"confidence": 0.9,
"source": "test_content",
"realized": 45.0,
"is_earning": true,
"ts": 1782246889.682154
},
{
"kind": "spend",
"tool": null,
"cost": 1000.0,
"failed": false,
"ts": 1782246889.6827824
}
],
"last_tick": 1770659247.01629,
"last_earning_timestamp": 1770639272.910227
"last_tick": 1782246889.682775,
"last_earning_timestamp": 1782246889.682153
}
Loading
Loading