skills/decision-envelope/SKILL.md
Using the decision envelope pattern for structured thinking.
npx skillsauth add tracemem/tracemem-skills decision-envelopeInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill teaches how to correctly manage the lifecycle of a Decision Envelope. The Decision Envelope is the mandatory boundary for all governed operations in TraceMem.
decision_record Instead?If you only need to document or record a decision (e.g., architecture choice, dependency selection, tradeoff) and do NOT need data product operations (reads, writes, policy evaluations, or approvals), use decision_record instead of the full envelope workflow. It handles everything in one call. See the decision-recording skill.
decision_record instead.decision_read - requires decision_iddecision_write - requires decision_iddecision_evaluate - requires decision_iddecision_request_approval - requires decision_idproducts_list and product_get - do NOT require decision_id (discovery tools)open), operated upon, and then explicitly closed (commit or abort).intent string (e.g., customer.onboarding.verification) that describes why this decision exists.automation_mode (only these values: propose, approve, override, autonomous).decision_close is called in finally blocks or error handlers.Purpose: Retrieve customer information for support
1. decision_create
- intent: "customer.lookup.support"
- automation_mode: "autonomous"
→ Returns: decision_id
2. product_get (optional but recommended)
- product: "customers_v1"
→ Returns: schema and allowed_purposes
3. decision_read (REQUIRES decision_id from step 1)
- decision_id: <from step 1>
- product: "customers_v1"
- purpose: "support_context"
- query: {"customer_id": "1001"}
→ Returns: customer records
4. decision_close (REQUIRED)
- decision_id: <from step 1>
- action: "commit"
❌ WRONG: Calling decision_read without step 1 will FAIL
Purpose: Create a new customer order
1. decision_create
- intent: "order.create.customer"
- automation_mode: "autonomous"
→ Returns: decision_id
2. product_get
- product: "orders_v1"
→ Returns: schema with required fields
3. decision_write (REQUIRES decision_id from step 1)
- decision_id: <from step 1>
- product: "orders_v1"
- purpose: "order_creation"
- operation: "insert" ← INSERT creates NEW records
- mutation: {
"records": [{
"customer_id": 1001,
"total_amount": 99.99,
"status": "pending"
}]
}
→ Returns: created order
4. decision_close (REQUIRED)
- decision_id: <from step 1>
- action: "commit"
❌ WRONG: Calling decision_write without step 1 will FAIL
Purpose: Update order status
1. decision_create
- intent: "order.status.update"
- automation_mode: "approve"
→ Returns: decision_id
2. decision_read (read current state)
- decision_id: <from step 1>
- product: "orders_v1"
- purpose: "order_update"
- query: {"order_id": "12345"}
→ Returns: current order data
3. decision_evaluate (check if update allowed)
- decision_id: <from step 1>
- policy_id: "order_status_change_v1"
- inputs: {"current_status": "pending", "new_status": "shipped"}
→ Returns: allowed/denied
4. decision_write (REQUIRES decision_id from step 1)
- decision_id: <from step 1>
- product: "orders_v1"
- purpose: "order_update"
- operation: "update" ← UPDATE modifies EXISTING records
- keys: {"order_id": "12345"} ← NEW: Explicit key specification
- mutation: {
"fields": {
"status": "shipped" ← What to change
}
}
5. decision_close (REQUIRED)
- decision_id: <from step 1>
- action: "commit"
❌ WRONG: Any operation without decision_id will FAIL
Purpose: Delete expired draft order
1. decision_create
- intent: "order.draft.cleanup"
- automation_mode: "autonomous"
→ Returns: decision_id
2. decision_read (verify before delete)
- decision_id: <from step 1>
- product: "orders_v1"
- purpose: "data_cleanup"
- query: {"order_id": "67890", "status": "draft"}
3. decision_write (REQUIRES decision_id from step 1)
- decision_id: <from step 1>
- product: "orders_v1"
- purpose: "data_cleanup"
- operation: "delete" ← DELETE removes records
- keys: {"order_id": "67890"} ← NEW: Explicit key specification
4. decision_close (REQUIRED)
- decision_id: <from step 1>
- action: "commit"
Purpose: Request approval for large discount
1. decision_create
- intent: "discount.exception.request"
- automation_mode: "approve"
→ Returns: decision_id
2. decision_evaluate
- decision_id: <from step 1>
- policy_id: "discount_cap_v1"
- inputs: {"discount": 0.30, "customer_tier": "standard"}
→ Returns: requires_approval
3. decision_request_approval (REQUIRES decision_id from step 1)
- decision_id: <from step 1>
- title: "30% Discount Request"
- message: "Customer requesting exception"
→ Returns: approval_id
4. [Wait for approval - poll decision_get]
5. decision_close (REQUIRED)
- decision_id: <from step 1>
- action: "commit" or "abort" (based on approval result)
Create the Envelope:
Call decision_create with:
intent: A dot-separated string (e.g., financial.report.generate).automation_mode: One of propose, approve, override, autonomous.actor: Your agent identity.Result: You receive a decision_id.
Operate within the Envelope:
Perform all decision_read, decision_evaluate, and decision_write calls using the decision_id.
Close the Envelope:
decision_close with action: "commit".decision_close with action: "rollback" (or abort if strictly tracking abandonment).Note: Writes are only permanently applied when the decision is committed (depending on system configuration, but logically, the decision is not "done" until committed).
decision_read, decision_write, decision_evaluate, or decision_request_approval without first calling decision_create will FAIL. The decision envelope is MANDATORY for ALL these operations.task.do or agent.act. Use specific, domain-relevant intents (user.password.reset, invoice.payment.process).autonomous when the task requires human oversight, or propose when you intend to execute immediately. Remember: only propose, approve, override, or autonomous are valid.For decisions that do not require data product operations (reads, writes, evaluations, approvals), use decision_record instead of the full envelope workflow. This is ideal for recording architecture decisions, dependency choices, schema changes, and other engineering decisions.
Tool: decision_record
Parameters:
- title: "Use goroutines with worker pool pattern"
- category: "architecture"
- context: "The pipeline needs concurrent processing..."
- decision: "Implement bounded worker pool using channels..."
- rationale: "Worker pools provide backpressure naturally..."
- alternatives_considered: [{option: "...", rejected_because: "..."}]
- tags: ["go", "concurrency"]
Returns: Committed decision with trace and snapshot
When to use decision_record vs full envelope:
decision_record: Pure architectural/design decisions, no data operations neededdecision_create → operations → decision_close): Decisions involving data reads, writes, policy evaluations, or approval workflowsYou can also search past decisions with decision_search before recording new ones to find precedent or decisions to supersede.
decision_close is attempted.testing
Instructions for writing and efficiently storing data in TraceMem.
tools
Complete workflow patterns for common TraceMem operations.
tools
Scenarios where TraceMem should not be used.
development
Auditing memory traces and debugging.