convez.ai
AgenteProdutividadeAvançado
Hermeneuticus-of-things

Claude Code Efficient Workspace (CCDEW)

Hermeneuticus-of-things/claude-code-eficient-workspace

Agente com roteamento Eneagrama que economiza 76% de tokens e bloqueia secrets

Ver no GitHub
InicialPluginScore · de 0 a 100

Agent inteligente com roteamento automático baseado em Eneagrama, que reduz consumo de tokens em ~76% por sessão. Inclui segurança contra vazamento de secrets, auditoria contínua em 5 níveis e 19 comandos slash para produtividade máxima em codificação.

Instalação

$npx convez-ai Hermeneuticus-of-things/claude-code-eficient-workspace

1 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.

Métricas

Estrelas
0
Forks
0
Acompanhando
0
Saúde
42%
Último commit
há 5 meses
Versão
—
Issues abertas
0
Contribuidores
1

Casos de uso

  • Reduzir custos de API Claude em projetos de longa duração
  • Rotear tarefas automaticamente para o agente especializado correto
  • Prevenir vazamento de credenciais antes do commit

Veredito

Solução sólida e bem-testada (147/147 testes passando) para times que precisam otimizar custos em Claude Code. O roteamento Eneagrama é inovador, mas a complexidade é alta e exige conforto com JavaScript e hooks de workspace.

README

A tradução para o português deste README ainda está na fila.

CCDEW — Claude Code Efficient Workspace

tests audit version platform license

A drop-in workspace for Claude Code that cuts token cost by ~76% per prompt, routes every task to the right agent, blocks secret leaks before they ship, and audits itself continuously — without slowing you down.


What it is

CCDEW is a configuration layer that sits on top of Claude Code. Clone it, open Claude Code inside it, and the system self-activates: 13 hooks wire into Claude Code's lifecycle, 19 slash commands become available, and every session is automatically filtered, routed, monitored, and archived.

No manual setup per-project. Clone once, use everywhere.


What it does

LayerComponentEffect
ContextSSA (Jaccard trigram filter)Loads 14 relevant files instead of 130+ — −76% tokens/prompt
RoutingEnneagram (9 nodes) + SAFLA (adaptive) + Instincts (pattern memory)Picks the right agent for every prompt — wrong-agent rate drops from ~30% to <10%
Costcodeburn + native fallback engineLive cost in statusline, daily budget alerts at 75% and 100%
Securitysecret-scan (11 patterns)Blocks edits containing AWS/Anthropic/OpenAI keys, RSA keys, JWTs, and 8 sensitive path patterns
Quality5-zoom audit (Maha → Macro → Mezzo → Micro → Nano)Finds structural, module, function, line-level drift — runs in < 1 s
Gitauto-/verify + auto-/quality-gateBlocks git commit and git push if checks fail
Memorysession-snapshotArchives every session to JSON + Obsidian Markdown
Stabilitycross-process file-lock200/200 concurrent writes survive without corruption

Numbers

Tokens / prompt      ~10,000  →  ~2,400     (−76%)
Memory at start       130+ files →  14        (−85%)
Session-end overhead   8.5 s   →  117 ms     (−98.6%)
SSA filter latency                 0.31 ms
SAFLA record latency               0.85 ms
Pre-edit secret scan              ~30 ms
Full audit (/infer)               < 1 s
Full test suite                   < 2 s
Hook timeout (hard limit)          5 s
22 test suites · 147 / 147 PASS
38 audit checks · 0 WARN · 0 FAIL
~8,000 LOC · 49 helpers · 34 skills
19 slash commands · 13 hook events
10 architectural decisions documented
1 optional external dependency (codeburn)

What it looks like

Statusline injected into every prompt:

💰 $12.40/$100/d · 63c   │   🤖 71% ok·14fb   │   📂 CCDEW

Routing hint on every prompt (inject-workflow):

[AUTO-SWARM DIRECTIVE] refactor the auth module across 5 files
Node 7 (Innovator) | HEXAD | SSA:MAHA SAFLA:+0.05
SPAWN: reviewer → researcher → backend-dev → sparc-orchestrator → analyst → architecture
[INSTINCT] you usually route this to node 7 (83% confidence over 6 similar prompts)

Secret blocked before edit:

[BLOCKED] Secret leak risk: 1 pattern detected: AWS Access Key

5-zoom audit (npm run infer):

[INFER] 10 findings · HIGH:2 WARN:7 INFO:1

MAHA:  [⚠] <tests> — Only 22 suites — below 50 expected for this LOC
MACRO: [✗] hook-handler.cjs — 1211 lines — exceeds hard cap 500
MICRO: [⚠] intelligence.cjs:325 — Function init() is 111 lines (>75)
NANO:  (clean)

Installation

Prerequisites

ToolMinimumHow to install
Claude Code CLIlatestnpm install -g @anthropic-ai/claude-code
Node.js18+nodejs.org
Gitanygit-scm.com
Python3.8+python.org — optional, Obsidian helpers only
codeburnlatestnpm install -g codeburn — optional, canonical cost data

ANTHROPIC_API_KEY must be set in your shell environment.


Clone and verify

# Linux / macOS
git clone https://github.com/Hermeneuticus-of-things/claude-code-eficient-workspace.git CCDEW
cd CCDEW
npm test          # expect: 147/147 PASS
npm run audit     # expect: 38/38 PASS
# Windows (PowerShell)
git clone https://github.com/Hermeneuticus-of-things/claude-code-eficient-workspace.git CCDEW
cd CCDEW
npm test
npm run audit

Or use the bootstrap scripts (clone + prereq check + tests in one command):

bash bootstrap-ccdew.sh        # Linux / macOS
.\bootstrap-ccdew.ps1          # Windows PowerShell

Start

cd CCDEW
claude

Claude Code reads .claude/settings.json on startup — all 13 hooks activate automatically. No manual wiring.

Verify hooks are live: type any prompt and you should see a system-reminder block with routing output. If the statusline (💰 ... 🤖 ...) appears, everything is running.


Configuration

Edit .claude/helpers/feature-flags.json to enable or disable components and tune thresholds:

{
  "components": {
    "enneagram":   true,
    "ssa":         true,
    "codeburn":    true,
    "safla":       true,
    "secret_scan": true,
    "instincts":   true,
    "graphify":    true,
    "red_hat":     true
  },
  "ssa": {
    "top_k":     12,
    "min_score": 0.15
  },
  "codeburn": {
    "daily_budget_usd":  100.0,
    "warn_at_pct":       0.75,
    "alert_at_pct":      1.0,
    "cost_per_call_warn": 0.05
  },
  "safla": {
    "weight_success": 0.05,
    "weight_failure": -0.10,
    "weight_clamp":    0.5
  }
}

Environment variables

VariableRequiredEffect
ANTHROPIC_API_KEYYesYour Anthropic API key
HOOKS_SKIP=1NoEmergency bypass for git commit/push auto-checks
GITHUB_TOKENNoRaises /skills-propose rate limit from 60 to 5000 req/h
PYTHON_BINNoExplicit Python path if auto-detect fails on Windows
CCDEW_LANG=roNoRomanian UI strings (partial)

Commands

npm scripts (run from CCDEW/)

npm test                           # run all 22 test suites
npm run audit                      # full evaluate-setup (38 checks)
npm run audit:fix                  # auto-resolve drift
npm run infer                      # 5-zoom audit (Maha→Nano)
npm run verify                     # quick pre-commit sweep
npm run quality-gate               # strict pass/fail gate (used before push)
npm run burn                       # live cost report
npm run bench                      # hot-path benchmarks
npm run skills-propose -- "<tag>"  # find Claude Code skills matching a keyword
npm run exit                       # manual session snapshot (JSON + Obsidian MD)
npm run sessions-compare -- 5      # compare last 5 sessions
npm run optimize -- nano           # auto-fix NANO-level drift

Slash commands (inside Claude Code)

/evaluate-setup    Full workspace audit
/verify            Pre-commit check (types + tests + lint + secrets)
/quality-gate      Strict gate before merge/push
/infer             5-zoom audit (Maha → Nano)
/review            Code review on current diff
/diff-explain      Explain git diff in plain language
/research          Deep research on a topic
/optimize          Fix drift at specified zoom level
/skills-propose    Find skills matching a keyword from GitHub
/skills-active     List currently active skills
/instincts         Show routing pattern memory
/cost              Current and monthly cost summary
/bench             Run hot-path benchmarks
/mcp-health        Check MCP server connectivity
/platform          Show platform / Python / Node detection results
/exit              Session snapshot + archive
/sessions-compare  Diff last N sessions
/errors            Last 20 logged errors (PII-redacted)
/safla-clean       Fix corrupt safla.json (pre-v3.0 migration)

Auto-triggers

These fire without any manual command:

TriggerActionBypass
git commitAuto-runs /verify — blocks on failHOOKS_SKIP=1 git commit ...
git pushAuto-runs /quality-gate — blocks on failHOOKS_SKIP=1 git push ...
Any file editsecret-scan — blocks edit if leak detecteddisable in feature-flags.json
Every promptinject-workflow → routing hint in system-reminder—
SessionStart (24h)Auto-runs /evaluate-setup, alerts on FAIL/WARN—
SessionEndSession snapshot to JSON + Obsidian MD + benchmark—

How it works internally

SSA — Semantic Scope Approximation

At every SessionStart and UserPromptSubmit, SSA computes Jaccard trigram similarity between the incoming prompt and all memory entries. Top-K results (default: 12) are injected into context. The rest are silenced. Result: ~76% fewer tokens without losing relevant context.

Enneagram routing

Every prompt is scored against 9 node archetypes (Reformer, Helper, Achiever, Individualist, Investigator, Loyalist, Innovator, Challenger, Peacemaker). The best-matching node determines the agent chain: TRIANGLE (3 agents, fast) or HEXAD (6 agents, deep). SAFLA adjusts node weights based on outcome feedback — routing improves over time.

SAFLA — Self-Adaptive Feedback Loop Architecture

After every task, SAFLA records success or failure and adjusts per-node weights (±0.05 by default, clamped at ±0.5). After ~20 prompts, routing accuracy converges. Weights persist in .claude-flow/data/safla.json.

5-zoom audit

/infer (or npm run infer) scans the workspace at 5 levels:

LevelChecks
MahaTotal LOC, test coverage ratio, helper count
MacroFile line counts vs hard/soft caps
MezzoFunction counts and responsibility balance
MicroFunction length, complexity indicators
NanoTODO/FIXME density, dead code, naming drift

Secret scan

Pre-edit hook runs 11 regex patterns on file content before any write: AWS Access Key, Anthropic Key, OpenAI Key, RSA private key, JWT, GitHub token, and 8 sensitive path patterns (.env, credentials, id_rsa, etc.).


How the hooks connect

All hook logic lives in .claude/helpers/hook-handler.cjs. The hooks registered in .claude/settings.json:

EventHookWhat it does
UserPromptSubmitinject-workflowSSA filter + Enneagram route + Skills suggest
UserPromptSubmitrouteSAFLA scoring, Instincts lookup
PreToolUse: Write/Editpre-editSecret scan — blocks if leak found
PreToolUse: Bashpre-bashDetects git commit/push, fires auto-verify/gate
PostToolUse: Write/Editpost-editSAFLA outcome record, auto-learn update
PostToolUse: Bashpost-bashCost estimate update
SessionStart—SAFLA init, auto-audit (24h cadence), statusline
SessionEnd—Snapshot, benchmark, Obsidian archive
Stop—SAFLA session close
PreCompact—Summarize context before compaction

.claude/settings.json is committed to the repo — hooks activate for anyone who clones.


Troubleshooting

SymptomCauseFix
[CODEBURN] CLI unavailablecodeburn not installed globallynpm install -g codeburn (native fallback works without it)
Python was not found (Windows)Windows Store alias intercepts pythonCCDEW auto-probes with -V; confirm with npm run audit
Hooks don't firesettings.json not picked upRestart Claude Code (settings read at launch only)
git commit blocked/verify failedRun npm run verify to see why; bypass: HOOKS_SKIP=1 git commit ...
[BLOCKED] Secret leak risk on legit fileFalse-positive on hex/JWT-like stringDisable temporarily: feature-flags.json → secret_scan: false
safla.json shows [object Object]Pre-v3.0 corrupt stateRun node .claude/helpers/hook-handler.cjs safla-clean
ToolSearch +swarm_init returns nothingMCP claude-flow not loadedRestart Claude Code; .mcp.json must be present in the workspace root
Routing hint never appearsinject-workflow hook not firingCheck npm run audit — hook config section must show PASS

For detailed diagnostics:

node .claude/helpers/hook-handler.cjs errors   # last 20 errors, PII-redacted
npm run audit                                  # full 38-point check

Privacy

  • Nothing leaves your machine. codeburn reads ~/.claude/projects/ locally for cost data — it is never transmitted.
  • GitHub API is called only when you explicitly run /skills-propose <keyword>. No auth required; GITHUB_TOKEN is optional and only raises the rate limit.
  • All error logs (errors.jsonl) are auto-redacted via lib/redact.cjs — emails, keys, and home paths are replaced with ~ before writing.
  • Session snapshots stay local and are git-ignored (listed in .gitignore).
  • Secret-scan is entirely local regex — no external service involved.

Stability

TestResult
200 concurrent fork() writes to safla.json200/200 correct
50 concurrent in-process atomic writes0 orphans
1000 serial SAFLA outcomes0 corrupt keys
30+ fuzz inputs (malformed JSON, empty, binary)all rejected cleanly
BOM / CRLF / RTL / emoji in file contenthandled
Disk full / read-only / corrupt JSONgraceful degradation
Linux + macOS + Windowsall supported

Roadmap

ItemStatus
Split hook-handler.cjs (1211L) into focused modulesTechnical debt — see _MEMORY/decisions/008
Split intelligence.cjs (979L)Technical debt — same ADR
ONNX local vector embeddingsBlocked on ruflo upstream
TypeScript migration via JSDocIn exploration — lib/jsdoc-validator.cjs validates exports
Full CCDEW_LANG propagationLow priority
MCP self-test after restartFeasible via ToolSearch probe

Documentation

FileContents
ARCHITECTURE.mdModule map, data flow diagram, hook lifecycle, 5-zoom design
CHANGELOG.mdFull version history v1.0 → v3.8.2
MIGRATION.mdUpgrade guide v2.x → v3.x
CREDITS.mdAttribution per dependency (direct, inspired, original)
_MEMORY/decisions/INDEX.md10 architectural decisions with context and rationale

Comparison

FeatureCCDEWECCsetup-evaluatorruflo
Token reduction (context filter)✅ −76%✅——
Adaptive agent routing✅ Enneagram + SAFLA + Instincts✅—✅
Real-time cost tracking✅ codeburn + native fallback———
Secret-leak pre-edit block✅ 11 patterns—✅—
5-zoom self-audit✅ original———
Auto-verify on git commit✅—partial—
Cross-process race safety✅———
Session archival (JSON + Obsidian)✅———
Cross-platform✅✅——

CCDEW is a depth-first integrator: it combines ideas from all three and adds original layers (5-zoom audit, file-lock, session archival, skill-proposing). Attribution in CREDITS.md.


License

MIT — see LICENSE.

Ver o original no GitHub

Bom para

Relacionados