refactor: restructure as Claude Code marketplace plugin

- Add .claude-plugin/plugin.json manifest for auto-updates
- Move claude/ contents to root level (commands/, hooks/, scripts/, skills/)
- Update hooks.json to use ${CLAUDE_PLUGIN_ROOT} for portability
- Add .gitignore for IDE files
- Update CLAUDE.md with new structure and installation instructions

Plugin can now be installed via:
  claude plugin add host-uk/core-agent

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Snider 2026-02-01 19:35:06 +00:00
parent e130d5a8c4
commit ecefb8a952
89 changed files with 91 additions and 76 deletions

View file

@ -0,0 +1,25 @@
{
"name": "core-agent",
"description": "Advanced Claude Code plugin for Host UK monorepo - core CLI integration, data collection skills, and autonomous workflows",
"version": "0.1.0",
"author": {
"name": "Host UK",
"email": "hello@host.uk.com"
},
"homepage": "https://github.com/host-uk/core-agent",
"repository": {
"type": "git",
"url": "https://github.com/host-uk/core-agent.git"
},
"license": "EUPL-1.2",
"keywords": [
"devops",
"monorepo",
"go",
"php",
"laravel",
"data-collection",
"cryptocurrency",
"archive"
]
}

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
.idea/

View file

@ -90,33 +90,51 @@ If `core` doesn't have what you need:
3. **Write a TDD test** for the expected behaviour
4. The feature will get implemented and your code will work
## Installation
```bash
claude plugin add host-uk/core-agent
```
Or for local development:
```bash
claude plugin add /path/to/core-agent
```
## Repository Structure
```
core-agent/
└── claude/
├── hooks/ # Claude Code hooks
│ ├── hooks.json # Hook definitions
│ └── prefer-core.sh # PreToolUse: enforce core CLI
├── scripts/ # Automation scripts
│ ├── pre-compact.sh # Save state before compaction
│ ├── session-start.sh # Restore context on startup
│ ├── php-format.sh # Auto-format PHP after edits
│ ├── go-format.sh # Auto-format Go after edits
│ └── check-debug.sh # Warn about debug statements
├── commands/
│ └── remember.md # /core:remember command
├── collection/ # Data collection event hooks
│ ├── hooks.json # Collection hook registration
│ ├── dispatch.sh # Hook dispatcher
│ └── *.sh # Event handlers
└── skills/ # Data collection skills
├── ledger-papers/ # Whitepaper archive (91+ papers)
├── project-archaeology/ # Dead project excavation
├── bitcointalk/ # BitcoinTalk thread collection
├── coinmarketcap/ # Market data collection
├── github-history/ # Git history preservation
└── ... # Other collectors
├── .claude-plugin/
│ └── plugin.json # Plugin manifest (enables auto-updates)
├── hooks.json # Hook definitions
├── hooks/ # Hook scripts
│ └── prefer-core.sh # PreToolUse: enforce core CLI
├── scripts/ # Automation scripts
│ ├── pre-compact.sh # Save state before compaction
│ ├── session-start.sh # Restore context on startup
│ ├── php-format.sh # Auto-format PHP after edits
│ ├── go-format.sh # Auto-format Go after edits
│ ├── check-debug.sh # Warn about debug statements
│ ├── auto-approve.sh # /core:yes PermissionRequest hook
│ ├── ensure-commit.sh # /core:yes Stop hook
│ ├── qa-filter.sh # /core:qa PostToolUse hook
│ └── qa-verify.sh # /core:qa Stop hook
├── commands/ # Slash commands (skills)
│ ├── remember.md # /core:remember - persist facts
│ ├── yes.md # /core:yes - auto-approve mode
│ └── qa.md # /core:qa - iterative QA fix loop
├── collection/ # Data collection event hooks
│ ├── hooks.json # Collection hook registration
│ ├── dispatch.sh # Hook dispatcher
│ └── *.sh # Event handlers
└── skills/ # Data collection skills
├── ledger-papers/ # Whitepaper archive (91+ papers)
├── project-archaeology/ # Dead project excavation
├── bitcointalk/ # BitcoinTalk thread collection
├── coinmarketcap/ # Market data collection
├── github-history/ # Git history preservation
└── ... # Other collectors
```
## Claude Plugin Features
@ -151,9 +169,11 @@ The plugin blocks dangerous patterns and enforces `core` CLI:
- `./vendor/bin/pint``core php fmt`
- `php artisan serve``core php dev`
### Commands
### Commands (Skills)
- `/core:remember <fact>` - Save context that persists across compaction
- `/core:yes <task>` - Auto-approve mode with commit requirement
- `/core:qa` - Iterative QA fix loop (runs until all checks pass)
### Context Preservation
@ -197,19 +217,19 @@ Excavates abandoned CryptoNote projects before data is lost.
```bash
# Simulate PreToolUse hook input
echo '{"tool_input": {"command": "rm -rf /"}}' | bash ./claude/hooks/prefer-core.sh
echo '{"tool_input": {"command": "rm -rf /"}}' | bash ./hooks/prefer-core.sh
```
### Adding new hooks
1. Add script to `claude/scripts/`
2. Register in `claude/hooks/hooks.json`
1. Add script to `scripts/`
2. Register in `hooks.json` using `${CLAUDE_PLUGIN_ROOT}/scripts/yourscript.sh`
3. Test with simulated input
### Collection skill structure
```
claude/skills/<name>/
skills/<name>/
├── SKILL.md # Documentation
├── discover.sh # Job generator (outputs URL|FILENAME|TYPE|METADATA)
├── process.sh # Job processor (optional)

View file

@ -1,41 +0,0 @@
# core-claude
Claude Code plugin for the Host UK federated monorepo.
## Installation
```bash
/plugin marketplace add host-uk/core-claude
/plugin install core@core-claude
```
## Features
### Skills
- **core** - Core CLI command reference for multi-repo management
- **core-php** - PHP module patterns for Laravel packages
- **core-go** - Go package patterns for the CLI
### Commands
- `/core:remember <fact>` - Save context facts that persist across compaction
### Hooks
**Safety hooks:**
- Blocks destructive commands (`rm -rf`, `sed -i`, mass operations)
- Enforces `core` CLI over raw `go`/`php` commands
- Prevents random .md file creation
**Context preservation:**
- Saves state before auto-compact (prevents "amnesia")
- Restores recent session context on startup
- Extracts actionables from tool output
**Auto-formatting:**
- PHP files via Pint after edits
- Go files via gofmt after edits
- Warns about debug statements
## Dependencies
- [superpowers](https://github.com/anthropics/claude-plugins-official) from claude-plugins-official

View file

@ -7,10 +7,20 @@
"hooks": [
{
"type": "command",
"command": "bash ./hooks/prefer-core.sh"
"command": "${CLAUDE_PLUGIN_ROOT}/hooks/prefer-core.sh"
}
],
"description": "Block destructive commands (rm -rf, sed -i, xargs rm) and enforce core CLI"
},
{
"matcher": "Write",
"hooks": [
{
"type": "command",
"command": "${CLAUDE_PLUGIN_ROOT}/scripts/block-docs.sh"
}
],
"description": "Block random .md file creation"
}
],
"PostToolUse": [
@ -19,7 +29,7 @@
"hooks": [
{
"type": "command",
"command": "bash ./scripts/go-format.sh"
"command": "${CLAUDE_PLUGIN_ROOT}/scripts/go-format.sh"
}
],
"description": "Auto-format Go files after edits"
@ -29,7 +39,7 @@
"hooks": [
{
"type": "command",
"command": "bash ./scripts/php-format.sh"
"command": "${CLAUDE_PLUGIN_ROOT}/scripts/php-format.sh"
}
],
"description": "Auto-format PHP files after edits"
@ -39,7 +49,7 @@
"hooks": [
{
"type": "command",
"command": "bash ./scripts/check-debug.sh"
"command": "${CLAUDE_PLUGIN_ROOT}/scripts/check-debug.sh"
}
],
"description": "Warn about debug statements (dd, dump, fmt.Println)"
@ -49,7 +59,7 @@
"hooks": [
{
"type": "command",
"command": "bash ./scripts/post-commit-check.sh"
"command": "${CLAUDE_PLUGIN_ROOT}/scripts/post-commit-check.sh"
}
],
"description": "Warn about uncommitted work after git commit"
@ -61,7 +71,7 @@
"hooks": [
{
"type": "command",
"command": "bash ./scripts/pre-compact.sh"
"command": "${CLAUDE_PLUGIN_ROOT}/scripts/pre-compact.sh"
}
],
"description": "Save state before auto-compact to prevent amnesia"
@ -73,7 +83,7 @@
"hooks": [
{
"type": "command",
"command": "bash ./scripts/session-start.sh"
"command": "${CLAUDE_PLUGIN_ROOT}/scripts/session-start.sh"
}
],
"description": "Restore recent session context on startup"