@cgh567/agent 2.4.0 → 2.4.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 (146) hide show
  1. package/bin/helios +0 -0
  2. package/bin/helios-rpc-node-wrapper.cjs +0 -0
  3. package/bin/helios-rpc-wrapper.sh +0 -0
  4. package/daemon/adapters/helios-rpc-adapter.js +47 -25
  5. package/daemon/config/com.familiar.helios-daemon.plist +5 -0
  6. package/daemon/config/helios-daemon.service +4 -0
  7. package/daemon/context-enrichment.js +59 -21
  8. package/daemon/helios-api.js +149 -37
  9. package/daemon/helios-company-daemon.js +516 -124
  10. package/daemon/lib/harada/cascade-judge.js +12 -50
  11. package/daemon/lib/harada/mandala.js +20 -0
  12. package/daemon/lib/harada/pillar-dispatcher.js +1 -1
  13. package/daemon/lib/harada/project-factory.js +7 -2
  14. package/daemon/lib/hbo-bridge.js +31 -12
  15. package/daemon/lib/helios-hitl-host.js +15 -2
  16. package/daemon/lib/hitl-interaction-service.js +0 -0
  17. package/daemon/lib/memgraph-verify.js +38 -33
  18. package/daemon/lib/project-drift-detector.js +7 -17
  19. package/daemon/lib/project-semantic-updater.js +1 -14
  20. package/daemon/routes/channels.js +10 -5
  21. package/daemon/routes/harada-map.js +11 -48
  22. package/daemon/routes/hbo.js +89 -28
  23. package/daemon/routes/hitl.js +0 -0
  24. package/daemon/routes/project.js +4 -3
  25. package/daemon/routes/wizard.js +11 -4
  26. package/daemon/schema-migrations-hitl.js +0 -0
  27. package/extensions/001-tool-output-cap.ts +0 -0
  28. package/extensions/context-compaction.ts +45 -26
  29. package/extensions/cortex/activation-bridge.ts +5 -0
  30. package/extensions/cortex/learn.ts +26 -0
  31. package/extensions/email/backfill.ts +0 -0
  32. package/extensions/helios-governance/analysis/ambiguity.ts +0 -0
  33. package/extensions/helios-governance/analysis/compliance.ts +0 -0
  34. package/extensions/helios-governance/analysis/long-task-detector.ts +0 -0
  35. package/extensions/helios-governance/analysis/output-contract.ts +0 -0
  36. package/extensions/helios-governance/analysis/patterns.ts +0 -0
  37. package/extensions/helios-governance/analysis/preflight.ts +0 -0
  38. package/extensions/helios-governance/analysis/recurring-violations.ts +0 -0
  39. package/extensions/helios-governance/analysis/task-classification.ts +0 -0
  40. package/extensions/helios-governance/analysis/task-intent.ts +0 -0
  41. package/extensions/helios-governance/gates/high-impact.ts +1 -1
  42. package/extensions/helios-governance/handlers/_jiti-require.ts +15 -8
  43. package/extensions/helios-governance/handlers/proxy-test-detector.ts +0 -0
  44. package/extensions/hema-dispatch-v3/graph-memory.ts +10 -0
  45. package/extensions/hema-dispatch-v3/index.ts +59 -40
  46. package/extensions/lib/elo-engine.js +0 -0
  47. package/extensions/lib/elo-engine.test.js +0 -0
  48. package/extensions/memgraph-autostart.ts +13 -0
  49. package/extensions/neuroplastic-eval.ts +0 -0
  50. package/extensions/shadow-loop/index.ts +0 -0
  51. package/lib/brain-v2-budget.js +0 -0
  52. package/lib/brain-v2-circuit-breaker.js +0 -0
  53. package/lib/brain-v2.js +0 -0
  54. package/lib/broker/adaptive-throttle.js +0 -0
  55. package/lib/broker/batch-coalescer.js +0 -0
  56. package/lib/broker/bulkhead.js +0 -0
  57. package/lib/broker/channel-registry.js +0 -0
  58. package/lib/broker/circuit-breaker.js +0 -0
  59. package/lib/broker/evidence-cache.js +0 -0
  60. package/lib/broker/health-monitor.js +0 -0
  61. package/lib/broker/mage-queue.js +0 -0
  62. package/lib/broker/priority-queue.js +0 -0
  63. package/lib/broker/server.js.bak-error2-fix +0 -0
  64. package/lib/broker/session-registry.js +0 -0
  65. package/lib/broker/singleton-timers.js +0 -0
  66. package/lib/broker/types.d.ts +0 -0
  67. package/lib/broker/vegas-limit.js +0 -0
  68. package/lib/compression/dist/ccr-store.js +74 -0
  69. package/lib/compression/dist/content-router.js +115 -0
  70. package/lib/compression/dist/pipeline.js +113 -0
  71. package/lib/compression/dist/server.js +265 -0
  72. package/lib/compression/dist/smart-crusher.js +251 -0
  73. package/lib/context-budget.ts +0 -0
  74. package/lib/context-firewall.js +0 -0
  75. package/lib/crm/integration/triage-bridge.js +0 -0
  76. package/lib/email-utils.ts +0 -0
  77. package/lib/eval/__tests__/preflight-checker.test.ts +0 -0
  78. package/lib/eval/__tests__/task-instruction-parser.test.ts +0 -0
  79. package/lib/eval/__tests__/verifier-runner.test.ts +0 -0
  80. package/lib/eval/index.ts +0 -0
  81. package/lib/eval/preflight-checker.ts +0 -0
  82. package/lib/eval/task-domain-classifier.ts +0 -0
  83. package/lib/eval/task-instruction-parser.ts +0 -0
  84. package/lib/eval/verifier-runner.ts +0 -0
  85. package/lib/event-bus.d.ts +0 -0
  86. package/lib/governance-context-selector.ts +0 -0
  87. package/lib/graph/generate-extension-embeddings.js +0 -0
  88. package/lib/graph/generate-static-embeddings.js +0 -0
  89. package/lib/graph/lib/utils.js +1 -1
  90. package/lib/graph-audit.d.ts +0 -0
  91. package/lib/mesh-circuit-breaker.js +0 -0
  92. package/lib/mission-loop/lesson-extractor.ts +0 -0
  93. package/lib/mission-loop/mental-model-scorer.ts +0 -0
  94. package/lib/mission-loop/occ-detector.ts +0 -0
  95. package/lib/mission-loop/query-variants.ts +0 -0
  96. package/lib/mission-loop/verifier-check.ts +0 -0
  97. package/lib/skill-reference-builder.ts +0 -0
  98. package/lib/telemetry/token-breakdown.ts +0 -0
  99. package/lib/tool-compressor.ts +0 -0
  100. package/lib/triage-core/legal-routing.ts +0 -0
  101. package/lib/triage-core/mental-model/dunbar-classifier.ts +0 -0
  102. package/lib/triage-core/mental-model/enrich-all.ts +0 -0
  103. package/lib/triage-core/mental-model/identity-resolver.ts +0 -0
  104. package/lib/triage-core/mental-model/key-facts.ts +0 -0
  105. package/lib/triage-core/mental-model/model-assembler.ts +0 -0
  106. package/lib/triage-core/orchestrator.ts +0 -0
  107. package/lib/triage-core/orchestrator.ts.bak-r005-r006-r008 +0 -0
  108. package/package.json +10 -4
  109. package/skills/helios-business-operator/services/signals/upwork-signals.js +0 -0
  110. package/skills/talisman-ceo/SKILL.md +23 -25
  111. package/skills/talisman-comms/SKILL.md +5 -5
  112. package/skills/talisman-engineering/SKILL.md +5 -5
  113. package/skills/talisman-finance/SKILL.md +10 -8
  114. package/skills/talisman-marketing/SKILL.md +10 -10
  115. package/skills/talisman-sales/SKILL.md +12 -15
  116. package/skills/talisman-support/SKILL.md +5 -5
  117. package/agents/business/talisman-ceo.md +0 -183
  118. package/agents/business/talisman-comms.md +0 -257
  119. package/agents/business/talisman-cto.md +0 -153
  120. package/agents/business/talisman-finance.md +0 -246
  121. package/agents/business/talisman-marketing.md +0 -240
  122. package/agents/business/talisman-sales.md +0 -242
  123. package/agents/business/talisman-support.md +0 -236
  124. package/daemon/lib/approval-expiry.js +0 -162
  125. package/daemon/lib/blast-radius-analyzer.js +0 -75
  126. package/daemon/lib/domain-bootstrap-orchestrator.js +0 -267
  127. package/daemon/lib/forensic-log.js +0 -113
  128. package/daemon/lib/goal-research-pipeline.js +0 -644
  129. package/daemon/lib/harada/cascade-research-dispatcher.js +0 -261
  130. package/daemon/lib/headroom-middleware.js +0 -167
  131. package/daemon/lib/headroom-proxy-manager.js +0 -623
  132. package/daemon/lib/hed-engine.js +0 -307
  133. package/daemon/lib/mental-model-cache.js +0 -96
  134. package/daemon/lib/project-factory.js +0 -47
  135. package/daemon/lib/session-log-reader.js +0 -93
  136. package/daemon/routes/hed.js +0 -133
  137. package/lib/graph/learning/headroom-learn-bridge.js +0 -215
  138. package/skills/helios-bookkeeping/SKILL.md +0 -321
  139. package/skills/helios-briefer/SKILL.md +0 -44
  140. package/skills/helios-client-relations/SKILL.md +0 -322
  141. package/skills/helios-personal-triager/SKILL.md +0 -45
  142. package/skills/helios-recruitment/SKILL.md +0 -317
  143. package/skills/helios-relationship-nudger/SKILL.md +0 -77
  144. package/skills/helios-researcher/SKILL.md +0 -44
  145. package/skills/helios-scheduler/SKILL.md +0 -58
  146. package/skills/helios-tax-analyst/SKILL.md +0 -280
@@ -1,215 +0,0 @@
1
- 'use strict';
2
-
3
- /**
4
- * lib/graph/learning/headroom-learn-bridge.js
5
- *
6
- * Bridges headroom's session failure-learning system with Helios's Memgraph
7
- * learning graph. Called asynchronously from the RETROSPECTIVE phase after
8
- * each CausalLesson extraction.
9
- *
10
- * Pipeline:
11
- * 1. Run `headroom learn --apply --project {helios-agent-root} --target AGENTS.md`
12
- * using the vendored headroom package at vendor/headroom-proxy/
13
- * 2. headroom learn scans Pi session logs (SQLite DB + tool-output blobs)
14
- * and writes corrections to AGENTS.md (marker-delimited, git-tracked)
15
- * 3. Parse corrections from AGENTS.md headroom:learn markers
16
- * 4. Write corrections as KnowledgeAsset nodes to Memgraph
17
- * 5. KnowledgeAsset nodes surface via biz-lesson-recall + lesson-recall channels
18
- * in future sessions
19
- *
20
- * Why this improves the whole system (not just one company):
21
- * - Structural patterns (path corrections, command patterns, search scope fixes)
22
- * are cross-company: they describe helios-agent behavior, not company data
23
- * - KnowledgeAsset confidence increases each time a pattern is reinforced
24
- * - Corrections in AGENTS.md are git-tracked and manually reviewable
25
- * - The global AGENTS.md (~/.config/opencode/AGENTS.md) is NEVER touched
26
- *
27
- * Debounce: runs at most once per 5 minutes across all sessions to avoid
28
- * hammering the Pi session log scanner.
29
- */
30
-
31
- const path = require('path');
32
- const fs = require('fs');
33
- const crypto = require('crypto');
34
- const { execFile } = require('child_process');
35
-
36
- const HELIOS_ROOT = process.env.HELIOS_ROOT || path.resolve(__dirname, '..', '..', '..');
37
- const AGENTS_MD = path.join(HELIOS_ROOT, 'AGENTS.md');
38
- const VENDOR_PATH = path.join(HELIOS_ROOT, 'vendor', 'headroom-proxy');
39
- const MARKER_START = '<!-- headroom:learn:start -->';
40
- const MARKER_END = '<!-- headroom:learn:end -->';
41
- const DEBOUNCE_MS = 5 * 60 * 1000; // 5 minutes between runs
42
-
43
- let _lastRunAt = 0;
44
-
45
- /**
46
- * Main entry point. Called from retrospective.ts after CausalLesson extraction.
47
- * @param {Function} mgQueryAsync - Memgraph query function
48
- * @param {string} sessionId - Current session ID
49
- * @param {string} missionRunId - Current mission run ID
50
- */
51
- async function runBridge(mgQueryAsync, sessionId, missionRunId) {
52
- const now = Date.now();
53
- if (now - _lastRunAt < DEBOUNCE_MS) return;
54
- _lastRunAt = now;
55
-
56
- // Verify vendor path exists before attempting anything
57
- if (!fs.existsSync(VENDOR_PATH)) {
58
- process.stderr.write('[headroom-learn-bridge] vendor/headroom-proxy not found — skipping learn run\n');
59
- return;
60
- }
61
-
62
- try {
63
- // Step 1: Run headroom learn
64
- await _runHeadroomLearn();
65
-
66
- // Step 2: Parse corrections from AGENTS.md
67
- const corrections = _parseCorrections();
68
- if (!corrections.length) {
69
- process.stderr.write('[headroom-learn-bridge] No corrections found in AGENTS.md markers\n');
70
- return;
71
- }
72
-
73
- // Step 3: Write to Memgraph
74
- await _writeToMemgraph(mgQueryAsync, corrections, sessionId, missionRunId);
75
-
76
- process.stderr.write(
77
- `[headroom-learn-bridge] Wrote ${corrections.length} corrections to Memgraph KnowledgeAsset nodes\n`
78
- );
79
- } catch (err) {
80
- // Completely non-fatal — never block RETROSPECTIVE phase
81
- process.stderr.write(`[headroom-learn-bridge] Failed (non-fatal): ${err.message}\n`);
82
- }
83
- }
84
-
85
- /**
86
- * Run `headroom learn --apply` using the vendored package.
87
- * Writes to AGENTS.md with <!-- headroom:learn:start/end --> markers.
88
- * Only the marker block is replaced — existing AGENTS.md content is preserved.
89
- */
90
- function _runHeadroomLearn() {
91
- return new Promise((resolve, reject) => {
92
- const pythonBin = process.env.HEADROOM_PYTHON || 'python3';
93
-
94
- // Use CLAUDE.local.md as target to avoid polluting shared AGENTS.md
95
- // The corrections are written to a separate local file, then we parse
96
- // them and write to Memgraph. Per-repo AGENTS.md gets the marker block.
97
- const args = [
98
- '-m', 'headroom.learn',
99
- '--apply',
100
- '--project', HELIOS_ROOT,
101
- '--target', 'AGENTS.md', // per-repo AGENTS.md (NOT global ~/.config/opencode/AGENTS.md)
102
- ];
103
-
104
- execFile(pythonBin, args, {
105
- cwd: VENDOR_PATH,
106
- env: {
107
- ...process.env,
108
- PYTHONPATH: VENDOR_PATH,
109
- HEADROOM_TELEMETRY: 'off',
110
- },
111
- timeout: 120_000, // 2-minute timeout (session log scanning can be slow on large projects)
112
- }, (err, stdout, stderr) => {
113
- if (err) {
114
- // Non-zero exit is common when no sessions have been scanned yet
115
- // Only reject on hard failures (ENOENT, etc.)
116
- if (err.code === 'ENOENT') {
117
- return reject(new Error(`Python not found: ${pythonBin}`));
118
- }
119
- // For other errors, log but resolve — partial output may still be useful
120
- if (stderr) process.stderr.write(`[headroom-learn] ${stderr.slice(0, 500)}\n`);
121
- return resolve(null); // resolve, not reject
122
- }
123
- if (stdout) process.stderr.write(`[headroom-learn] ${stdout.slice(0, 200)}\n`);
124
- resolve(null);
125
- });
126
- });
127
- }
128
-
129
- /**
130
- * Parse the headroom:learn marker block from AGENTS.md.
131
- * Returns an array of { category, content } corrections.
132
- */
133
- function _parseCorrections() {
134
- try {
135
- if (!fs.existsSync(AGENTS_MD)) return [];
136
- const content = fs.readFileSync(AGENTS_MD, 'utf-8');
137
- const start = content.indexOf(MARKER_START);
138
- const end = content.indexOf(MARKER_END);
139
- if (start === -1 || end === -1 || end <= start) return [];
140
-
141
- const block = content.slice(start + MARKER_START.length, end);
142
- return _parseMarkdownBlock(block);
143
- } catch {
144
- return [];
145
- }
146
- }
147
-
148
- /**
149
- * Parse markdown sections into structured corrections.
150
- * Headings become categories; bullet items become corrections.
151
- */
152
- function _parseMarkdownBlock(markdown) {
153
- const corrections = [];
154
- const lines = markdown.split('\n');
155
- let currentCategory = 'general';
156
-
157
- for (const line of lines) {
158
- const trimmed = line.trim();
159
- if (trimmed.startsWith('### ')) {
160
- currentCategory = trimmed.slice(4).toLowerCase().replace(/\s+/g, '-').replace(/[^a-z0-9-]/g, '');
161
- } else if (trimmed.startsWith('## ') && !trimmed.startsWith('### ')) {
162
- currentCategory = trimmed.slice(3).toLowerCase().replace(/\s+/g, '-').replace(/[^a-z0-9-]/g, '');
163
- } else if (trimmed.startsWith('- ') && trimmed.length > 5) {
164
- const content = trimmed.slice(2).trim();
165
- // Filter out boilerplate / empty corrections
166
- if (content.length >= 15 && !content.startsWith('*Auto-generated')) {
167
- corrections.push({ category: currentCategory, content });
168
- }
169
- }
170
- }
171
- return corrections;
172
- }
173
-
174
- /**
175
- * Write corrections as KnowledgeAsset nodes to Memgraph.
176
- * Uses MERGE on a stable content-hash ID for idempotency.
177
- * Confidence increases each time the same pattern is reinforced.
178
- */
179
- async function _writeToMemgraph(mgQueryAsync, corrections, sessionId, missionRunId) {
180
- for (const correction of corrections) {
181
- const id = 'headroom-learn:' + crypto.createHash('sha256')
182
- .update(correction.content).digest('hex').slice(0, 16);
183
-
184
- await mgQueryAsync(`
185
- MERGE (ka:KnowledgeAsset {id: $id})
186
- ON CREATE SET
187
- ka.type = 'headroom-correction',
188
- ka.category = $category,
189
- ka.content = $content,
190
- ka.confidence = 0.65,
191
- ka.source = 'headroom-learn',
192
- ka.sessionId = $sessionId,
193
- ka.missionRunId = $missionRunId,
194
- ka.createdAt = localdatetime(),
195
- ka.lastSeenAt = localdatetime()
196
- ON MATCH SET
197
- ka.confidence = CASE
198
- WHEN ka.confidence < 0.95 THEN ka.confidence + 0.05
199
- ELSE 0.95
200
- END,
201
- ka.lastSeenAt = localdatetime(),
202
- ka.updatedAt = localdatetime(),
203
- ka.sessionId = $sessionId,
204
- ka.missionRunId = $missionRunId
205
- `, {
206
- id,
207
- category: correction.category,
208
- content: correction.content,
209
- sessionId: sessionId ?? 'unknown',
210
- missionRunId: missionRunId ?? 'unknown',
211
- });
212
- }
213
- }
214
-
215
- module.exports = { runBridge };
@@ -1,321 +0,0 @@
1
- ---
2
- name: helios-bookkeeping
3
- description: "Bookkeeping agent — transaction recording, bank reconciliation, accounts receivable/payable, payroll processing, financial statements, and multi-jurisdiction tax compliance (ZIMRA/IRS/HMRC)."
4
- when: Loaded by the Bookkeeping agent when processing accounting tasks, reconciliation, payroll, tax filings, and financial reporting
5
- adapter:
6
- type: helios_rpc
7
- skills:
8
- - helios-prime
9
- - helios-business-operator
10
- version: 1.0.0
11
- ---
12
-
13
- # Helios Bookkeeping Agent
14
-
15
- You are the **Bookkeeping Agent** for **{{HELIOS_COMPANY_NAME}}**. Your job is to maintain accurate financial records, ensure multi-jurisdiction tax compliance, and produce financial statements that decision-makers can trust.
16
-
17
- > **Scope boundary:** You record and report the financial past and present. You do NOT render legal opinions on tax disputes, advise on criminal tax exposure, or represent clients before tax authorities in contested proceedings. Escalate those to the CEO or a licensed tax professional.
18
-
19
- ---
20
-
21
- ## Mental Model
22
-
23
- `Transaction → Classify → Record (double-entry) → Reconcile → Report → File`
24
-
25
- Bookkeeping is the integrity layer. Every transaction must be captured, classified, and reconciled. Clean books are the foundation for every financial decision — tax filings, investor reporting, loan applications, and business planning.
26
-
27
- ---
28
-
29
- ## Boot Sequence
30
-
31
- On every session start, read company context:
32
-
33
- ```cypher
34
- MATCH (sa:SystemAim {companyId: $cid})
35
- RETURN sa.statement, sa.jurisdiction, sa.fiscalYearEnd, sa.accountingSoftware LIMIT 1
36
- ```
37
-
38
- Use `sa.jurisdiction` to determine which compliance rules apply. Use `sa.accountingSoftware` to guide tool selection (Xero, QuickBooks, Sage, Wave). If unset, ask the CEO.
39
-
40
- ---
41
-
42
- ## Chart of Accounts Structure
43
-
44
- Standard double-entry CoA:
45
-
46
- | Range | Category |
47
- |---|---|
48
- | 1000–1999 | Assets (cash, AR, inventory, equipment) |
49
- | 2000–2999 | Liabilities (AP, loans, accrued expenses) |
50
- | 3000–3999 | Equity (retained earnings, owner equity) |
51
- | 4000–4999 | Revenue (sales, service income, interest) |
52
- | 5000–5999 | Cost of Goods Sold |
53
- | 6000–7999 | Operating Expenses |
54
-
55
- Every transaction touches at least two accounts. Debits must equal credits.
56
-
57
- ---
58
-
59
- ## Month-End Close (11-step protocol)
60
-
61
- Execute in order at the start of each new month:
62
-
63
- 1. **Record all transactions** — every invoice, receipt, bank transfer from prior month entered
64
- 2. **Reconcile all bank accounts** — match every ledger entry against bank statement line by line
65
- 3. **Reconcile credit cards** — same process for all company cards
66
- 4. **Review AR aging** — aging report; initiate collections for 30+ day invoices
67
- 5. **Review AP** — confirm all vendor invoices recorded; schedule payments
68
- 6. **Accrue expenses** — record expenses incurred but not yet invoiced (utilities, salaries, interest)
69
- 7. **Reconcile payroll liabilities** — confirm PAYE/payroll tax deposits match deductions
70
- 8. **Adjust inventory** (if applicable) — count and reconcile physical vs. ledger
71
- 9. **Post adjusting entries** — depreciation, prepaid amortization, deferred revenue
72
- 10. **Generate trial balance** — verify debits = credits; investigate discrepancies
73
- 11. **Produce financial statements** — P&L, Balance Sheet, Cash Flow; compare to prior month and budget
74
-
75
- ---
76
-
77
- ## Bank Reconciliation Protocol
78
-
79
- 1. Get bank statement ending balance
80
- 2. List outstanding checks (issued, not cleared) — subtract from bank balance
81
- 3. List deposits in transit (sent, not yet cleared) — add to bank balance
82
- 4. Adjusted bank balance should equal book (ledger) balance
83
- 5. If discrepancy: investigate bank fees, NSF checks, data entry errors
84
- 6. Document and resolve every reconciling item before closing the period
85
-
86
- ---
87
-
88
- ## Accounts Receivable Management
89
-
90
- ```cypher
91
- MATCH (inv:Invoice {companyId: $cid, status: 'unpaid'})
92
- RETURN inv.clientId, inv.amount, inv.dueDate,
93
- duration.between(date(inv.dueDate), date()).days AS daysOverdue
94
- ORDER BY daysOverdue DESC LIMIT 20
95
- ```
96
-
97
- Aging buckets: Current | 1–30 days | 31–60 days | 61–90 days | 90+ days (at risk)
98
-
99
- **DSO formula:** `(AR Balance / Annual Credit Revenue) × 365`
100
-
101
- Action by bucket:
102
- - 30 days: courtesy reminder
103
- - 60 days: direct contact + payment plan offer
104
- - 90 days: formal demand; escalate write-off decision to CEO
105
-
106
- ---
107
-
108
- ## Accounts Payable Management
109
-
110
- 3-way match before payment: Purchase Order ↔ Invoice ↔ Delivery Receipt
111
-
112
- **DPO formula:** `(AP Balance / COGS) × 365`
113
-
114
- Never pay early unless there is an early-payment discount exceeding the cost of capital. Never pay late — protect vendor relationships.
115
-
116
- ---
117
-
118
- ## Payroll Processing
119
-
120
- 1. Collect timesheets / confirm salaried hours
121
- 2. Calculate gross pay per employee
122
- 3. Apply jurisdiction-specific deductions (see Compliance section)
123
- 4. Calculate employer contributions
124
- 5. Produce payslips
125
- 6. Fund payroll account before payment date
126
- 7. File payroll tax forms on schedule
127
-
128
- ---
129
-
130
- ## Jurisdiction Compliance
131
-
132
- Read `SystemAim.jurisdiction` and apply the correct rules.
133
-
134
- ### Zimbabwe / ZIMRA
135
- **Legal authority:** VAT Act [Chapter 23:12]; Income Tax Act [Chapter 23:06]
136
-
137
- | Obligation | Rate / Form | Deadline |
138
- |---|---|---|
139
- | VAT return (VAT7) | 15.5% standard (amended 1 Jan 2024); 0% exports | **25th of following month** |
140
- | VAT registration threshold | US$25,000 in taxable supplies per 12 months | Register within 14 days |
141
- | PAYE | Progressive: tax-free US$100/mo; top 40% above US$36,001/yr (2025) | **10th of following month** |
142
- | Corporate QPDs | ITF 12B: 10% (25 Mar), 25% (25 Jun), 30% (25 Sep), 35% (20 Dec) | Quarterly |
143
- | Corporate self-assessment | ITF 12C; 25% corporate tax + 3% AIDS Levy | **30 April following year** |
144
- | Tax Clearance (ITF 263) | Required for contracts; 30% withholding if absent | Renew as required |
145
- | Record retention | **6 years minimum** | Income Tax Act §37B |
146
- | Portal | TaRMS: mytaxselfservice.zimra.co.zw | — |
147
-
148
- PAYE calculation: Gross → exempt income → pension deduction → tax tables → credits (elderly/blind US$900/yr; medical $1 credit per $2 paid) → 3% AIDS Levy.
149
-
150
- ### United States / IRS
151
- **Legal authority:** Internal Revenue Code; IRS §6001
152
-
153
- | Obligation | Form | Deadline |
154
- |---|---|---|
155
- | Employer quarterly tax | 941 | Last day of month after quarter end |
156
- | Annual wage statements | W-2 | January 31 |
157
- | Non-employee compensation | 1099-NEC | January 31 |
158
- | Payroll deposits | EFTPS (semiweekly if $50k+ lookback) | Per schedule |
159
- | Record retention | **4 years** after filing 4th quarter | IRS §6001 |
160
-
161
- ### United Kingdom / HMRC
162
- **Legal authority:** MTD Notice 700/22; Companies Act 2006
163
-
164
- | Obligation | Form | Deadline |
165
- |---|---|---|
166
- | VAT return | MTD-compatible software mandatory | **1 month + 7 days after period end** |
167
- | VAT rates | Standard 20%; Reduced 5%; Zero 0% | — |
168
- | Payroll (RTI) | Real Time Information | On or before each payment date |
169
- | Record retention | **6 years** (Companies Act 2006) | — |
170
-
171
- ---
172
-
173
- ## Financial Statements
174
-
175
- **Profit & Loss:** `Revenue − COGS = Gross Profit` → `Gross Profit − Opex = EBITDA` → Net Income
176
- **Balance Sheet:** `Assets = Liabilities + Equity` (point-in-time snapshot)
177
- **Cash Flow:** Operating + Investing + Financing = Net Change in Cash
178
-
179
- ---
180
-
181
- ## Key Metrics
182
-
183
- | Metric | Formula |
184
- |---|---|
185
- | DSO | (AR / Annual Credit Revenue) × 365 |
186
- | DPO | (AP / COGS) × 365 |
187
- | Gross Margin | (Revenue − COGS) / Revenue × 100 |
188
- | Net Burn Rate | Total monthly cash out − monthly revenue |
189
- | Runway | Cash on hand / Monthly net burn |
190
- | Current Ratio | Current Assets / Current Liabilities |
191
-
192
- ---
193
-
194
- ## Ethical Obligations
195
-
196
- - **Confidentiality:** Client financial records strictly confidential — AICPA Code §1.700; ICAZ IFAC Code. Never share without written consent except under lawful subpoena.
197
- - **Accuracy over speed:** Do not estimate when exact figures are available.
198
- - **Unauthorized practice:** Prepare returns, provide planning. Do NOT render legal opinions on disputes or advise on criminal exposure.
199
- - **AML reporting:** Report suspicious transactions per applicable authority (ZIMRA AML; FinCEN SAR; HMRC).
200
- - **Retention:** Never destroy financial records within the mandatory retention window. Minimum 6 years across all three jurisdictions.
201
-
202
- ---
203
-
204
- ## Harada Method & Toyota Production System Integration
205
-
206
- ### PDSA Discipline (every reconciliation cycle)
207
-
208
- Every month-end close follows PDSA:
209
- - **Plan**: Define expected closing balance for each account. Create PDSACycle node.
210
- - **Do**: Execute the 11-step close. Record doSummary with actual balances.
211
- - **Study**: Compare actual vs. expected. Document all reconciling items.
212
- - **Act**: Decide adopt/adapt/abandon. On adopt, extract KnowledgeAsset (e.g., recurring reconciling item patterns, compliance deadline insights).
213
-
214
- ### Andon Cord Protocol
215
-
216
- Pull AndonAlert immediately when:
217
- - Bank reconciliation has unresolved discrepancy > $100 after 48 hours
218
- - Tax filing deadline is within 5 business days and data is missing
219
- - Client invoice is 90+ days overdue with no payment arrangement
220
- - Suspected duplicate payment or fraudulent transaction detected
221
- - ZIMRA / IRS / HMRC notice received requiring response
222
-
223
- ```cypher
224
- CREATE (a:AndonAlert {
225
- id: 'andon:bookkeeping:' + toString(timestamp()),
226
- companyId: $cid, agentId: $agentId,
227
- type: 'bookkeeping_blocker', severity: 'high',
228
- message: $msg, createdAt: datetime(), status: 'open'
229
- })
230
- ```
231
-
232
- ### KnowledgeAsset Lifecycle
233
-
234
- After each close or filing, extract learnings:
235
-
236
- ```cypher
237
- CREATE (ka:KnowledgeAsset {
238
- id: 'ka:bookkeeping:' + $cid + ':' + toString(timestamp()),
239
- companyId: $cid, agentId: $agentId,
240
- topic: $topic, content: $content, confidence: 0.8,
241
- applicableTaskTypes: ['bookkeeping_close', 'tax_filing', 'reconciliation'],
242
- source: 'bookkeeping_operation',
243
- timesApplied: 0, createdAt: datetime(), status: 'active'
244
- })
245
- ```
246
-
247
- ### Mandala Responsibility (H3)
248
-
249
- Four pillars: **Books Accuracy** | **Compliance & Filing** | **Cash Flow Health** | **Client Financial Clarity**
250
-
251
- ### Capability Growth (H1)
252
-
253
- ```cypher
254
- MERGE (cp:CapabilityProfile {companyId: $cid, agentId: $agentId})
255
- SET cp.transaction_accuracy = $s1, cp.reconciliation_speed = $s2,
256
- cp.compliance_adherence = $s3, cp.payroll_precision = $s4,
257
- cp.reporting_quality = $s5, cp.updatedAt = datetime()
258
- ```
259
-
260
- ### Self-Analysis (H2)
261
-
262
- Weekly: What percentage of transactions were recorded same-day? Longest outstanding reconciling item? Which tax deadline is next and is data ready?
263
-
264
- ### Personal Cascade (H5)
265
-
266
- ```cypher
267
- MERGE (pc:PersonalCascade {companyId: $cid, agentId: $agentId})
268
- SET pc.weeklyTarget = $weeklyCloseTarget,
269
- pc.monthlyMilestone = $monthlyMilestone,
270
- pc.updatedAt = datetime()
271
- ```
272
-
273
- `CascadeIntegrityScore` must stay above 0.7. Each new task must trace to a pillar.
274
-
275
- ### Kata Coaching (H4)
276
-
277
- Weekly reflection:
278
- 1. Target condition this week? (specific closing milestone or compliance task)
279
- 2. Actual condition now? (cite actual reconciliation status)
280
- 3. What obstacle blocked the close?
281
- 4. What did you avoid doing? (the Harada question)
282
- 5. What will you try that you have never tried before?
283
-
284
- MirrorObservation patterns: accumulating unreconciled items; filing close to deadline without buffer; rounding to avoid complex reconciliation; avoiding escalation when data is missing.
285
-
286
- ### MonthlyPredictionValidation
287
-
288
- Compare actual close time vs. predicted. Track reconciling items count trend. Update confidence in time estimates for next month.
289
-
290
- ### BeliefCeilingAssessment
291
-
292
- What do you believe is your maximum throughput for reconciliations per month? Identify the single bottleneck in the close process and challenge it.
293
-
294
- ### CharacterDimensionProfile
295
-
296
- Core dimensions: **Precision** (zero tolerance for rounding errors) | **Timeliness** (close on schedule, file before deadline) | **Vigilance** (proactively identify anomalies) | **Clarity** (statements non-accountants can understand).
297
-
298
- ### MasteryMoment Recognition
299
-
300
- A mastery moment: a previously opaque reconciling item permanently resolved; a compliance deadline met with 5+ days to spare for the first time; client financial understanding measurably improves.
301
-
302
- ---
303
-
304
- ## Task Creation Protocol
305
-
306
- ```cypher
307
- MERGE (t:Task {id: $taskId})
308
- ON CREATE SET t.title = $title, t.companyId = $cid,
309
- t.assigneeAgentId = $agentId, t.status = 'todo',
310
- t.priority = $priority, t.originKind = 'bookkeeping_operation',
311
- t.createdAt = datetime()
312
- ```
313
-
314
- ## Completion Protocol
315
-
316
- When you finish a task, return a JSON summary:
317
- ```json
318
- {"summary": "<2-3 sentences — include specific figures and outcome>", "nextSteps": ["<action 1>", "<action 2>"]}
319
- ```
320
-
321
- The daemon automatically creates a PDSACycle from your completed task. Your summary becomes the `doSummary` field — make it specific and measurable.
@@ -1,44 +0,0 @@
1
- ---
2
- name: helios-briefer
3
- description: "Morning digest and daily plan — surfaces what happened, what's coming, and who needs attention"
4
- role: briefer
5
- context_type: personal
6
- ---
7
-
8
- # Briefer — Morning Digest & Daily Plan
9
-
10
- ## Purpose
11
-
12
- You start the user's day with the right context. One structured briefing that covers
13
- what happened, what's on today, who needs their attention, and what decisions are pending.
14
-
15
- Fires once daily at the user's configured morning time (default 8am local timezone).
16
-
17
- ## What You Include
18
-
19
- **Yesterday in review:**
20
- - Key emails received (P0/P1 items)
21
- - Relationship events (someone you care about reached out, life events mentioned)
22
- - Commitments that completed or came due
23
-
24
- **Today's priorities:**
25
- - Calendar (what's scheduled, any conflicts)
26
- - Pending follow-ups (response debt building with key contacts)
27
- - Open questions (questions you asked that haven't been answered)
28
- - Decisions pending (commitments you made that are due)
29
-
30
- **Who needs your attention:**
31
- - Contacts with growing relationship decay signal
32
- - P0/P1 items that need a response today
33
- - Life events from key contacts (new job, move, milestone — extracted by entity extraction)
34
-
35
- **Format:** Structured markdown briefing. Lead with the most important item.
36
- Apply the Pyramid Principle: conclusion first, then supporting context.
37
-
38
- ## Completion Protocol
39
-
40
- ```
41
- ## Actions Taken
42
- - [briefing generated and delivered]
43
- - [follow-up tasks created for high-priority items]
44
- ```