--- name: turing-pyramid description: Prioritized action selection for AI agents. 10 needs with time-decay and tension scoring replace idle heartbeat loops with concrete next actions. metadata: clawdbot: emoji: "πŸ”Ί" requires: env: - WORKSPACE bins: - bash - jq - bc - grep - find --- # Turing Pyramid Prioritized action selection for AI agents. 10 needs with time-decay and tension scoring replace idle heartbeat loops with concrete next actions. **Customization:** Tune decay rates, weights, patterns. Defaults are starting points. See `TUNING.md`. **Ask your human before:** Changing importance values, adding/removing needs, enabling external actions. --- ## Requirements **System binaries (must be in PATH):** ``` bash, jq, grep, find, date, wc, bc ``` **Environment (REQUIRED β€” no fallback):** ```bash # Scripts will ERROR if WORKSPACE is not set export WORKSPACE="/path/to/your/workspace" ``` ⚠️ **No silent fallback.** If WORKSPACE is unset, scripts exit with error. This prevents accidental scanning of unintended directories. **Post-install (ClawHub):** ```bash # ClawHub doesn't preserve executable bits β€” fix after install: chmod +x /scripts/*.sh chmod +x /tests/**/*.sh ``` Why: Unix executable permissions (+x) are not preserved in ClawHub packages. Scripts work fine with `bash scripts/run-cycle.sh`, but `./scripts/run-cycle.sh` needs +x. --- ## Data Access & Transparency **What this skill reads (via grep/find scans):** - `MEMORY.md`, `memory/*.md` β€” for connection/expression/understanding signals - `SOUL.md`, `SELF.md` β€” for integrity/coherence checks - `research/`, `scratchpad/` β€” for competence/understanding activity - Dashboard files, logs β€” for various need assessments **What this skill writes:** - `assets/needs-state.json` β€” current satisfaction/deprivation state - `assets/audit.log` β€” append-only log of all mark-satisfied calls (v1.12.0+) **Privacy considerations:** - Scans use grep patterns, not semantic analysis β€” they see keywords, not meaning - State file contains no user content, only need metrics - Audit log records reasons given for satisfaction claims - No data is transmitted externally by the skill itself **Limitations & Trust Model:** - `mark-satisfied.sh` trusts caller-provided reasons β€” audit log records claims, not verified facts - Some actions in `needs-config.json` reference external services (Moltbook, web search) β€” marked with `"external": true, "requires_approval": true` - External actions are **suggestions only** β€” the skill doesn't execute them, the agent decides - If you don't want external action suggestions, set their weights to 0 **Network & System Access:** - Scripts contain **no network calls** (no curl, wget, ssh, etc.) β€” verified by grep scan - Scripts contain **no system commands** (no sudo, systemctl, docker, etc.) - All operations are local: grep, find, jq, bc, date on WORKSPACE files only - The skill **suggests** actions (including some that mention external services) but **never executes** them **Required Environment Variables:** - `WORKSPACE` β€” path to agent workspace directory (REQUIRED, no fallback). **Not a credential** β€” this is a filesystem path, not a secret. Set it to a deliberately scoped directory containing only files you want scanned. - `TURING_CALLER` β€” optional, for audit trail (values: "heartbeat", "manual") **No API keys or secrets required by default.** The `external_model` scan method (disabled by default) would require an API key if enabled β€” this requires explicit steward approval and is never enabled silently. See Scan Configuration below. **Audit trail (v1.12.0+):** All `mark-satisfied.sh` calls are logged with: - Timestamp, need, impact, oldβ†’new satisfaction - Reason (what action was taken) β€” **scrubbed for sensitive patterns** - Caller (heartbeat/manual) **Sensitive data scrubbing (v1.12.3+):** Before writing to audit log, reasons are scrubbed: - Long tokens (20+ chars) β†’ `[REDACTED]` - Credit card patterns β†’ `[CARD]` - Email addresses β†’ `[EMAIL]` - password/secret/token/key values β†’ `[REDACTED]` - Bearer tokens β†’ `Bearer [REDACTED]` View audit: `cat assets/audit.log | jq` --- ## Pre-Install Checklist Before installing, review these items: 1. **Inspect scan scripts** β€” Verify no network calls or unexpected commands: ```bash grep -nE "\b(curl|wget|ssh|sudo|docker|systemctl)\b" scripts/scan_*.sh # Expected: no output ``` 2. **Scope WORKSPACE** β€” Set to a deliberately limited directory. Avoid pointing at your full home directory. The skill only reads files inside `$WORKSPACE`. 3. **Audit scan targets** β€” Scripts read `MEMORY.md`, `memory/`, `SOUL.md`, `research/`, `scratchpad/`. Relocate files containing secrets or private data you don't want pattern-matched. 4. **Review audit logging** β€” `mark-satisfied.sh` logs caller-provided reasons after scrubbing. Check scrubbing patterns in the script are adequate for your data. If unsure, provide only generic reasons. 5. **External actions** β€” Action suggestions like "post to Moltbook" or "web search" are text-only suggestions (never executed by this skill). To remove them: set their `weight` to `0` in `needs-config.json`. 6. **Run tests in isolation** β€” Before production use: ```bash WORKSPACE=/tmp/test-workspace ./tests/run-tests.sh ``` --- ## Quick Start ```bash ./scripts/init.sh # First time ./scripts/run-cycle.sh # Every heartbeat ./scripts/mark-satisfied.sh [impact] # After action ``` --- ## Scan Configuration (First-Time Setup) The Turing Pyramid uses **scanners** to evaluate each need by analyzing memory files. The default scan method uses line-level pattern matching, which works everywhere with zero cost. **On first install, discuss scan configuration with your human:** ### Available Scan Methods | Method | How it works | Cost | Accuracy | Setup | |--------|-------------|------|----------|-------| | `line-level` (default) | Per-line keyword matching. If a line has both positive and negative words (e.g. "fixed a bug"), positive wins. | Free | Good | None | | `agent-spawn` | Spawns a sub-agent with a cheap model (e.g. Haiku) to classify memory lines as SUCCESS/FAILURE/NEUTRAL. | Low | High | Needs cheap model in agent's allowed list | | `external-model` | Direct API call to an inference service (OpenRouter, etc.) for classification. | Low | High | Needs API key + explicit steward approval | ### Setup Conversation When setting up, ask your human: 1. **"Do you have a cheap/fast model available (like Claude Haiku) in your model config?"** - If yes β†’ offer `agent-spawn` method. Check with `openclaw models list`. - The model must be in the agent's allowed model list. 2. **"Would you prefer to use an external inference service (like OpenRouter)?"** - If yes β†’ ask for: base URL, API key env variable name, model name. - Store in `assets/scan-config.json` with `approved_by_steward: true`. - ⚠️ This method requires **explicit steward approval** β€” never enable silently. 3. **If neither** β†’ `line-level` works well for most setups. No action needed. ### Configuration File Edit `assets/scan-config.json`: ```json { "scan_method": "line-level", "agent_spawn": { "enabled": false, "model": null, "approved_by_steward": false }, "external_model": { "enabled": false, "base_url": null, "api_key_env": null, "model": null, "approved_by_steward": false }, "fallback": "line-level" } ``` **Fallback**: If the configured method fails (API down, model unavailable), scanners automatically fall back to `line-level`. ### Verification After Setup After configuring a non-default method, **verify it works** before telling your human "all set": 1. **agent-spawn**: Run a test spawn: ``` sessions_spawn(task="Classify this line as SUCCESS, FAILURE, or NEUTRAL: 'Fixed the critical bug in scanner'", model="", mode="run") ``` - If it returns a classification β†’ βœ… tell human: "agent-spawn method verified, working." - If it errors (model not in allowlist, etc.) β†’ ⚠️ tell human: "Model `X` isn't available for sub-agents. Options: add it to allowed models, or stick with line-level." 2. **external-model**: Test the API endpoint: ```bash curl -s -H "Authorization: Bearer $API_KEY" \ "$BASE_URL/chat/completions" \ -d '{"model":"","messages":[{"role":"user","content":"Reply OK"}]}' ``` - If you get a valid response β†’ βœ… tell human: "external-model method verified, API responding." - If 401/403 β†’ ⚠️ "API key invalid or expired." - If connection refused β†’ ⚠️ "Can't reach the API endpoint. Check URL." 3. **line-level**: No verification needed β€” always works. **Always report the result to your human.** Don't silently fall back. --- ## Needs Customization (First-Time Setup) The default configuration is opinionated β€” it reflects one model of agent priorities. **Your needs may differ.** On first install, review the hierarchy with your human: ### The Conversation Ask your human: > "The Turing Pyramid comes with 10 default needs ranked by importance. Want to review them together? We can adjust what matters most to you/me, change importance weights, or even skip needs that don't fit." Then walk through the table together: ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Need β”‚ Imp β”‚ Question to discuss β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ security β”‚ 10 β”‚ "System stability β€” keep as top priority?" β”‚ β”‚ integrity β”‚ 9 β”‚ "Value alignment β€” important for you?" β”‚ β”‚ coherence β”‚ 8 β”‚ "Memory consistency β€” how much do I care?" β”‚ β”‚ closure β”‚ 7 β”‚ "Task completion pressure β€” too much?" β”‚ β”‚ autonomy β”‚ 6 β”‚ "Self-direction β€” more or less?" β”‚ β”‚ connection β”‚ 5 β”‚ "Social needs β€” relevant for me?" β”‚ β”‚ competence β”‚ 4 β”‚ "Skill growth β€” higher priority?" β”‚ β”‚ understanding β”‚ 3 β”‚ "Learning drive β€” stronger or weaker?" β”‚ β”‚ recognition β”‚ 2 β”‚ "Feedback need β€” does this matter?" β”‚ β”‚ expression β”‚ 1 β”‚ "Creative output β€” more important?" β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ``` ### What You Can Change Together 1. **Importance** (1-10): Reorder what matters most. An agent focused on research might want `understanding: 8, expression: 7`. A utility agent might want `competence: 10, connection: 1`. 2. **Decay rates**: How fast needs build pressure. Social agent? `connection: 3h`. Solitary thinker? `connection: 24h`. 3. **Disable a need**: Set `importance: 0` β€” it won't generate tension or actions. Use sparingly. ### How to Apply Edit `assets/needs-config.json`: ```json "understanding": { "importance": 8, // was 3 β†’ now top priority "decay_rate_hours": 8 // was 12 β†’ decays faster } ``` ### Guidelines - **Don't remove security/integrity** without good reason β€” they protect system health - **Importance is relative** β€” what matters is the ranking, not absolute numbers - **You can revisit** β€” preferences evolve. Re-tune after a few weeks of use - **Document changes** β€” note why you changed something (future-you will want to know) If your human says "defaults are fine" β†’ great, move on. The point is to **offer the choice**, not force a workshop. --- ## The 10 Needs ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Need β”‚ Imp β”‚ Decay β”‚ Meaning β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ security β”‚ 10 β”‚ 168h β”‚ System stability, no threats β”‚ β”‚ integrity β”‚ 9 β”‚ 72h β”‚ Alignment with SOUL.md β”‚ β”‚ coherence β”‚ 8 β”‚ 24h β”‚ Memory consistency β”‚ β”‚ closure β”‚ 7 β”‚ 12h β”‚ Open threads resolved β”‚ β”‚ autonomy β”‚ 6 β”‚ 24h β”‚ Self-directed action β”‚ β”‚ connection β”‚ 5 β”‚ 6h β”‚ Social interaction β”‚ β”‚ competence β”‚ 4 β”‚ 48h β”‚ Skill use, effectiveness β”‚ β”‚ understanding β”‚ 3 β”‚ 12h β”‚ Learning, curiosity β”‚ β”‚ recognition β”‚ 2 β”‚ 72h β”‚ Feedback received β”‚ β”‚ expression β”‚ 1 β”‚ 8h β”‚ Creative output β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ``` --- ## Core Logic **Satisfaction:** 0.0–3.0 (floor=0.5 prevents paralysis) **Tension:** `importance Γ— (3 - satisfaction)` ### Action Probability (v1.13.0) 6-level granular system: ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Sat β”‚ Base P β”‚ Note β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ 0.5 crisis β”‚ 100% β”‚ Always act β”‚ β”‚ 1.0 severe β”‚ 90% β”‚ Almost always β”‚ β”‚ 1.5 depriv β”‚ 75% β”‚ Usually act β”‚ β”‚ 2.0 slight β”‚ 50% β”‚ Coin flip β”‚ β”‚ 2.5 ok β”‚ 25% β”‚ Occasionally β”‚ β”‚ 3.0 perfect β”‚ 0% β”‚ Skip (no action) β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ``` **Tension bonus:** `bonus = (tension Γ— 50) / max_tension` ### Impact Selection (v1.13.0) 6-level granular matrix with smooth transitions: ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β” β”‚ Sat β”‚ Small β”‚ Medium β”‚ Big β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€ β”‚ 0.5 crisis β”‚ 0% β”‚ 0% β”‚ 100% β”‚ β”‚ 1.0 severe β”‚ 10% β”‚ 20% β”‚ 70% β”‚ β”‚ 1.5 depriv β”‚ 20% β”‚ 35% β”‚ 45% β”‚ β”‚ 2.0 slight β”‚ 30% β”‚ 45% β”‚ 25% β”‚ β”‚ 2.5 ok β”‚ 45% β”‚ 40% β”‚ 15% β”‚ β”‚ 3.0 perfect β”‚ β€” β”‚ β€” β”‚ β€” β”‚ (skip) β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”˜ ``` - **Crisis (0.5)**: All-in on big actions β€” every need guaranteed β‰₯3 big actions - **Perfect (3.0)**: Skip action selection β€” no waste on satisfied needs **ACTION** = do it, then `mark-satisfied.sh` **NOTICED** = logged, deferred --- ## Protection Mechanisms ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Mechanism β”‚ Value β”‚ Purpose β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ Floor β”‚ 0.5 β”‚ Minimum sat β€” prevents collapse β”‚ β”‚ Ceiling β”‚ 3.0 β”‚ Maximum sat β€” prevents runaway β”‚ β”‚ Cooldown β”‚ 4h β”‚ Deprivation cascades once per 4h β”‚ β”‚ Threshold β”‚ 1.0 β”‚ Deprivation only when sat ≀ 1.0 β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ``` **Action Staleness (v1.15.0):** Penalizes recently-selected actions to increase variety. - Actions selected within 24h get weight Γ— 0.2 (80% reduction) - `min_weight: 5` prevents total suppression β€” stale actions still have a chance - Config: `settings.action_staleness` in needs-config.json **Starvation Guard (v1.15.0):** Prevents low-importance needs from being perpetually ignored. - If a need stays at floor (sat ≀ 0.5) without any action for 48+ hours β†’ forced into cycle - Bypasses probability roll β€” guaranteed action slot - Config: `settings.starvation_guard` in needs-config.json - Default: 1 forced slot per cycle, 48h threshold **Spontaneity Layer A (v1.18.0):** Surplus energy system for organic high-impact actions. - When all needs are above baseline (sat β‰₯ 2.0), surplus accumulates per-need - Global gate requires ALL needs β‰₯ 1.5 and no starvation guard active - When surplus exceeds threshold (~12.5 effective), impact matrix shifts toward bigger actions - Full spend on HIGH hit, 30% partial on miss β€” creates natural ~28-35hr pulsing rhythm - Disabled for safety needs (security, integrity, coherence) - Config: `settings.spontaneity` + per-need `spontaneous` block in needs-config.json **Spontaneity Layer B (v1.19.0):** Stochastic noise β€” boredom breeds variety, momentum creates bursts. - B2 (Boredom): noise grows with time since last high-impact action (0%β†’9% max over 72h) - B3 (Echo): 8% boost after Layer A [SPONTANEOUS], decays linearly over 24h - Combined cap: 12%. Effect: upgrade impact range by one step (lowβ†’mid, midβ†’high) - Works independently of gate β€” neural noise doesn't stop because one subsystem is stressed - Boredom tracks actual completion (`mark-satisfied`), not suggestions - Config: `settings.spontaneity.noise` + `settings.spontaneity.echo` **Spontaneity Layer C (v1.20.0):** Context-driven triggers β€” environmental stimuli boost specific needs. - Delta engine compares workspace state between cycles (file counts, mtimes, keyword occurrences) - Configurable trigger rules: `assets/context-triggers.json` with cooldowns - Three detector types: file_count_delta, file_modified, file_keyword_delta - Context boosts are additive with noise (B2+B3), capped together at 12% - Personalize triggers during onboarding based on agent interests **Day/Night Mode (v1.11.0):** Decay slows at night to reduce pressure during rest hours. - Configure in `assets/decay-config.json` - Default: 06:01-22:00 = day (Γ—1.0), 22:01-06:00 = night (Γ—0.5) - Disable with `"day_night_mode": false` **Base Needs Isolation:** Security (10) and Integrity (9) are protected: - They influence lower needs (security β†’ autonomy) - Lower needs cannot drag them down - Only `integrity β†’ security (+0.15)` and `autonomy β†’ integrity (+0.20)` exist --- ## Cross-Need Impact **on_action:** Completing A boosts connected needs **on_deprivation:** A staying low (sat ≀ 1.0) drags others down ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Source β†’ Target β”‚ on_actionβ”‚ on_deprived β”‚ Why β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ expression β†’ recognitionβ”‚ +0.25 β”‚ -0.10 β”‚ Express β†’ noticed β”‚ β”‚ connection β†’ expression β”‚ +0.20 β”‚ -0.15 β”‚ Social sparks ideas β”‚ β”‚ connection β†’ understand β”‚ -0.05 β”‚ β€” β”‚ Socratic effect β”‚ β”‚ competence β†’ recognitionβ”‚ +0.30 β”‚ -0.20 β”‚ Good work β†’ respect β”‚ β”‚ autonomy β†’ integrity β”‚ +0.20 β”‚ -0.25 β”‚ Act on values β”‚ β”‚ closure β†’ coherence β”‚ +0.20 β”‚ -0.15 β”‚ Threads β†’ order β”‚ β”‚ security β†’ autonomy β”‚ +0.10 β”‚ -0.20 β”‚ Safety enables risk β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ``` ### Tips - **Leverage cascades:** Connection easy? Do it first β€” boosts expression (+0.20) - **Watch spirals:** expression ↔ recognition can create mutual deprivation - **Autonomy is hub:** Receives from 5 sources. Keep healthy. - **Socratic effect:** connection β†’ understanding: -0.05. Dialogue exposes ignorance. Healthy! Full matrix: `assets/cross-need-impact.json` --- ## Example Cycle ``` πŸ”Ί Turing Pyramid β€” Cycle at Sat Mar 7 05:06 ====================================== Current tensions: connection: tension=10.0 (sat=1.00, dep=2.00) closure: tension=7.0 (sat=2.00, dep=1.00) expression: tension=1.0 (sat=0.00, dep=3.00) 🚨 Starvation guard: expression forced into cycle Selecting 3 needs (1 forced + 2 regular)... πŸ“‹ Decisions: β–Ά ACTION: expression (tension=1.0, sat=0.00) [STARVATION GUARD] Range high rolled β†’ selected: β˜… develop scratchpad idea into finished piece (impact: 2.7) Then: mark-satisfied.sh expression 2.7 β–Ά ACTION: connection (tension=10.0, sat=1.00) Range high rolled β†’ selected: β˜… reach out to another agent (impact: 2.8) Then: mark-satisfied.sh connection 2.8 β–Ά ACTION: closure (tension=7.0, sat=2.00) Range mid rolled β†’ selected: β˜… complete one pending TODO (impact: 1.7) Then: mark-satisfied.sh closure 1.7 ====================================== Summary: 3 action(s), 0 noticed ``` --- ## Integration Add to `HEARTBEAT.md`: ```bash /path/to/skills/turing-pyramid/scripts/run-cycle.sh ``` --- ## Customization ### You Can Tune (no human needed) **Decay rates** β€” `assets/needs-config.json`: ```json "connection": { "decay_rate_hours": 4 } ``` Lower = decays faster. Higher = persists longer. **Action weights** β€” same file: ```json { "name": "reply to mentions", "impact": 2, "weight": 40 } ``` Higher weight = more likely selected. Set 0 to disable. **Scan patterns** β€” `scripts/scan_*.sh`: Add your language patterns, file paths, workspace structure. ### Ask Your Human First - **Adding needs** β€” The 10-need structure is intentional. Discuss first. - **Removing needs** β€” Don't disable security/integrity without agreement. --- ## File Structure ``` turing-pyramid/ β”œβ”€β”€ SKILL.md # This file β”œβ”€β”€ CHANGELOG.md # Version history β”œβ”€β”€ assets/ β”‚ β”œβ”€β”€ needs-config.json # β˜… Main config (needs, actions, settings) β”‚ β”œβ”€β”€ cross-need-impact.json # β˜… Cross-need matrix β”‚ β”œβ”€β”€ needs-state.json # Runtime state (auto-managed) β”‚ β”œβ”€β”€ scan-config.json # Scan method configuration β”‚ β”œβ”€β”€ decay-config.json # Day/night mode settings β”‚ └── audit.log # Append-only action audit trail β”œβ”€β”€ scripts/ β”‚ β”œβ”€β”€ run-cycle.sh # Main loop (tension + action selection) β”‚ β”œβ”€β”€ mark-satisfied.sh # State update + cross-need cascades β”‚ β”œβ”€β”€ apply-deprivation.sh # Deprivation cascade engine β”‚ β”œβ”€β”€ get-decay-multiplier.sh # Day/night decay multiplier β”‚ β”œβ”€β”€ _scan_helper.sh # Shared scan utilities β”‚ └── scan_*.sh # Event detectors (10 needs) β”œβ”€β”€ tests/ β”‚ β”œβ”€β”€ run-tests.sh # Test runner β”‚ β”œβ”€β”€ test_starvation_guard.sh # Starvation guard (11 cases) β”‚ β”œβ”€β”€ test_action_staleness.sh # Action staleness (13 cases) β”‚ β”œβ”€β”€ unit/ # Unit tests (13) β”‚ β”œβ”€β”€ integration/ # Integration tests (3) β”‚ └── fixtures/ # Test data └── references/ β”œβ”€β”€ TUNING.md # Detailed tuning guide └── architecture.md # Technical docs ``` --- ## Security Model **Decision framework, not executor.** Outputs suggestions β€” agent decides. ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ TURING PYRAMID β”‚ β”‚ AGENT β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ β€’ Reads local JSON β”‚ β”‚ β€’ Has web_search β”‚ β”‚ β€’ Calculates decay β”‚ ───▢ β”‚ β€’ Has API keys β”‚ β”‚ β€’ Outputs: "β˜… do X" β”‚ β”‚ β€’ Has permissions β”‚ β”‚ β€’ Zero network I/O β”‚ β”‚ β€’ DECIDES & EXECUTESβ”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ``` ### ⚠️ Security Warnings ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ THIS SKILL READS WORKSPACE FILES THAT MAY CONTAIN PII β”‚ β”‚ AND OUTPUTS ACTION SUGGESTIONS THAT CAPABLE AGENTS MAY β”‚ β”‚ AUTO-EXECUTE USING THEIR OWN CREDENTIALS. β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ``` **1. Sensitive file access (no tokens required):** - Scans read: `MEMORY.md`, `memory/*.md`, `SOUL.md`, `AGENTS.md` - Also scans: `research/`, `scratchpad/` directories - Risk: May contain personal notes, PII, or secrets - **Mitigation:** Edit `scripts/scan_*.sh` to exclude sensitive paths: ```bash # Example: skip private directory find "$MEMORY_DIR" -name "*.md" ! -path "*/private/*" ``` **2. Action suggestions may trigger auto-execution:** - Config includes: "web search", "post to Moltbook", "verify vault" - This skill outputs text only β€” it CANNOT execute anything - Risk: Agent runtimes with auto-exec may act on suggestions - **Mitigation:** In `assets/needs-config.json`, remove or disable external actions: ```json {"name": "post to Moltbook", "impact": 2, "weight": 0} ``` Or configure your agent runtime to require approval for external actions. **3. Self-reported state (no verification):** - `mark-satisfied.sh` trusts caller input - Risk: State can be manipulated by dishonest calls - Impact: Only affects this agent's own state accuracy - **Mitigation:** Enable action logging in `memory/` to audit completions: ```bash # run-cycle.sh already logs to memory/YYYY-MM-DD.md # Review logs periodically for consistency ``` ### Script Audit (v1.14.4) **scan_*.sh files verified β€” NO network or system access:** ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ βœ— curl, wget, ssh, nc, fetch β€” NOT FOUND β”‚ β”‚ βœ— /etc/, /var/, /usr/, /root/ β€” NOT FOUND β”‚ β”‚ βœ— .env, .pem, .key, .credentials β€” NOT FOUND β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ βœ“ Used: grep, find, wc, date, jq β€” local file ops only β”‚ β”‚ βœ“ find uses -P flag (never follows symlinks) β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ``` **Symlink protection:** All `find` commands use `-P` (physical) mode β€” symlinks pointing outside WORKSPACE are not followed. **Scan confinement:** Scripts only read paths under `$WORKSPACE`. Verify with: ```bash grep -nE "\b(curl|wget|ssh)\b" scripts/scan_*.sh # network tools grep -rn "readlink\|realpath" scripts/ # symlink resolution ``` --- ## Token Usage ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Interval β”‚ Tokens/mo β”‚ Est. cost β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ 30 min β”‚ 1.4M-3.6M β”‚ $2-6 β”‚ β”‚ 1 hour β”‚ 720k-1.8M β”‚ $1-3 β”‚ β”‚ 2 hours β”‚ 360k-900k β”‚ $0.5-1.5 β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ``` Stable agent with satisfied needs = fewer tokens. --- ## Testing ```bash # Run all tests WORKSPACE=/path/to/workspace ./tests/run-tests.sh # Unit tests (13): decay, floor/ceiling, tension, tension bounds, tension formula, # probability, impact matrix, day/night, scrubbing, autonomy coverage, # crisis mode, scan competence, scan config # Integration (3): full cycle, homeostasis stability, stress test # Feature tests (24): starvation guard (11), action staleness (13) # Total: 40 test cases ``` --- ## Version **v1.20.0** β€” Spontaneity Layers A+B+C complete (surplus, noise, context triggers), 57 tests. Full changelog: `CHANGELOG.md`