@ddse/acm-examples 0.5.0 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/dist/src/examples/entitlement/tasks.d.ts +44 -0
  2. package/dist/src/examples/entitlement/tasks.d.ts.map +1 -0
  3. package/dist/src/examples/entitlement/tasks.js +27 -0
  4. package/dist/src/examples/entitlement/tasks.js.map +1 -0
  5. package/dist/src/examples/entitlement/tools.d.ts +74 -0
  6. package/dist/src/examples/entitlement/tools.d.ts.map +1 -0
  7. package/dist/src/examples/entitlement/tools.js +63 -0
  8. package/dist/src/examples/entitlement/tools.js.map +1 -0
  9. package/dist/src/framework.d.ts +19 -0
  10. package/dist/src/framework.d.ts.map +1 -0
  11. package/dist/src/framework.js +42 -0
  12. package/dist/src/framework.js.map +1 -0
  13. package/dist/src/registries.d.ts +3 -0
  14. package/dist/src/registries.d.ts.map +1 -1
  15. package/dist/src/registries.js +11 -0
  16. package/dist/src/registries.js.map +1 -1
  17. package/dist/tests/entitlement.test.d.ts +2 -0
  18. package/dist/tests/entitlement.test.d.ts.map +1 -0
  19. package/dist/tests/entitlement.test.js +30 -0
  20. package/dist/tests/entitlement.test.js.map +1 -0
  21. package/dist/tsconfig.tsbuildinfo +1 -1
  22. package/package.json +22 -9
  23. package/bin/acm-demo.ts +0 -495
  24. package/data/coaching/agents.json +0 -16
  25. package/data/coaching/transcripts.json +0 -37
  26. package/data/documents.json +0 -72
  27. package/data/entitlement/customers.json +0 -38
  28. package/data/entitlement/policies.json +0 -38
  29. package/data/incidents/incidents.json +0 -30
  30. package/data/incidents/routing_rules.json +0 -36
  31. package/data/invoices/invoices.json +0 -38
  32. package/data/invoices/purchase-orders.json +0 -38
  33. package/data/issues.json +0 -99
  34. package/data/knowledge/docs/kb-001.md +0 -7
  35. package/data/knowledge/docs/kb-002.md +0 -7
  36. package/data/knowledge/docs/kb-003.md +0 -9
  37. package/data/knowledge/index.json +0 -25
  38. package/data/orders.json +0 -106
  39. package/docs/examples-architecture.md +0 -144
  40. package/docs/successrun.md +0 -1022
  41. package/src/context/directives.ts +0 -366
  42. package/src/context/index.ts +0 -1
  43. package/src/data/coaching.ts +0 -50
  44. package/src/data/entitlement.ts +0 -60
  45. package/src/data/incidents.ts +0 -78
  46. package/src/data/invoices.ts +0 -103
  47. package/src/data/knowledge.ts +0 -77
  48. package/src/data/loader.ts +0 -80
  49. package/src/examples/scenarios.ts +0 -724
  50. package/src/goals/index.ts +0 -18
  51. package/src/policy.ts +0 -30
  52. package/src/registries.ts +0 -48
  53. package/src/renderer.ts +0 -82
  54. package/src/search/bm25.ts +0 -173
  55. package/src/search/index.ts +0 -2
  56. package/src/tasks/coaching.ts +0 -217
  57. package/src/tasks/entitlement.ts +0 -197
  58. package/src/tasks/incidents.ts +0 -277
  59. package/src/tasks/index.ts +0 -6
  60. package/src/tasks/invoices.ts +0 -269
  61. package/src/tasks/knowledge.ts +0 -169
  62. package/src/tasks/legacy.ts +0 -112
  63. package/src/tools/coaching/index.ts +0 -197
  64. package/src/tools/entitlement/index.ts +0 -199
  65. package/src/tools/incidents/index.ts +0 -185
  66. package/src/tools/index.ts +0 -192
  67. package/src/tools/invoices/index.ts +0 -165
  68. package/src/tools/knowledge/index.ts +0 -203
  69. package/tests/bm25.test.ts +0 -129
  70. package/tests/integration.test.ts +0 -163
  71. package/tests/plan-hydration.test.ts +0 -33
  72. package/tsconfig.json +0 -18
@@ -1,30 +0,0 @@
1
- [
2
- {
3
- "id": "INC-2045",
4
- "service": "checkout-api",
5
- "reportedAt": "2025-10-05T03:22:00Z",
6
- "customerImpact": "MAJOR",
7
- "category": "OUTAGE",
8
- "signalScore": 0.91,
9
- "declaredSeverity": "CRITICAL",
10
- "vipCustomer": true
11
- },
12
- {
13
- "id": "INC-2078",
14
- "service": "analytics-stream",
15
- "reportedAt": "2025-10-05T09:40:00Z",
16
- "customerImpact": "MINOR",
17
- "category": "PERFORMANCE",
18
- "signalScore": 0.63,
19
- "declaredSeverity": "MEDIUM"
20
- },
21
- {
22
- "id": "INC-2099",
23
- "service": "identity-core",
24
- "reportedAt": "2025-10-05T11:05:00Z",
25
- "customerImpact": "MAJOR",
26
- "category": "SECURITY",
27
- "signalScore": 0.74,
28
- "declaredSeverity": "HIGH"
29
- }
30
- ]
@@ -1,36 +0,0 @@
1
- [
2
- {
3
- "id": "ROUTE-CHECKOUT-CRITICAL",
4
- "service": "checkout-api",
5
- "category": "OUTAGE",
6
- "minSeverity": "HIGH",
7
- "queue": "incident-bridge",
8
- "escalatesTo": "director-oncall@northwind.example",
9
- "notes": "Critical checkout outages route directly to the incident bridge."
10
- },
11
- {
12
- "id": "ROUTE-CHECKOUT-MEDIUM",
13
- "service": "checkout-api",
14
- "category": "OUTAGE",
15
- "minSeverity": "MEDIUM",
16
- "queue": "payments-oncall",
17
- "notes": "Medium outages handled by payments engineers."
18
- },
19
- {
20
- "id": "ROUTE-ANALYTICS-PERF",
21
- "service": "analytics-stream",
22
- "category": "PERFORMANCE",
23
- "minSeverity": "MEDIUM",
24
- "queue": "analytics-sre",
25
- "notes": "Performance degradations owned by analytics SRE."
26
- },
27
- {
28
- "id": "ROUTE-ID-SECURITY",
29
- "service": "identity-core",
30
- "category": "SECURITY",
31
- "minSeverity": "HIGH",
32
- "queue": "security-incident",
33
- "escalatesTo": "ciso@northwind.example",
34
- "notes": "Security incidents always escalate to CISO contact."
35
- }
36
- ]
@@ -1,38 +0,0 @@
1
- [
2
- {
3
- "id": "INV-84721",
4
- "supplier": "Skyline Components",
5
- "total": 18450,
6
- "currency": "USD",
7
- "purchaseOrderId": "PO-99231",
8
- "receivedAt": "2025-09-29T14:12:00Z",
9
- "lines": [
10
- { "sku": "SRV-FW-EDGE", "description": "Edge firewall appliance", "quantity": 5, "unitPrice": 2500 },
11
- { "sku": "SRV-SUP-24M", "description": "24 month premium support", "quantity": 5, "unitPrice": 190 }
12
- ]
13
- },
14
- {
15
- "id": "INV-84758",
16
- "supplier": "Northwind Training",
17
- "total": 6120,
18
- "currency": "USD",
19
- "purchaseOrderId": "PO-99244",
20
- "receivedAt": "2025-09-30T09:48:00Z",
21
- "lines": [
22
- { "sku": "TRN-COACHING", "description": "Onsite coaching workshop", "quantity": 3, "unitPrice": 1800 },
23
- { "sku": "TRN-MATERIALS", "description": "Participant materials", "quantity": 30, "unitPrice": 18 }
24
- ]
25
- },
26
- {
27
- "id": "INV-84761",
28
- "supplier": "Rapid Devices",
29
- "total": 9200,
30
- "currency": "USD",
31
- "purchaseOrderId": "PO-99231",
32
- "receivedAt": "2025-10-01T11:05:00Z",
33
- "lines": [
34
- { "sku": "SRV-FW-EDGE", "description": "Edge firewall appliance", "quantity": 4, "unitPrice": 2400 },
35
- { "sku": "SRV-SUP-24M", "description": "24 month premium support", "quantity": 4, "unitPrice": 190 }
36
- ]
37
- }
38
- ]
@@ -1,38 +0,0 @@
1
- [
2
- {
3
- "id": "PO-99231",
4
- "initiator": "Darius Patel",
5
- "department": "Network Engineering",
6
- "total": 18500,
7
- "currency": "USD",
8
- "status": "approved",
9
- "lines": [
10
- { "sku": "SRV-FW-EDGE", "description": "Edge firewall appliance", "quantity": 5, "unitPrice": 2500 },
11
- { "sku": "SRV-SUP-24M", "description": "24 month premium support", "quantity": 5, "unitPrice": 200 }
12
- ]
13
- },
14
- {
15
- "id": "PO-99244",
16
- "initiator": "Megan Lee",
17
- "department": "People Operations",
18
- "total": 6200,
19
- "currency": "USD",
20
- "status": "approved",
21
- "lines": [
22
- { "sku": "TRN-COACHING", "description": "Onsite coaching workshop", "quantity": 3, "unitPrice": 1800 },
23
- { "sku": "TRN-MATERIALS", "description": "Participant materials", "quantity": 30, "unitPrice": 20 }
24
- ]
25
- },
26
- {
27
- "id": "PO-99267",
28
- "initiator": "Laila Ortiz",
29
- "department": "Manufacturing",
30
- "total": 11800,
31
- "currency": "USD",
32
- "status": "pending",
33
- "lines": [
34
- { "sku": "MFG-CNC-LEASE", "description": "CNC equipment lease", "quantity": 1, "unitPrice": 9600 },
35
- { "sku": "MFG-SAFETY-KIT", "description": "Safety equipment kit", "quantity": 40, "unitPrice": 55 }
36
- ]
37
- }
38
- ]
package/data/issues.json DELETED
@@ -1,99 +0,0 @@
1
- [
2
- {
3
- "issueId": "ISS-001",
4
- "title": "Unable to complete checkout",
5
- "description": "Payment processing fails at the final step with error code 500",
6
- "severity": "high",
7
- "status": "open",
8
- "reportedBy": "C-789",
9
- "reportedAt": "2025-01-15T10:30:00Z",
10
- "category": "payment",
11
- "affectedUsers": 45,
12
- "region": "US-EAST"
13
- },
14
- {
15
- "issueId": "ISS-002",
16
- "title": "Product images not loading",
17
- "description": "Product detail pages show broken image placeholders instead of actual product photos",
18
- "severity": "medium",
19
- "status": "investigating",
20
- "reportedBy": "C-456",
21
- "reportedAt": "2025-01-14T14:20:00Z",
22
- "category": "ui",
23
- "affectedUsers": 120,
24
- "region": "EU-WEST"
25
- },
26
- {
27
- "issueId": "ISS-003",
28
- "title": "Email notifications delayed",
29
- "description": "Order confirmation emails are arriving 2-3 hours after order placement instead of immediately",
30
- "severity": "low",
31
- "status": "resolved",
32
- "reportedBy": "C-123",
33
- "reportedAt": "2025-01-13T09:15:00Z",
34
- "resolvedAt": "2025-01-14T16:00:00Z",
35
- "category": "notifications",
36
- "affectedUsers": 200,
37
- "region": "global"
38
- },
39
- {
40
- "issueId": "ISS-004",
41
- "title": "Search results inaccurate",
42
- "description": "Product search returns irrelevant results and misses exact matches",
43
- "severity": "high",
44
- "status": "open",
45
- "reportedBy": "C-555",
46
- "reportedAt": "2025-01-16T11:45:00Z",
47
- "category": "search",
48
- "affectedUsers": 300,
49
- "region": "global"
50
- },
51
- {
52
- "issueId": "ISS-005",
53
- "title": "Mobile app crashes on iOS",
54
- "description": "App crashes when attempting to view order history on iOS 17",
55
- "severity": "critical",
56
- "status": "in_progress",
57
- "reportedBy": "C-888",
58
- "reportedAt": "2025-01-17T08:00:00Z",
59
- "category": "mobile",
60
- "affectedUsers": 500,
61
- "region": "global"
62
- },
63
- {
64
- "issueId": "ISS-006",
65
- "title": "Slow page load times",
66
- "description": "Homepage and category pages taking 10+ seconds to load during peak hours",
67
- "severity": "medium",
68
- "status": "open",
69
- "reportedBy": "C-777",
70
- "reportedAt": "2025-01-16T19:30:00Z",
71
- "category": "performance",
72
- "affectedUsers": 1000,
73
- "region": "US-WEST"
74
- },
75
- {
76
- "issueId": "ISS-007",
77
- "title": "Incorrect tax calculation",
78
- "description": "Sales tax is being calculated incorrectly for orders in California",
79
- "severity": "high",
80
- "status": "investigating",
81
- "reportedBy": "C-456",
82
- "reportedAt": "2025-01-15T13:20:00Z",
83
- "category": "billing",
84
- "affectedUsers": 75,
85
- "region": "US-WEST"
86
- },
87
- {
88
- "issueId": "ISS-008",
89
- "title": "Wishlist items disappearing",
90
- "description": "Items added to wishlist are randomly being removed after page refresh",
91
- "severity": "low",
92
- "status": "open",
93
- "reportedBy": "C-999",
94
- "reportedAt": "2025-01-14T16:45:00Z",
95
- "category": "feature",
96
- "affectedUsers": 50,
97
- "region": "global"
98
- }
99
- ]
@@ -1,7 +0,0 @@
1
- # Resetting MFA-secured passwords
2
-
3
- 1. Validate the caller using two account identifiers and the last successful login timestamp.
4
- 2. Confirm MFA enrollment method (TOTP, push, hardware key) and whether the customer still has access.
5
- 3. If hardware key is lost, create a temporary bypass token valid for 10 minutes and log the issuance in the security ledger.
6
- 4. Require the customer to set a new password that meets the 14-character complexity policy.
7
- 5. Close the case by attaching the bypass confirmation ID and notifying the security operations channel.
@@ -1,7 +0,0 @@
1
- # Refund eligibility decision tree
2
-
3
- - Verify the subscription tier and billing term. Enterprise annual contracts require finance approval.
4
- - If the incident is tagged as "platform outage", issue a full credit prorated for downtime.
5
- - For shipping or activation delays, offer expedited onboarding plus a 20% credit if the customer is GOLD or higher.
6
- - Always document the root cause category and attach supporting telemetry to the refund record.
7
- - Escalate to the duty manager if the requested credit exceeds $5,000 USD.
@@ -1,9 +0,0 @@
1
- # Stabilizing API latency regressions
2
-
3
- Monitoring detected elevated p95 latency across the public REST API. Follow this checklist:
4
-
5
- 1. Inspect deployment history for the impacted service and roll back if a canary exceeded SLOs.
6
- 2. Flush regional CDN caches and confirm cache hit ratios rebound above 92%.
7
- 3. Capture thread dumps from the application nodes to identify blocking calls.
8
- 4. Increase autoscaling floor by two nodes per region while the investigation runs.
9
- 5. Post an update to the status page every 30 minutes until latency returns under 250 ms.
@@ -1,25 +0,0 @@
1
- {
2
- "snippets": [
3
- {
4
- "id": "KB-001",
5
- "title": "Resetting MFA-secured passwords",
6
- "tags": ["identity", "password", "mfa"],
7
- "path": "docs/kb-001.md",
8
- "summary": "Runbook for agents guiding customers through MFA password reset and device verification."
9
- },
10
- {
11
- "id": "KB-002",
12
- "title": "Refund eligibility decision tree",
13
- "tags": ["billing", "refund", "policy"],
14
- "path": "docs/kb-002.md",
15
- "summary": "Policy matrix for issuing refunds based on subscription tier and issue category."
16
- },
17
- {
18
- "id": "KB-003",
19
- "title": "Stabilizing API latency regressions",
20
- "tags": ["incident", "performance", "api"],
21
- "path": "docs/kb-003.md",
22
- "summary": "Checklist for diagnosing elevated API latency including caching, rollout, and alerting steps."
23
- }
24
- ]
25
- }
package/data/orders.json DELETED
@@ -1,106 +0,0 @@
1
- [
2
- {
3
- "orderId": "O-2025-001",
4
- "customerId": "C-789",
5
- "customerName": "John Smith",
6
- "orderDate": "2025-01-10",
7
- "status": "delivered",
8
- "total": 299.99,
9
- "items": [
10
- { "sku": "PROD-001", "name": "Wireless Headphones", "quantity": 1, "price": 149.99 },
11
- { "sku": "PROD-002", "name": "Phone Case", "quantity": 2, "price": 75.00 }
12
- ],
13
- "shippingAddress": {
14
- "street": "123 Main St",
15
- "city": "New York",
16
- "state": "NY",
17
- "zip": "10001",
18
- "country": "US"
19
- },
20
- "region": "US-EAST"
21
- },
22
- {
23
- "orderId": "O-2025-002",
24
- "customerId": "C-456",
25
- "customerName": "Sarah Johnson",
26
- "orderDate": "2025-01-12",
27
- "status": "shipped",
28
- "total": 599.00,
29
- "items": [
30
- { "sku": "PROD-003", "name": "Laptop Stand", "quantity": 1, "price": 89.00 },
31
- { "sku": "PROD-004", "name": "External Monitor", "quantity": 1, "price": 499.00 },
32
- { "sku": "PROD-005", "name": "USB-C Cable", "quantity": 2, "price": 11.00 }
33
- ],
34
- "shippingAddress": {
35
- "street": "456 Oak Ave",
36
- "city": "San Francisco",
37
- "state": "CA",
38
- "zip": "94102",
39
- "country": "US"
40
- },
41
- "region": "US-WEST"
42
- },
43
- {
44
- "orderId": "O-2025-003",
45
- "customerId": "C-123",
46
- "customerName": "Michael Brown",
47
- "orderDate": "2025-01-14",
48
- "status": "processing",
49
- "total": 1299.99,
50
- "items": [
51
- { "sku": "PROD-006", "name": "Gaming Keyboard", "quantity": 1, "price": 199.99 },
52
- { "sku": "PROD-007", "name": "Gaming Mouse", "quantity": 1, "price": 99.99 },
53
- { "sku": "PROD-008", "name": "Gaming Chair", "quantity": 1, "price": 999.99 }
54
- ],
55
- "shippingAddress": {
56
- "street": "789 Elm St",
57
- "city": "Chicago",
58
- "state": "IL",
59
- "zip": "60601",
60
- "country": "US"
61
- },
62
- "region": "US-CENTRAL"
63
- },
64
- {
65
- "orderId": "O-2025-004",
66
- "customerId": "C-789",
67
- "customerName": "John Smith",
68
- "orderDate": "2025-01-15",
69
- "status": "cancelled",
70
- "total": 49.99,
71
- "items": [
72
- { "sku": "PROD-009", "name": "Screen Protector", "quantity": 1, "price": 24.99 },
73
- { "sku": "PROD-010", "name": "Cleaning Kit", "quantity": 1, "price": 24.99 }
74
- ],
75
- "shippingAddress": {
76
- "street": "123 Main St",
77
- "city": "New York",
78
- "state": "NY",
79
- "zip": "10001",
80
- "country": "US"
81
- },
82
- "region": "US-EAST",
83
- "cancellationReason": "Customer requested"
84
- },
85
- {
86
- "orderId": "O-2025-005",
87
- "customerId": "C-555",
88
- "customerName": "Emily Davis",
89
- "orderDate": "2025-01-16",
90
- "status": "delivered",
91
- "total": 399.50,
92
- "items": [
93
- { "sku": "PROD-011", "name": "Wireless Charger", "quantity": 2, "price": 79.99 },
94
- { "sku": "PROD-012", "name": "Power Bank", "quantity": 1, "price": 59.99 },
95
- { "sku": "PROD-013", "name": "Car Mount", "quantity": 3, "price": 59.85 }
96
- ],
97
- "shippingAddress": {
98
- "street": "321 Pine Rd",
99
- "city": "Seattle",
100
- "state": "WA",
101
- "zip": "98101",
102
- "country": "US"
103
- },
104
- "region": "US-WEST"
105
- }
106
- ]
@@ -1,144 +0,0 @@
1
- # ACM Examples — Architecture & Implementation Blueprint
2
-
3
- Last updated: 2025-10-06
4
-
5
- ## Overview
6
-
7
- This blueprint translates the release implementation plan into concrete module boundaries, task/tool specifications, and planner wiring for the five flagship examples. The intent is to keep the package modular while maximizing reuse of shared registries, data loaders, and context adapters.
8
-
9
- Each example is delivered as a capability bundle exposing:
10
-
11
- - A goal definition consumable by the `ACMFramework` (#goal slug + metadata).
12
- - Context assembly helpers that hydrate packets from synthetic data and Nucleus directives.
13
- - Tool implementations (pure + LLM backed) with deterministic fallbacks for unit testing.
14
- - Task specifications with policy bindings and ledger annotations.
15
- - Verification hooks and replay assertions validated via `tests/<example>.test.ts`.
16
-
17
- ## Shared Components
18
-
19
- | Component | Location | Notes |
20
- |-----------|----------|-------|
21
- | `createDemoFramework` | `src/framework.ts` (existing) | Updated to register new capabilities and directive handlers. |
22
- | Data loaders | `src/data/*.ts` | Already implemented; expose typed helpers and caching. |
23
- | Directive router | `src/context/directives.ts` (new) | Centralizes prefix → loader/provider mapping. |
24
- | Policy engine extensions | `src/policy/examples-policy.ts` (new) | Encapsulates per-example policy checks (SLA, entitlement guard, etc.). |
25
- | Verification sheets | `src/verification/<example>.ts` (new) | Deterministic validation of task outputs. |
26
- | Capability registry | `src/registry/examples.ts` (new) | Registers tasks/tools/capabilities; re-exported through public surface. |
27
-
28
- All tools should be authored under `src/tools/<example>/` and tasks under `src/tasks/<example>/`. Shared utility abstractions (e.g., scoring, formatting, result types) live in `src/lib/`.
29
-
30
- ## Example Blueprints
31
-
32
- ### 1. Customer Entitlement Checker (`entitlement`)
33
-
34
- - **Goal slug:** `entitlement-check`
35
- - **Context builders:**
36
- - `buildEntitlementContext(customerId)` fetches customer + policy snapshots using `getCustomerProfile` and `getPolicyByTier`.
37
- - Directive prefix `crm:` resolves to `fetchCustomerProfileTool` for nucleus preflight.
38
- - **Tools:**
39
- - `fetchCustomerProfileTool` — deterministic JSON lookup.
40
- - `evaluateEntitlementTool` — pure function comparing policy rules (tier, compliance flags) with customer state; returns `{decision, rationale}`.
41
- - `notifySupervisorTool` — simulated side-effect; no-op in tests, emits ledger entry `NOTIFICATION_ENQUEUED` when `decision === "deny"`.
42
- - **Tasks:**
43
- 1. `RetrieveCustomerTask` (uses `fetchCustomerProfileTool`).
44
- 2. `EvaluateEntitlementTask` (uses `evaluateEntitlementTool`; guard `decision === "allow"`).
45
- 3. `SupervisorNotificationTask` (conditional on guard failure).
46
- - **Policy & verification:**
47
- - Policy: ensure customer tier >= required tier; add ledger note `POLICY_FAIL` on violation.
48
- - Verification: result payload must include `decision`, `rationale`, and `policyTrace` entries.
49
- - **Planner wiring:** linear plan with guard-based branch; replay should include both primary path and optional compensation branch.
50
-
51
- ### 2. Knowledge Snippet Summarizer (`knowledge`)
52
-
53
- - **Goal slug:** `knowledge-summarize`
54
- - **Context builders:**
55
- - `buildKnowledgeContext(query)` indexing metadata for candidate docs.
56
- - Directive prefix `kb:` loads Markdown snippets via `getKnowledgeDoc` (already piped through loader with hash-based caching).
57
- - **Tools:**
58
- - `searchKnowledgeTool` — wrap reusable BM25 implementation; returns ranked hits.
59
- - `summarizeSnippetTool` — nucleus-backed summarizer with deterministic small-model fallback for tests.
60
- - `suggestFollowupsTool` — optional; uses deterministic heuristics derived from doc tags.
61
- - **Tasks:**
62
- 1. `SearchKnowledgeTask` (guard: must yield ≥1 hit, otherwise `KnowledgeNotFound` branch calling `suggestFollowupsTool` with escalation instructions).
63
- 2. `SummarizeSnippetTask` (streams summary paragraphs; attaches tokens to replay).
64
- 3. `SuggestFollowupsTask` (optional post-processing).
65
- - **Policy & verification:**
66
- - Policy ensures summarizer references source doc ID in output.
67
- - Verification asserts summary length bounds and includes bullet follow-ups when branch executed.
68
-
69
- ### 3. Incident Triage Router (`incident-router`)
70
-
71
- - **Goal slug:** `incident-triage`
72
- - **Context builders:**
73
- - `buildIncidentContext(incidentId)` merges incident record, routing matrix, and SLA thresholds.
74
- - Directive prefix `inc:` fetches incident; `routing:` fetches matrix slice.
75
- - **Tools:**
76
- - `classifySeverityTool` — deterministic scoring (based on impact, urgency, SLA fields).
77
- - `selectQueueTool` — maps severity + service area to queue; returns queue ID with rationale.
78
- - `escalateIncidentTool` — logs escalation event (appends to `data/incidents/escalations.log` or memory stub in tests).
79
- - **Tasks:**
80
- 1. `AssessIncidentTask` → severity classification.
81
- 2. `RouteIncidentTask` → queue selection with guard verifying queue exists.
82
- 3. `EscalateIncidentTask` → executes when severity >= `high` and queue flagged `needsEscalation`.
83
- - **Policy & verification:**
84
- - Policy ensures high severity incidents trigger escalation ledger entry.
85
- - Verification checks final payload includes `assignedQueue` and `nextAction` fields.
86
-
87
- ### 4. Invoice Verification Pipeline (`invoice-verification`)
88
-
89
- - **Goal slug:** `invoice-verify`
90
- - **Context builders:**
91
- - `buildInvoiceContext(invoiceId)` loads invoice + matching PO; attaches discrepancy heuristics.
92
- - Directive prefix `erp:` fetches purchase order data by PO ID, using `getPurchaseOrder` and caching.
93
- - **Tools:**
94
- - `fetchInvoiceTool` & `fetchPurchaseOrderTool` — deterministic lookups.
95
- - `compareLineItemsTool` — wraps existing helper, returning discrepancy list with typed reasons.
96
- - `recordFindingsTool` — writes deterministic report JSON (timestamp stubbed) to context attachments.
97
- - **Tasks:**
98
- 1. `LoadInvoiceTask` → fetch invoice details.
99
- 2. `CrossCheckPurchaseOrderTask` → fetch PO.
100
- 3. `ReconcileLineItemsTask` → produce discrepancy list; guard triggers remediation branch if list non-empty.
101
- 4. `RecordFindingsTask` → persist outputs (always runs, but includes branch metadata).
102
- 5. `InitiateRemediationTask` (optional) → triggered when discrepancies exist; simulates ticket creation.
103
- - **Policy & verification:**
104
- - Policy ensures total variance <= configured tolerance; violate → ledger `POLICY_VARIANCE`.
105
- - Verification asserts report includes `status`, `discrepancies[]`, and `nextSteps`.
106
-
107
- ### 5. Agent Coaching Feedback Loop (`coaching`)
108
-
109
- - **Goal slug:** `agent-coaching`
110
- - **Context builders:**
111
- - `buildCoachingContext(callId)` loads transcript metadata and scoring rubric.
112
- - Directive prefix `transcript:` retrieves transcript body; optional `csat:` directive fetches historic CSAT metrics.
113
- - **Tools:**
114
- - `analyzeTranscriptTool` — sentiment + compliance analysis (deterministic scoring with heuristics; optionally seeds nucleus call for narrative feedback).
115
- - `generateFeedbackTool` — nucleus-backed structured feedback (with fallback template).
116
- - `logCoachingNoteTool` — deterministic logging (appends to synthetic CRM store or returns stub ID).
117
- - **Tasks:**
118
- 1. `AnalyzeTranscriptTask` → produce structured metrics (`sentimentScore`, `complianceFlags`).
119
- 2. `GenerateFeedbackTask` → produce human-readable coaching tips anchored to metrics.
120
- 3. `LogCoachingNoteTask` → persist feedback; guard ensures compliance failures trigger escalation note with supervisor mention.
121
- - **Policy & verification:**
122
- - Policy: if compliance failure detected, ensure escalation note created.
123
- - Verification: final payload contains `feedbackSummary`, `actionItems`, and `logReference`.
124
-
125
- ## Planner & CLI Integration
126
-
127
- - Extend goal registry at `src/goals/index.ts` with five new entries referencing helper builders.
128
- - Update CLI selector in `bin/interactive.tsx` and `bin/acm-demo.ts` to expose new options (`--goal` values + interactive menu items).
129
- - Provide shared helper `resolveExampleGoal(slug)` to map CLI input to goal factories.
130
-
131
- ## Testing Strategy
132
-
133
- - Add integration suites under `tests/examples/` with one spec per example.
134
- - Mock nucleus responses using existing harness; for deterministic fallbacks, set `NUCLEUS_MODE=offline` in tests.
135
- - Validate replay bundles by asserting JSON schema + verifying ledger entries.
136
- - Include snapshot testing (where stable) for final task payloads.
137
-
138
- ## Next Steps Checklist
139
-
140
- 1. Scaffold shared modules (`context/directives.ts`, `registry/examples.ts`, `policy/examples-policy.ts`).
141
- 2. Implement entitlement capability end-to-end as reference pattern.
142
- 3. Replicate pattern for the remaining four examples, factoring shared utilities as they emerge.
143
- 4. Wire CLI + goal registry, then author integration tests.
144
- 5. Update documentation & READMEs with usage instructions.