refactor: move shims from templates/ to scripts/ and drop legacy shims

- Remove 4 legacy shim files; only the unified coinhunter_shim.py remains
- Move the remaining shim from templates/ to scripts/ per skill best practices
- Update all docs (README, CLAUDE, shim-templates) to reference scripts/
This commit is contained in:
2026-04-16 03:03:25 +08:00
parent c07b9c1ae5
commit e75c54ca12
8 changed files with 18 additions and 101 deletions

View File

@@ -19,11 +19,8 @@ The actual trading CLI is an **external dependency**: the `coinhunter` package o
- `review-template.md` — Hourly review report structure. - `review-template.md` — Hourly review report structure.
- `scam-signals.md` — Red flags and classification guidance for meme-coin evaluation. - `scam-signals.md` — Red flags and classification guidance for meme-coin evaluation.
- `auto-trading-guide.md` — Legacy-oriented guide for deploying `auto_trader.py` and Binance API setup. - `auto-trading-guide.md` — Legacy-oriented guide for deploying `auto_trader.py` and Binance API setup.
- `templates/` — Thin shim scripts meant to be copied to your platform's scripts directory (e.g. `~/.hermes/scripts/` or `~/.openclaw/scripts/`). Each shim invokes the installed `coinhunter` CLI: - `scripts/` — Thin shim scripts meant to be copied to your platform's scripts directory (e.g. `~/.hermes/scripts/` or `~/.openclaw/scripts/`). Currently contains:
- `coinhunter_precheck_shim.py`Runs `coinhunter pre`. - `coinhunter_shim.py`Unified cross-platform shim that runs any `coinhunter` subcommand (`pre`, `gate`, `review`, `rotate-log`).
- `coinhunter_external_gate_shim.py` — Runs `coinhunter gate`.
- `coinhunter_review_context_shim.py` — Runs `coinhunter review`.
- `rotate_external_gate_log_shim.py` — Runs `coinhunter rotate-log`.
There is no `pyproject.toml`, `Makefile`, or test suite in this repository. There is no `pyproject.toml`, `Makefile`, or test suite in this repository.
@@ -32,7 +29,7 @@ There is no `pyproject.toml`, `Makefile`, or test suite in this repository.
### Skill vs runtime separation ### Skill vs runtime separation
- **Skill code/docs** live in this repository. - **Skill code/docs** live in this repository.
- **Private user state** lives under `~/.coinhunter/` (positions, balances, logs, reviews, cache, gate state). Never commit user data into this repo. - **Private user state** lives under `~/.coinhunter/` (positions, balances, logs, reviews, cache, gate state). Never commit user data into this repo.
- **Platform cron scripts** are copied from `templates/` to your runtime's scripts directory (e.g. `~/.hermes/scripts/` or `~/.openclaw/scripts/`) and invoke the installed `coinhunter` CLI. - **Platform cron scripts** are copied from `scripts/` to your runtime's scripts directory (e.g. `~/.hermes/scripts/` or `~/.openclaw/scripts/`) and invoke the installed `coinhunter` CLI.
### Low-cost trigger architecture ### Low-cost trigger architecture
The framework is designed to minimize LLM invocations: The framework is designed to minimize LLM invocations:
@@ -73,21 +70,15 @@ When modifying or adding trading scripts, these safeguards from `SKILL.md` must
coinhunter --version coinhunter --version
``` ```
- **Validate a shim after editing:** - **Validate the shim after editing:**
```bash ```bash
python3 -m py_compile templates/coinhunter_precheck_shim.py python3 -m py_compile scripts/coinhunter_shim.py
``` ```
- **Copy shims to your platform's scripts directory:** - **Copy the shim to your platform's scripts directory:**
```bash ```bash
# Unified shim (recommended) cp scripts/coinhunter_shim.py ~/.hermes/scripts/coinhunter_shim.py
cp templates/coinhunter_shim.py ~/.hermes/scripts/coinhunter_shim.py # or: cp scripts/coinhunter_shim.py ~/.openclaw/scripts/coinhunter_shim.py
# or: cp templates/coinhunter_shim.py ~/.openclaw/scripts/coinhunter_shim.py
# Legacy individual shims (Hermes backward compatibility)
cp templates/coinhunter_precheck_shim.py ~/.hermes/scripts/coinhunter_precheck.py
cp templates/coinhunter_external_gate_shim.py ~/.hermes/scripts/coinhunter_external_gate.py
cp templates/coinhunter_review_context_shim.py ~/.hermes/scripts/coinhunter_review_context.py
``` ```
- **Inspect user state:** - **Inspect user state:**

View File

@@ -103,27 +103,14 @@ Create your initial `positions.json`:
### 4. Deploy the shims ### 4. Deploy the shims
**Option A — unified shim (recommended for new setups and cross-platform):** Copy the unified shim into your platform's scripts directory. It accepts the subcommand as its first argument:
Copy the single unified shim into your platform's scripts directory. It accepts the subcommand as its first argument:
```bash ```bash
# Hermes # Hermes
cp templates/coinhunter_shim.py ~/.hermes/scripts/coinhunter_shim.py cp scripts/coinhunter_shim.py ~/.hermes/scripts/coinhunter_shim.py
# OpenClaw # OpenClaw
cp templates/coinhunter_shim.py ~/.openclaw/scripts/coinhunter_shim.py cp scripts/coinhunter_shim.py ~/.openclaw/scripts/coinhunter_shim.py
```
**Option B — legacy shims (existing Hermes users, unchanged behavior):**
The original individual shims are still provided for backward compatibility:
```bash
cp templates/coinhunter_precheck_shim.py ~/.hermes/scripts/coinhunter_precheck.py
cp templates/coinhunter_external_gate_shim.py ~/.hermes/scripts/coinhunter_external_gate.py
cp templates/coinhunter_review_context_shim.py ~/.hermes/scripts/coinhunter_review_context.py
cp templates/rotate_external_gate_log_shim.py ~/.hermes/scripts/rotate_external_gate_log.py
``` ```
### 5. Configure the platform cron job ### 5. Configure the platform cron job
@@ -207,12 +194,8 @@ coinhunter/
├── README.md # You are here ├── README.md # You are here
├── SKILL.md # Full framework spec + gate blueprint ├── SKILL.md # Full framework spec + gate blueprint
├── CLAUDE.md # Guidance for Claude Code ├── CLAUDE.md # Guidance for Claude Code
├── templates/ # Platform cron shims (call the installed coinhunter CLI) ├── scripts/ # Platform cron shims (call the installed coinhunter CLI)
── coinhunter_shim.py # Unified cross-platform shim (recommended) ── coinhunter_shim.py # Unified cross-platform shim
│ ├── coinhunter_precheck_shim.py
│ ├── coinhunter_external_gate_shim.py
│ ├── coinhunter_review_context_shim.py
│ └── rotate_external_gate_log_shim.py
└── references/ └── references/
├── short-term-trading-framework.md ├── short-term-trading-framework.md
├── review-template.md ├── review-template.md

View File

@@ -2,14 +2,14 @@
These files are tiny compatibility shims for cron-based platforms (Hermes, OpenClaw, etc.) that expect scripts under a scripts directory such as `~/.hermes/scripts/` or `~/.openclaw/scripts/`. These files are tiny compatibility shims for cron-based platforms (Hermes, OpenClaw, etc.) that expect scripts under a scripts directory such as `~/.hermes/scripts/` or `~/.openclaw/scripts/`.
## Unified shim (recommended) ## Unified shim
`templates/coinhunter_shim.py` is the cross-platform wrapper. It takes the subcommand as its first argument and delegates to the installed `coinhunter` CLI: `scripts/coinhunter_shim.py` is the cross-platform wrapper. It takes the subcommand as its first argument and delegates to the installed `coinhunter` CLI:
```bash ```bash
cp templates/coinhunter_shim.py ~/.hermes/scripts/coinhunter_shim.py cp scripts/coinhunter_shim.py ~/.hermes/scripts/coinhunter_shim.py
# or # or
cp templates/coinhunter_shim.py ~/.openclaw/scripts/coinhunter_shim.py cp scripts/coinhunter_shim.py ~/.openclaw/scripts/coinhunter_shim.py
``` ```
Usage examples: Usage examples:
@@ -18,16 +18,7 @@ Usage examples:
- `coinhunter_shim.py review` - `coinhunter_shim.py review`
- `coinhunter_shim.py rotate-log` - `coinhunter_shim.py rotate-log`
## Legacy shims (backward compatibility) The real business logic lives in the external `coinhunter` CLI package (installed from PyPI). This shim only delegates to it.
The original individual shims are still provided for existing Hermes users who already have them deployed. Their behavior is unchanged:
- `templates/coinhunter_precheck_shim.py` -> `~/.hermes/scripts/coinhunter_precheck.py`
- `templates/coinhunter_external_gate_shim.py` -> `~/.hermes/scripts/coinhunter_external_gate.py`
- `templates/coinhunter_review_context_shim.py` -> `~/.hermes/scripts/coinhunter_review_context.py`
- `templates/rotate_external_gate_log_shim.py` -> `~/.hermes/scripts/rotate_external_gate_log.py`
The real business logic lives in the external `coinhunter` CLI package (installed from PyPI). These shims only delegate to it.
The user runtime data stays under: The user runtime data stays under:
- `~/.coinhunter/` - `~/.coinhunter/`

View File

@@ -1,12 +0,0 @@
#!/usr/bin/env python3
"""Hermes cron shim: runs coinhunter external-gate via CLI."""
import shutil
import subprocess
import sys
BIN = shutil.which("coinhunter") or shutil.which("coinhunter.exe")
if not BIN:
print("error: coinhunter CLI not found in PATH. Install with: pipx install coinhunter", file=sys.stderr)
sys.exit(127)
sys.exit(subprocess.run([BIN, "gate", *sys.argv[1:]]).returncode)

View File

@@ -1,12 +0,0 @@
#!/usr/bin/env python3
"""Hermes cron shim: runs coinhunter precheck via CLI."""
import shutil
import subprocess
import sys
BIN = shutil.which("coinhunter") or shutil.which("coinhunter.exe")
if not BIN:
print("error: coinhunter CLI not found in PATH. Install with: pipx install coinhunter", file=sys.stderr)
sys.exit(127)
sys.exit(subprocess.run([BIN, "pre", *sys.argv[1:]]).returncode)

View File

@@ -1,12 +0,0 @@
#!/usr/bin/env python3
"""Hermes cron shim: runs coinhunter review-context via CLI."""
import shutil
import subprocess
import sys
BIN = shutil.which("coinhunter") or shutil.which("coinhunter.exe")
if not BIN:
print("error: coinhunter CLI not found in PATH. Install with: pipx install coinhunter", file=sys.stderr)
sys.exit(127)
sys.exit(subprocess.run([BIN, "review", *sys.argv[1:]]).returncode)

View File

@@ -1,12 +0,0 @@
#!/usr/bin/env python3
"""Hermes cron shim: runs coinhunter rotate-log via CLI."""
import shutil
import subprocess
import sys
BIN = shutil.which("coinhunter") or shutil.which("coinhunter.exe")
if not BIN:
print("error: coinhunter CLI not found in PATH. Install with: pipx install coinhunter", file=sys.stderr)
sys.exit(127)
sys.exit(subprocess.run([BIN, "rotate-log", *sys.argv[1:]]).returncode)