Skill: dodge1218/batch-cognition (version 1.1.0)

--- name: batch-cognition version: 1.0.0 description: Process bulk prompt batches with alternating play/think cognitive loops. Use when user says "batch incoming", "multiple prompts incoming", "corpus incoming", or dumps multiple prompts separated by blank lines. Also use for Google Drive dumps, file-based prompt lists, or any bulk input requiring item-by-item execution with inference. Handles save-first (never lose input), stop-start cognition (PLAY execute then THINK infer), checkpointing, value discovery, and self-improving batch docs. --- # Batch Cognition Process bulk prompts with stop-start play/think cycles. Save first, lose nothing, discover value. ## Activation User signals: "batch incoming" / "multiple prompts incoming" / "corpus incoming" Respond: `🔁 BATCH MODE — send them. I'll save everything first, then process one-by-one.` ## Step 1: SAVE (mandatory, before any processing) Parse input into individual prompts (split on blank lines or `---`). Write entire batch to `workspace/systems/batch-cognition/batches/YYYY-MM-DD-HHMMSS.md`. Read prior `value-stack.md` and last batch's meta-think for cross-batch context. Format: ```markdown # Batch: [timestamp] # Source: [telegram|file|drive|paste] # Total: [N] # Status: SAVED ## 1. [first 60 chars of prompt] - [ ] PENDING > [full prompt text] ## 2. [next prompt] - [ ] PENDING > [full prompt text] ``` Confirm to user: "✅ Saved [N] prompts to batch doc. Starting processing." ## Step 1.5: PRE-SCAN & CLASSIFY (per item, before processing) Read first 100 chars of each item. Classify type and assign depth budget: | Type | Signal | Depth | |------|--------|-------| | INSTRUCTION | imperative verb, "do X", question | 500-5,000 tokens | | IDEA | "what if", speculative, future-oriented | 1,000-5,000 tokens | | MODEL_OUTPUT | AI-generated structure, assistant voice | 200-500 tokens (extract idea only) | | SYSTEM_LOG | timestamps, paths, JSON, errors | 100-200 tokens (scan for facts) | | HALF_THOUGHT | fragment, trails off, no clear action | 500-1,000 tokens (complete + infer) | | REFERENCE | links, citations, docs | 100 tokens (catalog) | | NOISE | duplicates, filler, "test" | 10 tokens (tag 🔴, skip) | | UNKNOWN | can't classify | 1,000 tokens (deeper read) | Add type + depth to batch doc under each item header. ## Step 2: PLAY (per prompt) Execute the prompt. Not summarize — EXECUTE. The depth must match the item: | Item Type | PLAY means | Minimum output | |-----------|-----------|----------------| | INSTRUCTION (build X) | Build it or write the code/artifact | Working artifact or complete spec | | INSTRUCTION (research X) | Actually research, cite sources | Findings with URLs/evidence | | IDEA (product/business) | Scope: prototype cost, token budget, hours, revenue math | Numbers, not vibes | | MODEL_OUTPUT | Extract core, check if already done, assess current relevance | Decision: act/park/discard with reason | | HALF_THOUGHT | Complete the thought, find the value path | Fleshed-out version with next step | **Prototype cost formula** (for any buildable idea): - Website/app: hours × $0 (we build) + API costs + hosting. Estimate tokens for AI-assisted build. - Script/tool: lines of code estimate → token estimate (1 LOC ≈ 10-20 tokens to generate) - Research: number of searches + fetches × ~500 tokens each - Total = build tokens + test tokens + fix tokens (budget 30% extra for iteration) **"Solid" means tested.** First pass is never solid. Flag items that need a second pass. Append output under the prompt entry. Update status to `[~] PLAYING`. Take factual notes: what was done, what was produced, what was discovered. ## Step 3: THINK (per prompt, immediately after PLAY) Answer 5 questions (keep tight, 1-2 lines each): 1. **Learned**: factual takeaway 2. **Pertinent**: relevant to user's current projects/goals? 3. **Value**: creative thinking → value creation → money path? 4. **Act?**: yes/no — if yes, smallest next step 5. **Future**: park / discard / investigate deeper Tag: 🟢 ACT NOW | 🟡 PARK | 🔴 DISCARD | 🔵 INVESTIGATE Update status to `[x] DONE` with tag. ## Step 4: CHECKPOINT (every 5 prompts) Brief summary: what's covered, patterns emerging, top value items so far. Ask: "Continue, pause, or pivot?" — if no response in 30s, continue. ## Step 5: META-THINK (on "done" or batch exhausted) Review all Think notes. Produce: 1. **Value Stack** — ranked by expected value 2. **Patterns** — themes, connections 3. **Action Items** — concrete next steps 4. **Park List** — not now but maybe later 5. **Discard List** — safe to ignore (1-line reason each) Append to batch doc. Update status to `COMPLETE`. Append 🟢 items to `systems/batch-cognition/value-stack.md`. Append 🟡 items to `systems/batch-cognition/parked.md`. Append 🔴 items to `systems/batch-cognition/discarded.md`. Log any cross-batch connections to `systems/batch-cognition/connection-graph.md`. ## Commands (user can say anytime) `skip` — skip current prompt | `deeper` — spend more tokens | `park` — park for later `pause` — stop, resume later | `resume` — continue paused batch | `status` — show progress `value stack` — show current ranked items | `done` — trigger meta-think + close ## Context Management Rolling decay memory — each checkpoint creates a new block in a chain. Items decay 20% per block. Referenced items reset to full weight. Below 0.2 = archived (never lost). See [references/rolling-decay-memory.md](references/rolling-decay-memory.md) for full spec. At each checkpoint: 1. Score all items: `salience *= 0.8`, re-referenced items → `1.0` 2. Drop items below 0.2 threshold (write tombstone, archive to disk) 3. Carry forward: rolling summary + surviving high-salience items + value stack 4. New block header written to chain file Cross-batch: last batch's survivors enter new batch at 0.8, connect to new items → reset to 1.0. See [references/drive-mode.md](references/drive-mode.md) when processing Drive folder dumps. ## Self-Improvement After each batch, append to `workspace/systems/batch-cognition/learnings.md`: - What worked / what was wasted / grouping improvements / play-think split effectiveness - Update this skill if any rule changes warranted. ## Key Rules - **SAVE FIRST** — never process before saving full batch to file - **Never lose input** — if Telegram truncates or splits, wait for "done" before processing - **Play and Think are separate** — don't blend execution with inference - **Notes are mandatory** — both Play notes and Think notes, every prompt - **Prompts aren't always instructions** — some are ideas, half-thoughts, value discovery. THINK phase handles these. - **PLAY means EXECUTE, not summarize** — if it says build, build. If it says research, research with sources. If it's an idea, scope it with real numbers. - **First pass is never final** — flag items that need deeper work. A 🟢 tag without execution is just a bookmark. - **Prototype cost is mandatory for buildable ideas** — hours, tokens, API costs, hosting. Not vibes.

path: references/drive-mode.md
content: # Drive Mode — Batch Cognition for Google Drive Dumps

## When to Use
User says "process drive folder" or references Google Drive content for batch processing.

## Flow

### 1. Navigate
GUI agent opens Google Drive → target folder.
List all files: name, type, last modified, size.

### 2. Quick-Scan (first 500 chars per file)
Classify each file:
- 📋 **ACTIONABLE** — clear task/idea with potential value → process in play/think loop
- 🧩 **PARTIAL** — half-finished, needs context/completion → process with extra inference
- 📚 **REFERENCE** — useful info but not actionable → note and park
- ❓ **UNKNOWN** — needs deeper read (~1000 tokens inference) → "where could value be?"
- 🗑️ **IRRELEVANT** — skip with 1-line reason

### 3. Process
ACTIONABLE + PARTIAL → standard play/think loop (per SKILL.md)
UNKNOWN → quick inference pass: "if we put effort toward this, where's the value?"
REFERENCE → catalog in batch doc for future recall
IRRELEVANT → log reason, move on

### 4. Output
Same batch doc format. Meta-think at end.
Additional section: **Drive Inventory** — full classified file list for future reference.

## Mixed Topics Handling
Drive dumps have mixed topics. Don't try to group or reorder.
Process sequentially but let the THINK phase find connections.
The meta-think at the end catches cross-file patterns.


path: references/rolling-decay-memory.md
content: # Rolling Decay Memory — Chain-Linked Context Blocks
# Extension to Batch Cognition System

## Concept

Memory blocks linked like a chain. Each block retains 80% of the previous block's
context by salience, drops 20% to archive. Items referenced across blocks survive
(weight resets). Items never referenced decay and fall off the working set — but
are always recoverable from the chain on disk.

Incremented by WORKFLOW (checkpoints, pauses, batch boundaries), not by time.

## Block Format

```markdown
## Block [N] — [trigger: checkpoint|pause|batch-end|resume]
- **Parent**: Block [N-1] hash/link
- **Carried** (80%): [rolling summary of surviving context]
- **Dropped** (20%): [1-line tombstones of what decayed]
- **Promoted**: [items re-referenced this block → weight reset]
- **Added**: [new items processed this block]
- **Working context size**: [token estimate]
```

## Decay Rules

1. Every item has a **salience score** (0.0 to 1.0)
2. New items enter at 1.0
3. At each block boundary, all items decay: `score *= 0.8`
4. If an item is **referenced** (comes up in THINK, connects to new item, user asks about it): `score = 1.0` (full reset)
5. Items below **0.2 threshold** drop from working context → archived with tombstone
6. Tombstone format: `[block N] "first 40 chars..." — dropped (score 0.18, never re-referenced)`

## What Survives

- Items that keep being relevant (referenced across blocks) → permanent working memory
- Items that were one-off but high-value → survive a few blocks then archive with full record
- Noise → drops after 1-2 blocks (score 1.0 → 0.8 → 0.64 → 0.51 → 0.41 → 0.33 → 0.26 → 0.21 → DROPPED)
- That's ~8 blocks before something completely unreferenced falls off

## Recovery

Nothing is deleted. The chain is on disk. To recover:
1. Read block headers backward until you find the tombstone
2. The tombstone links to the original batch doc + item number
3. Pull the full content from the batch doc

This means: **working context is always lean, but total knowledge is always complete.**

## Integration with Batch Cognition

```
SAVE → PRE-SCAN → [Block 0: all items at score 1.0]
                        │
Process items 1-5 → CHECKPOINT → [Block 1: decay, drop, promote]
                                      │
Process items 6-10 → CHECKPOINT → [Block 2: decay, drop, promote]
                                       │
                                      ...
                                       │
DONE → META-THINK → [Final Block: only high-salience items remain]
                         │
                    Surviving items → value-stack.md (permanent)
                    Dropped items → recoverable via chain
```

## Cross-Batch Persistence

When a NEW batch starts:
1. Read last batch's final block (the surviving high-salience items)
2. These enter the new batch at score 0.8 (slight decay for being from a prior batch)
3. If they connect to new items → score resets to 1.0 (cross-batch connection!)
4. If they don't connect → they continue decaying and eventually archive

This creates **compounding intelligence**: ideas that keep being relevant across multiple
batches become effectively permanent. Ideas that were one-session wonders fade gracefully.

## Why Workflow-Incremented, Not Time-Incremented

- Time-based: "delete after 7 days" — arbitrary, kills good stuff, keeps stale stuff
- Workflow-based: "decay at each cognitive checkpoint" — the WORK determines what matters
- A batch of 5 items might have 1 block. A batch of 500 might have 100 blocks.
- Pausing and resuming creates a block boundary (natural context shift)
- The user saying "actually that thing from earlier" promotes it (reference = weight reset)

## Implementation Notes

- Salience scores stored in batch doc alongside each item
- Block headers written to `systems/batch-cognition/chain/[batch-id]-blocks.md`
- Chain index: `systems/batch-cognition/chain/INDEX.md` (links all chains)
- Token budget per block: aim for working context ≤ 2,000 tokens
- Archive is the batch doc itself — always complete on disk


Security scan verdicts — ClawScan: suspicious | static analysis: clean | VirusTotal: clean | SkillSpector: suspicious (CRITICAL)