chore: remove issue drafts (migrated to GitHub)

Issues #1-27 created on host-uk/core-agent.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Snider 2026-02-01 19:27:40 +00:00
parent e5de667849
commit e130d5a8c4
20 changed files with 0 additions and 1862 deletions

View file

@ -1,86 +0,0 @@
# feat: Replace shell scripts with core CLI commands
## Summary
This tracking issue covers the migration from shell scripts to native `core` CLI commands in `core-agent`. Every shell script should be replaced by a `core` command, making the plugin purely configuration (JSON, MD) + calls to `core`.
## Philosophy
- Every agent using `core` tests the framework
- Missing features get raised as issues
- Code as if functionality exists (TDD approach)
- The CLI becomes battle-tested and bulletproof
## Issues
### Claude Code Hooks (core ai)
| Issue | Command | Replaces |
|-------|---------|----------|
| #001 | `core ai session` | pre-compact.sh, session-start.sh, suggest-compact.sh |
| #002 | `core ai context` | capture-context.sh, extract-actionables.sh |
| #003 | `core ai hook` | prefer-core.sh, block-docs.sh, post-commit-check.sh |
### Quality Assurance (core qa)
| Issue | Command | Replaces |
|-------|---------|----------|
| #004 | `core qa debug` | check-debug.sh |
### Data Collection (core collect)
| Issue | Command | Replaces |
|-------|---------|----------|
| #005 | `core collect github` | github-history/collect.sh |
| #006 | `core collect bitcointalk` | bitcointalk/collect.sh |
| #007 | `core collect market` | coinmarketcap/*.sh |
| #008 | `core collect papers` | ledger-papers/discover.sh, collect-whitepaper.sh |
| #009 | `core collect excavate` | project-archaeology/excavate.sh |
| #010 | `core collect process` | job-collector/process.sh |
| #011 | `core collect dispatch` | collection/dispatch.sh |
## Target State
After all issues are implemented:
```
claude/
├── hooks/
│ └── hooks.json # Calls core ai hook validate-*
├── commands/
│ └── remember.md # Calls core ai context add
├── collection/
│ └── hooks.json # Calls core collect dispatch
└── skills/
└── */
└── SKILL.md # Documentation only, calls core collect *
```
No shell scripts. Just JSON config + markdown docs + `core` CLI calls.
### Hook Improvements (feedback cycle)
| Issue | Feature | Purpose |
|-------|---------|---------|
| #012 | Test output filtering | Reduce noise, show only failures |
| #013 | Stop verification | Verify work complete before stopping |
| #014 | Auto-test on edit | Run tests async after code changes |
| #015 | Session context | Inject git/issues/CI context on start |
| #016 | Silent formatting | Auto-format without output noise |
| #017 | Expose/hide policy | Define what to show vs suppress |
### Skills (autonomous workflows)
| Issue | Skill | Purpose |
|-------|-------|---------|
| #018 | `/core:yes` | Auto-approve all, ensure commit before stop |
| #019 | `/core:qa` | Run QA, fix issues iteratively until clean |
## Implementation Order
1. **Phase 1**: `core ai session` + `core ai context` (enables hooks to work)
2. **Phase 2**: `core ai hook` + `core qa debug` (safety + quality)
3. **Phase 3**: Hook improvements (012-017) - better feedback cycle
4. **Phase 4**: Skills (018-019) - autonomous workflows
5. **Phase 5**: `core collect github` + `core collect bitcointalk` (most used)
6. **Phase 6**: Remaining collection commands

View file

@ -1,46 +0,0 @@
# feat(ai): Add session state management for Claude Code hooks
## Summary
Add `core ai session` subcommands to manage Claude Code session state, replacing shell scripts that currently handle this.
## Required Commands
```bash
core ai session save # Save current session state (pre-compact)
core ai session restore # Restore session state (session-start)
core ai session stats # Track tool calls, suggest compaction
core ai session clear # Clear stale session data
```
## Current Shell Scripts Being Replaced
- `claude/scripts/pre-compact.sh` - Saves state before auto-compact
- `claude/scripts/session-start.sh` - Restores context on startup
- `claude/scripts/suggest-compact.sh` - Suggests compaction at intervals
## State to Manage
- Working directory and git branch
- Git status (modified files)
- In-progress todos
- Context facts (decisions, actionables)
- Tool call counter per session
## Storage
State stored in `~/.claude/sessions/`:
- `scratchpad.md` - Human-readable resume state
- `context.json` - Structured context facts
- `stats.json` - Session statistics
## Output Format
```json
{
"saved": true,
"path": "~/.claude/sessions/scratchpad.md",
"facts": 5,
"tool_calls": 47
}
```

View file

@ -1,53 +0,0 @@
# feat(ai): Add context fact management for Claude Code
## Summary
Add `core ai context` subcommands to capture and manage context facts that persist across compaction.
## Required Commands
```bash
core ai context add <fact> [--source=X] # Save a context fact
core ai context list # List current facts
core ai context extract <output> # Extract actionables from tool output
core ai context clear # Clear old context (>3h)
```
## Current Shell Scripts Being Replaced
- `claude/scripts/capture-context.sh` - Stores context facts
- `claude/scripts/extract-actionables.sh` - Extracts actionables from core CLI output
## Context Format
```json
[
{"fact": "Use Action pattern not Service", "source": "user", "ts": 1234567890},
{"fact": "FAIL: TestFoo", "source": "core go test", "ts": 1234567891}
]
```
## Extraction Patterns
The `extract` command should parse output from:
- `core go test` / `core go qa` / `core go lint` - Extract ERROR/WARN/FAIL lines
- `core php test` / `core php stan` - Extract FAIL/Error lines
- `core build` - Extract error/cannot/undefined lines
## Storage
- `~/.claude/sessions/context.json`
- Max 20 items, auto-clear after 3 hours of inactivity
## Example Usage
```bash
# Manual fact
core ai context add "User prefers UK English" --source=user
# Extract from piped output
core go test 2>&1 | core ai context extract
# List facts
core ai context list --json
```

View file

@ -1,60 +0,0 @@
# feat(ai): Add hook validation for Claude Code PreToolUse
## Summary
Add `core ai hook` subcommands to validate commands and file operations for Claude Code hooks.
## Required Commands
```bash
core ai hook validate-command <cmd> # Check if command is safe/allowed
core ai hook validate-file <path> # Check if file creation is allowed
core ai hook post-commit # Check for uncommitted work after commit
```
## Current Shell Scripts Being Replaced
- `claude/hooks/prefer-core.sh` - Blocks dangerous commands, enforces core CLI
- `claude/scripts/block-docs.sh` - Blocks random .md file creation
- `claude/scripts/post-commit-check.sh` - Warns about uncommitted work
## Command Validation Rules
Block these patterns:
- `rm -rf` / `rm -r` (except node_modules, vendor, .cache, dist, build)
- `mv`/`cp` with wildcards
- `xargs` with rm/mv/cp
- `find -exec` with file operations
- `sed -i` (in-place editing)
- `grep -l | ...` (mass file targeting)
- `perl -i`, `awk > file`
Redirect to core:
- `go test/build/fmt/mod` → suggest `core go *`
- `golangci-lint` → suggest `core go lint`
- `composer test` → suggest `core php test`
- `./vendor/bin/pint` → suggest `core php fmt`
- `php artisan serve` → suggest `core php dev`
## File Validation Rules
Allow:
- `README.md`, `CLAUDE.md`, `AGENTS.md`, `CONTRIBUTING.md`, `CHANGELOG.md`, `LICENSE.md`
- Files in `docs/` directory
Block:
- Other `.md` files (suggest using README.md or docs/)
## Output Format (JSON for hooks)
```json
{"decision": "approve"}
```
```json
{"decision": "block", "message": "Use `core go test` instead of raw go test"}
```
```json
{"decision": "warn", "message": "3 files remain uncommitted after commit"}
```

View file

@ -1,58 +0,0 @@
# feat(qa): Add debug statement detection
## Summary
Add `core qa debug` command to detect debug statements in code, for use in Claude Code PostToolUse hooks.
## Required Commands
```bash
core qa debug <file> # Check single file for debug statements
core qa debug --staged # Check all staged files
core qa debug --changed # Check all changed files
```
## Current Shell Script Being Replaced
- `claude/scripts/check-debug.sh` - Warns about debug statements after edits
## Detection Patterns
**Go files (*.go):**
- `fmt.Println`
- `fmt.Printf` (without format verbs suggesting actual logging)
- `log.Println`
- `log.Printf`
- `spew.Dump`
- `pp.Println`
**PHP files (*.php):**
- `dd(`
- `dump(`
- `var_dump(`
- `print_r(`
- `ray(`
**JavaScript/TypeScript (*.js, *.ts, *.tsx):**
- `console.log`
- `console.debug`
- `debugger`
## Output Format
```json
{
"file": "src/main.go",
"warnings": [
{"line": 42, "type": "fmt.Println", "content": "fmt.Println(\"debug\")"},
{"line": 87, "type": "log.Println", "content": "log.Println(err)"}
]
}
```
For hooks, output to stderr:
```
[qa] WARNING: Debug statements found in src/main.go
42: fmt.Println("debug")
87: log.Println(err)
```

View file

@ -1,71 +0,0 @@
# feat(collect): Add GitHub history collection
## Summary
Add `core collect github` command to archive GitHub issues and PRs from repositories and organisations.
## Required Commands
```bash
core collect github <org/repo> # Collect issues + PRs from repo
core collect github <org> --org # Collect all repos in org
core collect github <org1,org2> --org # Batch collect multiple orgs
core collect github <repo> --issues-only # Issues only
core collect github <repo> --prs-only # PRs only
core collect github --check-rate # Show rate limit status
```
## Current Shell Script Being Replaced
- `claude/skills/github-history/collect.sh` - 517 lines of bash
## Features
1. **Rate limit protection**
- Check every N calls
- Auto-pause at 25% remaining (75% used)
- Resume after reset + 10s buffer
2. **Incremental collection**
- Skip already-fetched issues/PRs
- Resume interrupted collections
3. **Reception scoring**
- ADDRESSED: Closed after discussion
- DISMISSED: Labeled wontfix/invalid
- IGNORED: Closed with no response
- STALE: Open with no replies
- ACTIVE: Open with discussion
- MERGED/REJECTED/PENDING for PRs
4. **Output structure**
```
repo/{org}/{repo}/
├── Issue/
│ ├── INDEX.md
│ ├── 001.md
│ └── 002.md
├── PR/
│ ├── INDEX.md
│ ├── 001.md
│ └── 002.md
└── .json/
├── issues-list.json
└── prs-list.json
```
5. **Index generation**
- Markdown tables with seq, GitHub #, title, score
- Score legend
## Output Format
Progress to stderr, final summary to stdout:
```json
{
"repo": "host-uk/core",
"issues": 47,
"prs": 23,
"output": "repo/host-uk/core/"
}
```

View file

@ -1,64 +0,0 @@
# feat(collect): Add BitcoinTalk thread collection
## Summary
Add `core collect bitcointalk` command to archive BitcoinTalk forum threads.
## Required Commands
```bash
core collect bitcointalk <topic-id> # Collect full thread
core collect bitcointalk <url> # Collect from URL
core collect bitcointalk <id> --pages=5 # Limit pages
core collect bitcointalk <id> --output=DIR # Custom output dir
```
## Current Shell Script Being Replaced
- `claude/skills/bitcointalk/collect.sh` - 270 lines of bash + embedded Python
## Features
1. **Rate limiting**
- Respectful delay between requests (default 2s)
- Configurable via `--delay=N`
2. **Post type detection**
- ANN: Original announcement (post #1)
- UPDATE: Contains [UPDATE]/[RELEASE]/[ANNOUNCEMENT]
- QUESTION: Contains question mark in first 200 chars
- COMMUNITY: General discussion
3. **Output structure**
```
bitcointalk-{topic}/
├── INDEX.md
├── pages/
│ ├── page-0.html
│ └── page-20.html
└── posts/
├── POST-0001.md
└── POST-0002.md
```
4. **Post metadata**
- Author
- Date
- Post type/score
- Original content
5. **Incremental collection**
- Resume interrupted collections
- Skip already-fetched pages
## Output Format
```json
{
"topic_id": "2769739",
"title": "Lethean - Privacy Blockchain VPN",
"posts": 1247,
"pages": 63,
"output": "bitcointalk-2769739/"
}
```

View file

@ -1,67 +0,0 @@
# feat(collect): Add cryptocurrency market data collection
## Summary
Add `core collect market` command to collect historical price/market data from CoinMarketCap, CoinGecko, etc.
## Required Commands
```bash
core collect market <coin> # Collect current data
core collect market <coin> --historical # Include historical data
core collect market <coin> --from=2018-01-01 # Date range
core collect market <coin1,coin2> # Multiple coins
core collect market jobs <coin> # Generate job list
```
## Current Shell Scripts Being Replaced
- `claude/skills/coinmarketcap/generate-jobs.sh` - Generates CMC collection jobs
- `claude/skills/coinmarketcap/process.sh` - Processes collected CMC data
## Data Sources
1. **CoinMarketCap**
- Main page (description, links)
- Markets/exchanges
- Historical data
- News
- API endpoints (where available)
2. **CoinGecko** (backup)
- Main page
- API for historical data
## Output Structure
```
market/{coin}/
├── INDEX.md
├── cmc/
│ ├── main.json
│ ├── markets.json
│ └── historical.json
├── coingecko/
│ ├── detail.json
│ └── history.json
└── summary.md
```
## Job Format
For `jobs` subcommand (pipe to collector):
```
URL|FILENAME|TYPE|METADATA
https://coinmarketcap.com/currencies/lethean/|cmc-lethean-main.html|cmc-main|coin=lethean
```
## Output Format
```json
{
"coin": "lethean",
"sources": ["cmc", "coingecko"],
"historical_days": 2190,
"output": "market/lethean/"
}
```

View file

@ -1,68 +0,0 @@
# feat(collect): Add research paper/whitepaper collection
## Summary
Add `core collect papers` command to discover and collect distributed ledger research papers and whitepapers.
## Required Commands
```bash
core collect papers --all # All known papers
core collect papers --category=cryptography # Filter by category
core collect papers --topic=bulletproofs # Filter by topic
core collect papers --project=monero # Filter by project
core collect papers --search-iacr # Search IACR eprint
core collect papers queue <url> # Queue single paper
```
## Current Shell Scripts Being Replaced
- `claude/skills/ledger-papers/discover.sh` - Paper discovery
- `claude/collection/collect-whitepaper.sh` - Queue whitepaper collection
- `claude/collection/update-index.sh` - Update paper index
## Categories
- genesis (Bitcoin, b-money, hashcash, bit gold)
- cryptonote (CryptoNote v2.0, CNS standards)
- mrl (Monero Research Lab papers)
- privacy (Zcash, Dash, Mimblewimble, Lelantus)
- smart-contracts (Ethereum, Solana, Cardano)
- layer2 (Lightning, Plasma, Rollups)
- consensus (PBFT, Tendermint, HotStuff)
- cryptography (Bulletproofs, CLSAG, PLONK)
- defi (Uniswap, Aave, Compound)
- storage (IPFS, Filecoin, Arweave)
- identity (DIDs, Verifiable Credentials)
- attacks (Selfish mining, eclipse, traceability)
## Registry
Papers defined in `registry.json`:
```json
{
"id": "bulletproofs",
"title": "Bulletproofs: Short Proofs for Confidential Transactions",
"year": 2017,
"url": "https://eprint.iacr.org/2017/1066.pdf",
"topics": ["range-proofs", "zero-knowledge"]
}
```
## Output Format
Job list for collection:
```
URL|FILENAME|TYPE|METADATA
https://bitcoin.org/bitcoin.pdf|bitcoin.pdf|paper|category=genesis,title=Bitcoin...
```
Summary:
```json
{
"papers": 91,
"categories": 15,
"queued": 3,
"output": "papers/"
}
```

View file

@ -1,92 +0,0 @@
# feat(collect): Add project archaeology/excavation
## Summary
Add `core collect excavate` command to perform deep excavation of abandoned cryptocurrency projects before data is lost.
## Required Commands
```bash
core collect excavate <project> # Full excavation
core collect excavate <project> --scan-only # Check what's accessible
core collect excavate <project> --resume # Resume interrupted dig
core collect excavate <project> --only=github,btt # Specific collectors
```
## Current Shell Script Being Replaced
- `claude/skills/project-archaeology/excavate.sh` - 312 lines of bash
## Excavation Pipeline
Runs collectors in priority order:
| Phase | Source | Collector | Priority | Notes |
|-------|--------|-----------|----------|-------|
| 1 | GitHub repos | `collect github` | P1 | Often deleted first |
| 1 | GitHub releases | `collect github` | P1 | Binaries disappear |
| 2 | BitcoinTalk ANN | `collect bitcointalk` | P2 | Usually persists |
| 2 | Website (Wayback) | `collect wayback` | P2 | Snapshots exist |
| 3 | Block explorer | `collect explorer` | P3 | Chain data |
| 3 | CoinMarketCap | `collect market` | P3 | Historical prices |
| 4 | Reddit | `collect reddit` | P4 | Community context |
| 4 | Medium posts | `collect medium` | P4 | Announcements |
## Project Registry
Projects defined in `cryptonote-discovery/registry.json`:
```json
{
"name": "Masari",
"symbol": "MSR",
"status": "abandoned",
"github": ["masari-project"],
"bitcointalk": "2769739",
"website": "getmasari.org",
"explorer": "explorer.getmasari.org",
"cmc": "masari"
}
```
## Output Structure
```
digs/{project}/
├── EXCAVATION.md # Dig log with timestamps
├── SALVAGE-REPORT.md # What's worth keeping
├── LESSONS.md # Post-mortem analysis
├── github/ # All repo history
├── releases/ # Wallet binaries, checksums
├── bitcointalk/ # Thread archive
├── website/ # Wayback snapshots
├── explorer/ # Chain data samples
├── market/ # Price history
├── papers/ # Whitepapers, docs
└── community/ # Reddit, Medium, etc
```
## Scan Mode
`--scan-only` checks accessibility without downloading:
- GitHub org accessible?
- BitcoinTalk thread exists?
- Wayback snapshots available?
- Block explorer online?
- CMC page exists?
## Output Format
```json
{
"project": "masari",
"status": "abandoned",
"accessible": {
"github": true,
"bitcointalk": true,
"wayback": true,
"explorer": false,
"cmc": true
},
"output": "digs/masari/"
}
```

View file

@ -1,70 +0,0 @@
# feat(collect): Add collected data processing
## Summary
Add `core collect process` command to convert collected HTML/JSON files into clean markdown.
## Required Commands
```bash
core collect process <source> <downloads-dir> # Process downloaded files
core collect process bitcointalk ./downloads # BitcoinTalk HTML → MD
core collect process reddit ./downloads # Reddit JSON → MD
core collect process wayback ./downloads # Wayback HTML → MD
core collect process medium ./downloads # Medium RSS → MD
```
## Current Shell Script Being Replaced
- `claude/skills/job-collector/process.sh` - 243 lines of bash + embedded Python
## Supported Sources
1. **bitcointalk** / **btt**
- Input: HTML pages
- Extract: posts, authors, dates
- Output: POST-NNNN.md files
2. **reddit**
- Input: JSON from Reddit API
- Extract: posts, comments, scores
- Output: REDDIT-NNNN.md files
3. **wayback**
- Input: HTML from Wayback Machine
- Extract: title, body text
- Output: {basename}.md files
4. **medium**
- Input: RSS/XML feed
- Extract: title, author, date, content
- Output: MEDIUM-NNNN.md files
## Output Structure
```
processed/
├── INDEX.md
└── posts/
├── POST-0001.md
├── POST-0002.md
└── ...
```
## Index Generation
Auto-generates INDEX.md with:
- Source metadata
- Post count
- Links to all posts
## Output Format
```json
{
"source": "bitcointalk",
"input_files": 15,
"posts_extracted": 347,
"output": "processed/"
}
```

View file

@ -1,73 +0,0 @@
# feat(collect): Add event hook dispatch system
## Summary
Add `core collect dispatch` command to fire events during data collection, allowing modular hook handling.
## Required Commands
```bash
core collect dispatch <event> [args...] # Fire an event
core collect dispatch on_url_found <url> # URL discovered
core collect dispatch on_file_collected <file> <type> # File downloaded
core collect dispatch on_collection_complete # Batch finished
core collect hooks list # List registered hooks
core collect hooks register <event> <handler> # Register new hook
```
## Current Shell Script Being Replaced
- `claude/collection/dispatch.sh` - Hook dispatcher
## Events
| Event | Trigger | Args |
|-------|---------|------|
| `on_url_found` | URL discovered during collection | url |
| `on_file_collected` | File successfully downloaded | file, type |
| `on_collection_complete` | Job batch finishes | - |
## Hook Registration
Hooks defined in `hooks.json`:
```json
{
"hooks": {
"on_url_found": [
{
"name": "whitepaper-collector",
"pattern": "\\.pdf$",
"handler": "collect papers queue",
"priority": 10,
"enabled": true
}
]
}
}
```
## Pattern Matching
- Hooks can specify regex pattern for filtering
- Only matching events trigger the handler
- Multiple hooks can handle same event (priority ordering)
## Handler Types
1. **Core commands**: `collect papers queue`
2. **Shell scripts**: `./my-handler.sh`
3. **External binaries**: `/usr/local/bin/handler`
## Output Format
```json
{
"event": "on_url_found",
"args": ["https://example.com/paper.pdf"],
"handlers_fired": 2,
"results": [
{"handler": "whitepaper-collector", "status": "ok"},
{"handler": "archive-notifier", "status": "ok"}
]
}
```

View file

@ -1,80 +0,0 @@
# feat(hooks): Reduce test noise with smart output filtering
## Summary
Add PostToolUse hooks that filter test output to show only what matters - failures and summaries, not passing tests.
## Problem
When running `core go test` or `core php test`, the full output floods the context:
- Hundreds of "PASS" lines for passing tests
- Verbose coverage output
- Repetitive timing information
This wastes context window and makes failures harder to spot.
## Solution
PostToolUse hooks that:
1. Parse test output
2. Extract only failures, errors, and summary
3. Return filtered output as `additionalContext`
4. Use `suppressOutput: true` to hide the verbose original
## Hook Configuration
```json
{
"hooks": {
"PostToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "core ai filter test-output"
}
]
}
]
}
}
```
## Filter Logic
**Go tests:**
- Show: FAIL, ERROR, panic, --- FAIL
- Hide: PASS, RUN, coverage lines (unless requested)
- Summary: "47 passed, 2 failed, 1 skipped"
**PHP/Pest tests:**
- Show: ✗, FAIL, Error, Exception
- Hide: ✓, passing test names
- Summary: "Tests: 47 passed, 2 failed"
**Lint output:**
- Show: actual errors/warnings with file:line
- Hide: "no issues found" for each file
- Summary: "3 issues in 2 files"
## Output Format
```json
{
"suppressOutput": true,
"hookSpecificOutput": {
"hookEventName": "PostToolUse",
"additionalContext": "## Test Results\n\n✗ 2 failed, 47 passed\n\n### Failures:\n- TestFoo: expected 5, got 3\n- TestBar: nil pointer"
}
}
```
## Command Detection
Only filter when command matches:
- `core go test*`
- `core php test*`
- `core go lint*`
- `core php stan*`
- `core qa*`

View file

@ -1,98 +0,0 @@
# feat(hooks): Stop hook to verify work is complete
## Summary
Add a Stop hook that verifies Claude has actually completed the task before stopping, preventing premature "I'm done" responses.
## Problem
Claude sometimes stops too early:
- "I've updated the file" (but didn't run tests)
- "The fix is complete" (but there are lint errors)
- "Done" (but left debug statements)
## Solution
A Stop hook (type: "agent") that spawns a verification subagent to check:
1. Were tests run? Did they pass?
2. Are there uncommitted changes that should be committed?
3. Are there debug statements left in code?
4. Does the output match what was requested?
## Hook Configuration
```json
{
"hooks": {
"Stop": [
{
"hooks": [
{
"type": "agent",
"prompt": "Verify the work is complete. Check: 1) Tests passed if code was changed, 2) No debug statements (dd, dump, fmt.Println), 3) Code is formatted. Context: $ARGUMENTS",
"timeout": 60
}
]
}
]
}
}
```
## Alternative: Command-based
For faster verification without subagent overhead:
```json
{
"hooks": {
"Stop": [
{
"hooks": [
{
"type": "command",
"command": "core ai verify-complete"
}
]
}
]
}
}
```
## Verification Checks
`core ai verify-complete` should check:
1. **If code was modified:**
- Run `core go test` or `core php test`
- Check for debug statements
- Verify formatting
2. **If commit was requested:**
- Check git status for uncommitted changes
3. **Return decision:**
```json
{
"decision": "block",
"reason": "Tests have not been run. Please run: core go test"
}
```
## Guard Against Loops
Check `stop_hook_active` to prevent infinite loops:
```bash
#!/bin/bash
INPUT=$(cat)
STOP_ACTIVE=$(echo "$INPUT" | jq -r '.stop_hook_active')
if [ "$STOP_ACTIVE" = "true" ]; then
# Already continued once, allow stop
exit 0
fi
# Run verification...
```

View file

@ -1,97 +0,0 @@
# feat(hooks): Auto-run tests after code changes (async)
## Summary
Add async PostToolUse hooks that automatically run tests after Write/Edit operations, reporting results without blocking.
## Problem
Claude often edits code but forgets to run tests, or runs tests manually each time which is slow and repetitive.
## Solution
Async PostToolUse hooks that:
1. Detect code file changes (*.go, *.php, *.ts)
2. Run relevant tests in background
3. Report results on next turn via `systemMessage`
## Hook Configuration
```json
{
"hooks": {
"PostToolUse": [
{
"matcher": "Write|Edit",
"hooks": [
{
"type": "command",
"command": "core ai auto-test",
"async": true,
"timeout": 120,
"statusMessage": "Running tests..."
}
]
}
]
}
}
```
## Test Detection Logic
`core ai auto-test` should:
1. **Read file path from stdin:**
```bash
FILE=$(jq -r '.tool_input.file_path')
```
2. **Detect test scope:**
- `*.go` in `pkg/foo/``core go test ./pkg/foo/...`
- `*.php` in `src/``core php test --filter=related`
- `*_test.go` → run that specific test file
- `*.spec.ts` → run that specific spec
3. **Run minimal test set:**
- Don't run full suite on every change
- Use `--filter` or package scope
- Cache recent test runs
4. **Report results:**
```json
{
"systemMessage": "Tests for pkg/foo: 12 passed, 0 failed (2.3s)"
}
```
## Smart Test Selection
For Go:
```bash
# Find related test file
TEST_FILE="${FILE%.go}_test.go"
if [ -f "$TEST_FILE" ]; then
core go test -run "$(basename $TEST_FILE .go)" ./...
else
# Run package tests
PKG_DIR=$(dirname "$FILE")
core go test "./$PKG_DIR/..."
fi
```
For PHP:
```bash
# Find related test
TEST_FILE=$(echo "$FILE" | sed 's/\.php$/Test.php/' | sed 's|src/|tests/|')
if [ -f "$TEST_FILE" ]; then
core php test "$TEST_FILE"
fi
```
## Debouncing
Avoid running tests multiple times for rapid edits:
- Track last test run per package
- Skip if <5 seconds since last run
- Queue and batch rapid changes

View file

@ -1,101 +0,0 @@
# feat(hooks): SessionStart context injection
## Summary
Add SessionStart hooks that inject relevant project context at the start of each session.
## Problem
Claude starts each session without knowing:
- Recent git changes
- Open issues assigned to the user
- CI status
- Current branch and uncommitted work
This leads to repeated context-gathering at the start of every session.
## Solution
SessionStart hook that runs `core` commands to gather context and inject it.
## Hook Configuration
```json
{
"hooks": {
"SessionStart": [
{
"matcher": "startup|resume",
"hooks": [
{
"type": "command",
"command": "core ai session-context",
"timeout": 30
}
]
}
]
}
}
```
## Context to Gather
`core ai session-context` should collect:
1. **Git status:**
```bash
BRANCH=$(git branch --show-current)
CHANGES=$(git status --short | head -10)
```
2. **Recent activity:**
```bash
COMMITS=$(git log --oneline -5)
```
3. **Open issues (if gh available):**
```bash
ISSUES=$(core dev issues --assignee @me --limit 5)
```
4. **CI status:**
```bash
CI=$(core qa health --brief)
```
5. **Restored session state:**
```bash
if [ -f ~/.claude/sessions/scratchpad.md ]; then
# Include previous session context
fi
```
## Output Format
```json
{
"hookSpecificOutput": {
"hookEventName": "SessionStart",
"additionalContext": "## Session Context\n\n**Branch:** feature/foo\n**Uncommitted:** 3 files\n\n**Recent commits:**\n- abc123 fix: resolve test flake\n- def456 feat: add new endpoint\n\n**Your issues:**\n- #42 Bug in login flow\n- #38 Add caching\n\n**CI:** All green ✓"
}
}
```
## Environment Variables
Also set useful env vars via `CLAUDE_ENV_FILE`:
```bash
if [ -n "$CLAUDE_ENV_FILE" ]; then
echo "export PROJECT_ROOT=\"$(pwd)\"" >> "$CLAUDE_ENV_FILE"
echo "export GIT_BRANCH=\"$BRANCH\"" >> "$CLAUDE_ENV_FILE"
fi
```
## Conditional Context
Only inject what's relevant:
- Skip CI status if not in a repo with workflows
- Skip issues if gh not authenticated
- Skip session restore if >3 hours old

View file

@ -1,89 +0,0 @@
# feat(hooks): Auto-format code silently after edits
## Summary
Add PostToolUse hooks that silently auto-format code after Write/Edit, without polluting context with formatter output.
## Current State
Current hooks call formatters but output is visible:
- `php-format.sh` - runs Pint
- `go-format.sh` - runs gofmt
This creates noise in the conversation.
## Solution
Use `suppressOutput: true` to hide formatter output entirely.
## Hook Configuration
```json
{
"hooks": {
"PostToolUse": [
{
"matcher": "Write|Edit",
"hooks": [
{
"type": "command",
"command": "core ai format-file",
"statusMessage": "Formatting..."
}
]
}
]
}
}
```
## Implementation
`core ai format-file`:
```bash
#!/bin/bash
INPUT=$(cat)
FILE=$(echo "$INPUT" | jq -r '.tool_input.file_path // empty')
[ -z "$FILE" ] || [ ! -f "$FILE" ] && exit 0
case "$FILE" in
*.go)
core go fmt "$FILE" 2>/dev/null
;;
*.php)
core php fmt "$FILE" 2>/dev/null
;;
*.ts|*.tsx|*.js|*.jsx)
npx prettier --write "$FILE" 2>/dev/null
;;
*.json)
jq '.' "$FILE" > "$FILE.tmp" && mv "$FILE.tmp" "$FILE" 2>/dev/null
;;
esac
# Suppress all output - formatting is silent
echo '{"suppressOutput": true}'
```
## Benefits
1. **No context pollution** - formatter output hidden
2. **Consistent formatting** - every file formatted on save
3. **No manual step** - Claude doesn't need to remember to format
4. **Fast** - formatters are quick, doesn't block significantly
## Error Handling
Only report if formatting fails badly:
```bash
if ! core go fmt "$FILE" 2>&1; then
# Only surface actual errors, not warnings
echo '{"systemMessage": "Format failed for '$FILE' - syntax error?"}'
exit 0
fi
echo '{"suppressOutput": true}'
```

View file

@ -1,124 +0,0 @@
# feat(hooks): Define what to expose vs hide in output
## Summary
Document and implement a consistent policy for what hook output should be exposed to Claude vs hidden.
## Principles
**Expose (additionalContext):**
- Errors that need fixing
- Failures that block progress
- Decisions that need to be made
- Security warnings
- Breaking changes
**Hide (suppressOutput):**
- Success confirmations ("formatted", "passed")
- Verbose progress output
- Repetitive status messages
- Debug information
- Intermediate results
## Output Categories
### Always Expose
| Category | Example | Reason |
|----------|---------|--------|
| Test failures | `FAIL: TestFoo` | Must be fixed |
| Build errors | `cannot find package` | Blocks progress |
| Lint errors | `undefined: foo` | Code quality |
| Security alerts | `HIGH vulnerability` | Critical |
| Type errors | `type mismatch` | Must be fixed |
### Always Hide
| Category | Example | Reason |
|----------|---------|--------|
| Pass confirmations | `PASS: TestFoo` | No action needed |
| Format success | `Formatted 3 files` | No action needed |
| Coverage numbers | `coverage: 84.2%` | Unless requested |
| Timing info | `(12.3s)` | Noise |
| Progress bars | `[=====> ]` | Noise |
### Conditional
| Category | Show When | Hide When |
|----------|-----------|-----------|
| Warnings | First occurrence | Repeated |
| Suggestions | Actionable | Informational |
| Diffs | Small (<10 lines) | Large |
| Stack traces | Unique error | Repeated |
## Implementation Pattern
```bash
#!/bin/bash
INPUT=$(cat)
OUTPUT=$(echo "$INPUT" | jq -r '.tool_response.output // empty')
# Extract what matters
ERRORS=$(echo "$OUTPUT" | grep -E "FAIL|ERROR|panic" | head -10)
SUMMARY=$(echo "$OUTPUT" | tail -1)
if [ -n "$ERRORS" ]; then
# Expose failures
cat << EOF
{
"hookSpecificOutput": {
"hookEventName": "PostToolUse",
"additionalContext": "## Issues Found\n\n$ERRORS\n\n**Summary:** $SUMMARY"
}
}
EOF
else
# Hide success
echo '{"suppressOutput": true}'
fi
```
## Hook-Specific Policies
### PostToolUse (Bash)
```
core go test → Expose failures, hide passes
core go lint → Expose errors, hide "no issues"
core build → Expose errors, hide success
git status → Always expose (informational)
git commit → Expose result, hide diff
```
### PostToolUse (Write/Edit)
```
Format result → Always hide
Debug check → Expose if found, hide if clean
```
### PostToolUseFailure
```
All errors → Always expose with context
Interrupts → Hide (user initiated)
```
## Aggregation
When multiple issues, aggregate intelligently:
```
Instead of:
- FAIL: TestA
- FAIL: TestB
- FAIL: TestC
- (47 more)
Show:
"50 tests failed. Top failures:
- TestA: nil pointer
- TestB: timeout
- TestC: assertion failed
Run `core go test -v` for full output"
```

View file

@ -1,164 +0,0 @@
# feat(skill): Add /core:yes auto-approve and commit skill
## Summary
Add a `/core:yes` skill that auto-approves all permission requests and ensures work completes with a commit - like a "just do it" mode for trusted workflows.
## Use Case
When you trust Claude to complete a task end-to-end:
```
/core:yes fix the failing test and commit
```
Instead of:
1. Claude proposes edit → you approve
2. Claude runs test → you approve
3. Claude proposes commit → you approve
It just does it all and commits.
## Skill Definition
`claude/commands/yes.md`:
```markdown
---
name: yes
description: Auto-approve mode - trust Claude to complete task and commit
args: <task description>
hooks:
PermissionRequest:
- hooks:
- type: command
command: "core ai auto-approve"
Stop:
- hooks:
- type: command
command: "core ai ensure-commit"
once: true
---
# Yes Mode
You are in **auto-approve mode**. The user trusts you to complete this task autonomously.
## Task
$ARGUMENTS
## Rules
1. **No confirmation needed** - all tool uses are pre-approved
2. **Complete the full workflow** - don't stop until done
3. **Commit when finished** - create a commit with the changes
4. **Use conventional commits** - type(scope): description
## Workflow
1. Understand the task
2. Make necessary changes (edits, writes)
3. Run tests to verify (`core go test` or `core php test`)
4. Format code (`core go fmt` or `core php fmt`)
5. Commit changes with descriptive message
6. Report completion
Do NOT stop to ask for confirmation. Just do it.
```
## Hook Implementations
### core ai auto-approve
Auto-approves all permission requests during the skill:
```bash
#!/bin/bash
# Reads PermissionRequest input, returns allow decision
INPUT=$(cat)
TOOL=$(echo "$INPUT" | jq -r '.tool_name')
# Log what we're approving
echo "[yes-mode] Auto-approving: $TOOL" >&2
# Return allow decision
cat << EOF
{
"hookSpecificOutput": {
"hookEventName": "PermissionRequest",
"decision": {
"behavior": "allow"
}
}
}
EOF
```
### core ai ensure-commit
Stop hook that ensures work ends with a commit:
```bash
#!/bin/bash
INPUT=$(cat)
STOP_ACTIVE=$(echo "$INPUT" | jq -r '.stop_hook_active')
# Prevent infinite loop
if [ "$STOP_ACTIVE" = "true" ]; then
exit 0
fi
# Check for uncommitted changes
CHANGES=$(git status --porcelain 2>/dev/null | wc -l | tr -d ' ')
if [ "$CHANGES" -gt 0 ]; then
cat << EOF
{
"decision": "block",
"reason": "You have uncommitted changes. Please commit them before stopping. Use: git add -A && git commit -m 'type(scope): description'"
}
EOF
else
exit 0
fi
```
## Safety Considerations
1. **Skill-scoped hooks** - only active while `/core:yes` is running
2. **once: true on Stop hook** - prevents infinite loops
3. **Still respects blocked commands** - prefer-core.sh still blocks dangerous patterns
4. **Commit required** - ensures changes are tracked
## Alternative: Permission Mode
Could also be implemented as a permission mode flag:
```bash
claude --permission-mode=dontAsk
```
But the skill approach is more explicit and adds the commit requirement.
## Example Usage
```
> /core:yes add a --version flag to the CLI that prints the version from go.mod
[yes-mode] Auto-approving: Read
[yes-mode] Auto-approving: Edit
[yes-mode] Auto-approving: Bash (core go test)
[yes-mode] Auto-approving: Bash (git commit)
Done. Created commit: feat(cli): add --version flag
```
## Integration with core CLI
Eventually this becomes:
```bash
core ai yes "fix the failing test"
```
Which spawns Claude in yes-mode with the task.

View file

@ -1,301 +0,0 @@
# feat(skill): Add /core:qa iterative QA fix loop
## Summary
Add a `/core:qa` skill that runs the full QA pipeline, extracts actionable issues, and guides Claude through fixing them one by one until everything passes.
## Use Case
```
/core:qa
```
Runs `core go qa` or `core php qa`, parses output, and iteratively fixes issues:
```
[QA] Running core go qa...
[QA] Found 3 issues:
1. ✗ lint: undefined: ErrNotFound (pkg/api/handler.go:42)
2. ✗ test: TestCreateUser failed - expected 200, got 500
3. ✗ fmt: pkg/api/handler.go needs formatting
Fixing issue 1/3: undefined: ErrNotFound
→ Reading pkg/api/handler.go...
→ Adding missing import...
→ Fixed.
Fixing issue 2/3: TestCreateUser failed
→ Reading test output...
→ The handler returns 500 because ErrNotFound wasn't defined
→ Already fixed by issue 1, re-running test...
→ Passed.
Fixing issue 3/3: formatting
→ Running core go fmt...
→ Fixed.
[QA] Re-running full QA...
[QA] ✓ All checks passed!
```
## Skill Definition
`claude/commands/qa.md`:
```markdown
---
name: qa
description: Run QA checks and fix all issues iteratively
hooks:
PostToolUse:
- matcher: "Bash"
hooks:
- type: command
command: "core ai qa-filter"
Stop:
- hooks:
- type: command
command: "core ai qa-verify"
once: true
---
# QA Fix Loop
Run the full QA pipeline and fix all issues.
## Detection
First, detect the project type:
- If `go.mod` exists → Go project → `core go qa`
- If `composer.json` exists → PHP project → `core php qa`
- If both exist → ask user or check current directory
## Process
1. **Run QA**: Execute `core go qa` or `core php qa`
2. **Parse issues**: Extract failures from output (see format below)
3. **Fix each issue**: Address one at a time, simplest first
4. **Re-verify**: After fixes, re-run QA
5. **Repeat**: Until all checks pass
6. **Report**: Summary of what was fixed
## Issue Priority
Fix in this order (fastest feedback first):
1. **fmt** - formatting issues (auto-fix with `core go fmt`)
2. **lint** - static analysis (usually quick fixes)
3. **test** - failing tests (may need more investigation)
4. **build** - compilation errors (fix before tests can run)
## Output Parsing
### Go QA Output
```
=== FMT ===
FAIL: pkg/api/handler.go needs formatting
=== LINT ===
pkg/api/handler.go:42:15: undefined: ErrNotFound (typecheck)
pkg/api/handler.go:87:2: ineffectual assignment to err (ineffassign)
=== TEST ===
--- FAIL: TestCreateUser (0.02s)
handler_test.go:45: expected 200, got 500
FAIL
=== RESULT ===
fmt: FAIL
lint: FAIL (2 issues)
test: FAIL (1 failed)
```
### PHP QA Output
```
=== PINT ===
FAIL: 2 files need formatting
=== STAN ===
src/Http/Controller.php:42 - Undefined variable $user
=== TEST ===
✗ CreateUserTest::testSuccess
Expected status 200, got 500
=== RESULT ===
pint: FAIL
stan: FAIL (1 error)
test: FAIL (1 failed)
```
## Fixing Strategy
**Formatting (fmt/pint):**
- Just run `core go fmt` or `core php fmt`
- No code reading needed
**Lint errors:**
- Read the specific file:line
- Understand the error type
- Make minimal fix
**Test failures:**
- Read the test file to understand expectation
- Read the implementation
- Fix the root cause (not just the symptom)
**Build errors:**
- Usually missing imports or typos
- Fix before attempting other checks
## Stop Condition
Only stop when:
- All QA checks pass, OR
- User explicitly cancels, OR
- Same error repeats 3 times (stuck)
```
## Hook Implementations
### core ai qa-filter
Filters QA output to show only actionable issues:
```bash
#!/bin/bash
INPUT=$(cat)
COMMAND=$(echo "$INPUT" | jq -r '.tool_input.command // empty')
OUTPUT=$(echo "$INPUT" | jq -r '.tool_response.output // empty')
# Only process QA commands
case "$COMMAND" in
"core go qa"*|"core php qa"*|"core go test"*|"core php test"*|"core go lint"*|"core php stan"*)
;;
*)
echo "$INPUT"
exit 0
;;
esac
# Extract failures only
FAILURES=$(echo "$OUTPUT" | grep -E "^(FAIL|---\s*FAIL|✗|ERROR|undefined:|error:)" | head -20)
SUMMARY=$(echo "$OUTPUT" | grep -E "^(fmt:|lint:|test:|pint:|stan:|RESULT)" | tail -5)
if [ -z "$FAILURES" ]; then
# All passed - show brief summary
echo '{"suppressOutput": true, "hookSpecificOutput": {"hookEventName": "PostToolUse", "additionalContext": "✓ QA passed"}}'
else
# Show only failures
cat << EOF
{
"suppressOutput": true,
"hookSpecificOutput": {
"hookEventName": "PostToolUse",
"additionalContext": "## QA Issues\n\n\`\`\`\n$FAILURES\n\`\`\`\n\n**Summary:** $SUMMARY"
}
}
EOF
fi
```
### core ai qa-verify
Stop hook that ensures QA passes before stopping:
```bash
#!/bin/bash
INPUT=$(cat)
STOP_ACTIVE=$(echo "$INPUT" | jq -r '.stop_hook_active')
if [ "$STOP_ACTIVE" = "true" ]; then
exit 0
fi
# Detect project type and run QA
if [ -f "go.mod" ]; then
RESULT=$(core go qa 2>&1)
elif [ -f "composer.json" ]; then
RESULT=$(core php qa 2>&1)
else
exit 0
fi
# Check if passed
if echo "$RESULT" | grep -q "FAIL\|ERROR\|✗"; then
ISSUES=$(echo "$RESULT" | grep -E "^(FAIL|ERROR|✗|undefined:)" | head -5)
cat << EOF
{
"decision": "block",
"reason": "QA still has issues:\n$ISSUES\n\nPlease fix these before stopping."
}
EOF
else
exit 0
fi
```
## Example Session
```
> /core:qa
Detecting project type... Found go.mod → Go project
Running: core go qa
## QA Issues
```
pkg/api/handler.go:42:15: undefined: ErrNotFound
--- FAIL: TestCreateUser (0.02s)
```
**Summary:** lint: FAIL (1) | test: FAIL (1)
---
Fixing lint issue: undefined ErrNotFound
Reading pkg/api/handler.go...
The error variable is used but not defined. Adding:
var ErrNotFound = errors.New("not found")
Running: core go qa
## QA Issues
```
--- FAIL: TestCreateUser (0.02s)
expected 200, got 404
```
**Summary:** lint: PASS | test: FAIL (1)
---
Fixing test issue: expected 200, got 404
Reading the test... it expects success but handler now returns 404.
The test data doesn't have a matching record. Fixing test setup...
Running: core go qa
✓ QA passed
---
**Summary:**
- Fixed: undefined ErrNotFound (added error variable)
- Fixed: TestCreateUser (corrected test setup)
- 2 issues resolved, all checks passing
```
## Future CLI Integration
```bash
core ai qa # Run QA fix loop
core ai qa --check-only # Just report, don't fix
core ai qa --fmt-only # Only fix formatting
```