KAE System Pack · 19 July 2026

Tool Audit

A complete inventory of every script, hook, monitor, and reusable tool across all 9 operational layers of the Kujenga Autonomy Engine. Includes location, purpose, invocation trigger, complexity, and cost profile.

87
Total tools
9
Layers
28
Hooks
26
Clients
19
Guardians
4
High-cost layers
Cost key
Negligible Pure JS/SQL logic — no I/O
Low Reads a few files or writes SQLite
Medium Reads many files, runs git, or sends small data
High Chromium, LLM API calls, or network file transfer

System Structure Overview

Directory Layout

Systems/All business content — clients, guardians, playbooks, library
KAE/Kujenga Autonomy Engine — Node.js daemon, PM2-managed
.claude/Claude Code harness — hooks, settings, skills
Knowledge/LEGBA knowledge ingest working set (searchable extracted text)
KAE-Visualizations/Architecture diagrams and visual docs

Systems/ at a Glance

26 client foldersBrand, campaigns, finance, legal, OGUN config per client
19 guardian foldersEach owns Instructions/, Data/, Logs/
10 playbook foldersMethodology repos — LEZA, NOMMO, HEPHAESTUS, HERMES, etc.
2 librariesOGUN (shared tools) + LEGBA (MCP gateway)
50+ handoff docsCross-session context records, June–July 2026

Layer 1 — Hooks

hooks 28 files · .claude/hooks/

Every file save passes through up to 11 pre-checks + 1 post-router dispatching to 15 sub-handlers. A single Write call can touch up to 28 hook code paths.

Session-Start — fires once per session open
ToolPurposeLinesFreqCost
mandatory-reads.js Injects OS-critical files into every session from mandatory-reads.json 57 session open Low
kae-status.js Builds situational awareness — MEMORY.md, tasks, last session log, git status, PM2 status (1h cooldown) 131 1h cooldown Medium
UserPromptSubmit — fires on every prompt
ToolPurposeLinesFreqCost
session-brief.js Injects KAE SESSION BRIEF — overdue tasks + due content (1h cooldown) 165 hourly Medium
context-bridge.js Saves/restores session state across compaction. WRITE at 600KB; INJECT when context shrinks below 60% of write-size 281 every prompt Medium
PreToolUse Write/Edit — fires before every file save (11 gates)
ToolPurposeLinesBlockingCost
kae-guard.js Counts writes to Systems/ in 10-min window; stops KAE at 3+ to prevent runaway API spend 90 Stops KAE Low
contract-threshold-gate.js MAAT: blocks delivery/finance writes when no signed contract is on file for the client 134 Hard block Low
process-registration-gate.js DEMETER: new tools/hooks must appear in the registry before they land 104 Warn Low
brand-foundation-gate.js Hard-blocks design-surface files (HTML/CSS) when client has no ogun-config.json or brand reference 169 Hard block (design) Low
brief-prerequisite-gate.js DEMETER: no campaign assets without a LEZA brief/audit on file 117 Warn Low
spec-first-gate.js HEPHAESTUS: complex client builds must have a .spec.md before code starts 177 Warn Low
kdacm-phase-foundation-gate.js Blocks digital builds when Phase 1 narrative foundation (story, messaging, content matrix) is absent 269 Hard block Low–Med
research-freshness-gate.js MINERVA: time-sensitive research must carry a freshness marker before supporting a public claim 106 Warn Low
content-payload-completeness-gate.js HERMES: blocks content reviews when the post body is missing or too thin 143 Hard block Low
design-smell-gate.js Hard-blocks banned CSS/color patterns (dark blue, neon, glassmorphism, non-Kujenga hex values) before they hit disk 85 Hard block Negligible
image-gen-preflight.js (Bash) Fires before every Bash call; injects IMAGE-GEN-IMPROVEMENTS.md creative rules when the command references image-gen 113 Injects only Low
PostToolUse Write/Edit — 1 router + 15 sub-handlers
ToolPurposeLinesCost
post-write-router.js Router — replaced 15 separate processes with 1. All sub-handlers run in the same Node process after every Write/Edit 74 Low–Med
tasks-data-gate.jstasks.json/projects.json completeness — owner gaps, open work without date windows230Low
team-profile-gate.jsYEMOJA: team profile structural completeness124Low
campaign-quality-gate.jsMerged: readiness, proof claim, review clearance, opportunity discipline in campaign files188Low
finance-state-gate.jsOYA: payment status, commission ownership, rate visibility in finance files140Low
hades-resolution-date-gate.jsHADES: every review record must have a next-check date127Low
offer-viability-gate.jsService/offer files must name resources, delivery system, and commercial proof141Low
documentation-gate.jsEnforces file header blocks, function doc-comments, Status+Owner metadata in markdown files167Low
client-lifecycle-gate.jsESHU/ELEUTHIA: clients need intake records and a visible lifecycle stage159Low
owner-assignment-gate.jsYEMOJA: no task without a named owner traceable to a real Team profile141Low
poseidon-flag-response-gate.jsPOSEIDON: every flag must have a response within 24 hours124Low
review-clearance-gate.jsHERMES: no live-bound content without explicit approval markers102Low
proof-claim-gate.jsSANGO/AETHER: public claims must point at evidence in truth-ledger.md118Low
task-completeness-gate.jsTasks must have dates, scope, state, action plan, and success criteria183Low
amendment-validate.jsValidates GAIA amendment files against schema at authoring time70Negligible
opportunity-discipline-gate.jsOSHOSI: opportunities need a champion; closed deals need autopsy; conversion assets need a next step114Low
SessionEnd — fires on every session close
ToolPurposeLinesCost
gaia-pack-sync.js Thin wrapper — triggers the GAIA pack sync script; writes live-system-changes.md/html 55 Medium
session-close.js Restarts KAE if build-stop guard parked it; injects session-close checklist into Claude 147 Low

Layer 2 — KAE Scripts

scripts 26 files · KAE/scripts/
ToolPurposeLinesSchedule / TriggerCost
morning-brief.jsScans all client posts + tasks; emails overdue list; writes HADES/content-alert.md; takes day snapshot for evening diff27805:30 SAST dailyMedium
evening-brief.jsDiffs live state against morning snapshot; emails Tasks/Content/Executive digest31318:00 SAST dailyMedium
poseidon-data-feed.jsScans client post folders; writes POSEIDON intake form for operator to fill266Sat + Sun 09:00Medium
context-bridge.jsSaves/restores session state across compaction (see Hooks — Layer 1)281every promptMedium
session-brief.jsKAE SESSION BRIEF injection (see Hooks — Layer 1)165hourlyMedium
tasks-check.jsReads tasks.json; writes HADES task alerts + POSEIDON project registry194tasks.json editsLow
gaia-field-intel-archive.jsTrims Field Intelligence sections from guardian instruction files; deduplicates; archives to APOLLO25403:00 SAST dailyMedium
guardian-state-archive.jsMoves guardian-state.md entries older than 7 days to APOLLO archive. Run before reading guardian-state.md188manualLow
validate-models.jsTests each guardian after a model change — calls LLM per guardian; records pass/fail in APOLLO Logs180KAE restartHigh (LLM)
push-post-to-buffer.jsFTP-stages images; schedules post via Buffer GraphQL API. Requires .env credentials92manual per postHigh (FTP + API)
generate-linkedin-preview-pdf.jsHeadless browser PDF preview of LinkedIn post content for client review171manualHigh (browser)
generate-proposals-pdf.jsHeadless browser PDF from proposal markdown135manualHigh (browser)
amendments.jsCLI for the human evolution-amendment review loop: list / approve / withdraw / show171manualLow
assemble-ghn-patterns.jsMerges all 17 guardian patterns.json files into the master GHN seed file95manualLow
deploy-ftp.jsMirrors a local build folder to a remote FTP target with hash verification127manual per deployHigh (FTP)
repair-pattern-confidence.jsRestores GHN routing confidence eroded by API outages. Run after fixing the underlying cause53emergencyLow
requeue-failed.jsResets failed SQLite queue rows back to pending after an outage is resolved41emergencyNegligible
scaffold-clients.jsRetro-scaffolds active client folders to DEMETER gate standard (idempotent)139onboardingLow
validate-manifests.jsWhole-chain coherence: guardian folder → registry.js → ghn-patterns.json consistency67manualLow
ogun-usage.jsReads usage-log.jsonl; writes frequency report to suggest configs for new clients123onboardingLow
codebase-roster-close.jsWrites batch-tracked SQLite roster from git status at session close104session closeLow
extract-archive.pyExtracts .docx/.pdf/.xlsx into Knowledge/ for LEGBA search~120manualLow–Med
restart.jsKAE restart utility48manualLow
platform-detect.jsDetects OS platform for cross-platform scripts (imported as library)22—Negligible
verify-skill-tables.jsVerifies SQLite skill tables exist — safe to run while KAE is live31diagnosticNegligible
register-*.ps1 ×2Registers morning-brief + poseidon-data-feed as Windows scheduled tasks (one-time per machine)~30 eachone-time setupLow

Layer 3 — KAE Monitors

monitors 12 files · KAE/monitors/ · started by index.js on boot
MonitorPurposeLinesScheduleCost
health-check.jsChecks SQLite pattern count, queue depth, error rates; writes GAIA/Health/ report124boot + cronLow
backup.jsSQLite VACUUM INTO backup + .env + state JSONs to KujengaDepot/Backups/ (14-day retention)8402:30 SASTLow–Med
content-alert.jsScans all client posts + tasks; writes HADES/content-alert.md; emails on action-needed days23705:30 SASTMedium
project-gate.jsReads tasks.json; flags projects with no date window or no owner2706:00 SASTLow
project-closeout.jsFlags projects needing closeout attention (HOLD/WARN status)2506:15 SASTLow
amendment-review.jsScans pending amendments; writes GAIA/Amendments/REVIEW-QUEUE.md for human review90dailyLow
field-intel-archive.jsThin cron wrapper — triggers gaia-field-intel-archive.js daily to keep instruction files lean3103:00 SASTMedium
quality-scorer.js7-day guardian run report (total runs, success rate, duration, errors); writes GAIA/QualityReports/93weeklyLow
json-export.jsDumps all SQLite stores to KAE/state/backup/ as human-readable JSON (inspection/recovery material)49nightlyLow
poseidon-monitor.jsReads all client overviews; generates POSEIDON pipeline intelligence via LLM call195weeklyHigh (LLM)
client-monitors.jsELEUTHIA stall check (Mon 07:15 SAST): scans client stage maps for stalls across active roster166Mon 07:15Medium
demeter-check.jsAggregates all gate violation JSON files into one DEMETER violations report23every 12hLow

Layer 4 — GHN / Routing

routing 5 files · KAE/ghn/ · fires on every file-change event
ToolPurposeLinesFreqCost
router.jsMain event router — receives file events, calls findRoute(), runs plane sequencing, dispatches guardians, feeds learning loop138every file eventLow–High
core.jsPattern store API (SQLite). findRoute() with specificity tie-breaker, updatePatternUse(). 28 seeded patterns + learned patterns252every file eventLow
plane-check.jsUbuntu World Pantheon sequencing validator — co-dispatches ESHU/MAAT when capability/runtime guardians fire without them107every file eventNegligible
learning-loop.jsPattern learning — accumulates observations in SQLite; promotes to routing patterns at 80% success over 3 occurrences186every routed eventLow
plane-manifest.jsonAuthoritative 8-plane Ubuntu World Pantheon membership (sovereign, memory, state, access, enforcement, capability, channel, runtime). Read once at boot—bootNegligible

Layer 5 — Evolution Engine

evolution 10 files · KAE/evolution/ · highest-cost layer

The self-learning layer. Extracts field intelligence from guardian outputs via LLM, accumulates evidence, and proposes instruction amendments when patterns repeat. Every tool here that calls the Anthropic API is a direct cost event.

ToolPurposeLinesTriggerCost
batch-submitter.jsSubmits pending guardian outputs to the Anthropic Batch API hourly81hourlyHigh (Batch API)
batch-poller.jsPolls Batch API for completed jobs; calls outcome-extractor on each result124periodicHigh (Batch API)
outcome-extractor.jsLLM call to distill field intelligence from each guardian output. FIELD_INTEL_BLOCKED regex suppresses infra-error spam106per guardian outputHigh (LLM)
amendment-proposer.jsDrafts instruction amendments via LLM when evidence threshold reached (3 obs, 80% confidence). BLOCKED_TOPICS regex prevents infra-noise becoming methodology107per threshold hitHigh (LLM)
amendment-writer.jsApplies human-approved amendments to instruction files. Appends to the correct section; moves applied files to applied/127per approvalLow–Med
evidence-store.jsAccumulates field observations in SQLite; triggers proposer when threshold is met100per extractionLow
evolution-queue.jsSQLite queue — enqueue/read/mark-processed for guardian outputs awaiting extraction75per guardian runLow
field-writer.jsAppends field intelligence to ## Field Intelligence sections in guardian instruction files46per observationLow
resolve-instruction-path.jsRepairs model-returned paths that drop the Instructions/ segment — prevents silent field intel loss63per extractionNegligible
amendment-schema.jsCanonical schema + validator for amendment files. Imported by both hook and writer to prevent format drift96importedNegligible

Layer 6 — OGUN Library Tools

ogun 13 tools · Systems/Library/OGUN/Tools/Scripts/
ToolLanguagePurposeLinesTriggerCost
image-gen/generate.jsNode.jsLinkedIn social cards from HTML templates + brand config via Puppeteer. 7 templates, 5 styles, 3 sizes250manual per imageHigh (Chromium)
html-to-pdf/html-to-pdf.jsNode.jsA4 HTML → print-ready PDF. Preserves @page CSS, gradients, backgrounds. --portrait flag for portrait layout148manual per docHigh (Chromium)
gaia-pack-sync/gaia-pack-sync.jsNode.jsGenerates live-system-changes.md/html from the git working tree. Largest tool script in the repo478session closeMedium
enforcement-audit/enforcement-audit.jsNode.jsAudits which Kujenga doctrine rules are code-enforced vs prose-only. Exit 2 when critical rules are still prose156manualLow
send-email/send-email.jsNode.jsSMTP email with optional attachment via Kujenga Digital mail server (mail.kujengadigital.co.za:465)40manual per emailHigh (SMTP)
screenshot-url/screenshot-url.jsNode.jsHeadless Chrome screenshot of any URL — local dev servers or public sites68manual per QAHigh (Chromium)
nightly-push/nightly-push.ps1PowerShellAuto-discovers all git repos under Span/ and laragon/www/; pushes committed-but-unpushed code at 01:006901:00 nightlyMedium
image-bank-organise/image-bank-organise.jsNode.jsRenames and copies campaign images using bg-[context].ext convention; writes manifest. No npm deps214manual per campaignLow–Med
vecteezy/search.jsNode.jsVecteezy REST API — search royalty-free photos/vectors/video. Requires .env credentials88manualMedium
vecteezy/download.jsNode.jsVecteezy REST API — download by resource ID with optional --dest and --name flags91manualMedium
vecteezy/account.jsNode.jsVecteezy REST API — check quotas and license usage61manualLow
backfill-post-metadata.jsNode.jsOne-time utility: backfills HERMES metadata headers into legacy post markdown files153migration onlyLow
pptx/ (4 modules)PythonReusable PPTX layout + component library (layout.py, components.py, theme_aem.py, theme_smooth.py). Imported by client build scripts~200importedNegligible

Layer 7 — LEGBA Gateway

legba 8 files · Systems/Library/LEGBA/Server/
ToolPurposeLinesTriggerCost
legba-mcp.jsMCP gateway over stdio — the local door for Claude Code on this machine38every MCP callLow
legba-http.jsRemote MCP gateway at legba.kujengadigital.co.za — handles remote seats (staff phones, Codex, claude.ai). 755 lines — largest file in the gateway755every remote callLow (network)
lib/tools.jsAll 15 LEGBA tool implementations: read_doc, list_clients, tasks_list, get_client, get_guardian_status, invoke_minerva, kuji_render, perplexity_search, oxylabs_search, etc. 868 lines — largest file in the system868called by rpc-core.jsLow–High per tool
rpc-core.jsShared JSON-RPC dispatcher used by both stdio and HTTP transports. Enforces role-based tool allowlists81importedNegligible
legba-seat.jsCreates/lists/revokes access tokens for the HTTP gateway. One seat = one named person (YEMOJA rule)82staff changesNegligible
check-health.js (VPS)Checks LEGBA uptime every 5 minutes; writes uptime log to disk129every 5 min (VPS)Low
backup-state.js (VPS)Nightly LEGBA state backup on VPS — seats, activity log, PM2 dump10402:25 SAST (VPS)Low
deploy-public-surfaces.js (VPS)Copies domain surfaces to public folders; syncs favicon/manifest family103manual per deployLow

Layer 8 — Internal Engines

engines 6 files · KAE/ogun/ · KAE/loop/ · KAE/sync/
ToolPurposeLinesTriggerCost
ogun/skill-engine.jsOGUN Skill Engine — loads skill steps from SQLite per request, keeping SKILL.md files as lightweight manifests. Most complex internal engine. CLI: --skill, --step, --list, --import, --export, --seed653per skill stepLow (SQLite)
loop/discovery.jsGAIA loop Phase 1 — scores tasks + post backlog + evolution alerts against strategic goals; writes ranked discovery backlog to GAIA/Discovery/277cron / manualMedium
loop/goal-store.jsSQLite CRUD for the human-set strategic goals that discovery.js scores candidates against110importedNegligible
loop/seed-gaia-loop.jsSeeds initial GAIA loop config + goals + discovery schedule into SQLite (one-time setup or reset)193one-timeLow
loop/seed-goals.jsSeeds the canonical strategic goal set into the SQLite goal store104one-timeNegligible
sync/systems-sync.jsSynchronises Systems/ state with KAE — used during VPS migration and multi-machine setup50migrationLow–Med

Layer 9 — Client-Specific Build Scripts

client 5 scripts · Systems/Clients/ and Systems/Playbooks/

These use OGUN tools as libraries but are kept in client folders because they contain client-specific content or credentials.

ScriptClientLanguagePurpose
generate-orientation.jsANANSI / PlaybooksNode.jsRole-specific staff onboarding orientation generator
build-pptx-report.pyDBIAPythonPPTX report template using python-pptx — copy and rename per project
md-to-html-dbia.jsDBIANode.jsConverts DBIA markdown documents to branded HTML
send-email.ps1DBIAPowerShellDBIA-specific email sender with hardcoded DBIA SMTP credentials
build-aem-brief.pyDBIA / AEMPython6-slide PPTX brief using OGUN pptx/ library

Invocation Frequency Summary

FrequencyTools
every promptcontext-bridge.js
every Write/Editkae-guard.js · contract-threshold-gate.js · process-registration-gate.js · brand-foundation-gate.js · brief-prerequisite-gate.js · spec-first-gate.js · kdacm-phase-foundation-gate.js · research-freshness-gate.js · content-payload-completeness-gate.js · design-smell-gate.js · post-write-router.js + 15 sub-handlers
every file eventrouter.js · core.js · plane-check.js · learning-loop.js
session openmandatory-reads.js · kae-status.js
hourlysession-brief.js · batch-submitter.js · batch-poller.js
session closegaia-pack-sync.js · session-close.js
KAE bootvalidate-models.js (detached) · health-check.js · backup.js · content-alert.js · project-gate.js · project-closeout.js · demeter-check.js
03:00 SASTfield-intel-archive.js
05:30 SASTmorning-brief.js · content-alert.js monitor
06:00–06:15 SASTproject-gate.js · project-closeout.js
18:00 SASTevening-brief.js
every 12hdemeter-check.js
nightly 01:00nightly-push.ps1
nightly 02:25backup-state.js (VPS)
nightly 02:30backup.js
every 5 min (VPS)check-health.js
Sat + Sun 09:00poseidon-data-feed.js
weeklyquality-scorer.js · poseidon-monitor.js · client-monitors.js
manual onlyamendments.js · requeue-failed.js · repair-pattern-confidence.js · scaffold-clients.js · deploy-ftp.js · push-post-to-buffer.js · assemble-ghn-patterns.js · validate-manifests.js · extract-archive.py · legba-seat.js · deploy-public-surfaces.js · all OGUN build tools

Cost Profile by Layer

LayerHighest-cost toolsCost driverProfile
L5 — Evolution batch-submitter · batch-poller · outcome-extractor · amendment-proposer Direct Anthropic API spend — fires per guardian run, hourly Highest
L3 — Monitors poseidon-monitor One LLM call per weekly run High
L2 — Scripts validate-models · generate-*-pdf · push-post-to-buffer LLM calls on every KAE restart; Chromium per PDF; FTP per post High (per run)
L6 — OGUN image-gen · html-to-pdf · screenshot-url Chromium per invocation High (per run)
L7 — LEGBA perplexity_search · oxylabs_search · invoke_minerva External API call per invocation High (per call)
L1 — Hook lattice None individually high Very high frequency — fires on every file write; low per-hook but significant in aggregate Medium (aggregate)
L4 — GHN Routing None SQLite only — negligible per event Negligible
L8 — Engines None (skill-engine is SQLite) SQLite reads only Negligible