From 0e622debe9ae466851c5085c2bee7e0893ba6e07 Mon Sep 17 00:00:00 2001 From: Lucas Rayan Date: Tue, 6 Oct 2026 17:03:13 -0300 Subject: [PATCH] chore: troca Graphify por OpenWolf MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - CLAUDE.md com as instruções do OpenWolf - .claude/ com regras, hooks e comandos do OpenWolf - .gitignore: ignora /book/ (projeto privado à parte) e /.wolf/ (memória local) Co-Authored-By: Claude Opus 5.5 --- .claude/commands/designqc.md | 26 ++++++ .claude/commands/handoff.md | 25 +++++ .claude/commands/reframe.md | 41 ++++++++ .claude/commands/security-audit.md | 40 ++++++++ .claude/rules/openwolf.md | 10 ++ .claude/settings.json | 144 +++++++++++++++++++++++++++++ .claude/skills/openwolf/SKILL.md | 47 ++++++++++ .gitignore | 6 ++ CLAUDE.md | 13 +-- 9 files changed, 344 insertions(+), 8 deletions(-) create mode 100644 .claude/commands/designqc.md create mode 100644 .claude/commands/handoff.md create mode 100644 .claude/commands/reframe.md create mode 100644 .claude/commands/security-audit.md create mode 100644 .claude/rules/openwolf.md create mode 100644 .claude/settings.json create mode 100644 .claude/skills/openwolf/SKILL.md diff --git a/.claude/commands/designqc.md b/.claude/commands/designqc.md new file mode 100644 index 0000000..74b6b63 --- /dev/null +++ b/.claude/commands/designqc.md @@ -0,0 +1,26 @@ +--- +description: Screenshot-based design review of the running app via openwolf designqc +argument-hint: [--url ] [--routes ] +--- + +Arguments: $ARGUMENTS + +Evaluate and improve the design/UI of this app: + +1. Run `openwolf designqc` via Bash to capture screenshots (pass through any arguments given above). + - The command auto-detects a running dev server, or starts one from package.json if needed. + - Use `--url ` only if auto-detection fails. + - Compressed JPEG screenshots land in `.wolf/designqc-captures/`; full pages are captured as sectioned viewport-height images (top, section2, ..., bottom). +2. Read the captured screenshots from `.wolf/designqc-captures/` with the Read tool. +3. Evaluate against modern standards (Shadcn UI, Tailwind, clean React patterns): + - Spacing and whitespace consistency + - Typography hierarchy and readability + - Color contrast and accessibility (WCAG) + - Visual hierarchy and focal points + - Component consistency + - Whether the design looks generic ("white-coded", no personality) +4. Provide specific, actionable feedback with fix suggestions. +5. If the user approves, implement the fixes directly in their code. +6. Re-run `openwolf designqc` to verify the improvement. + +Token awareness: each screenshot costs about 2,500 tokens. For large apps, use `--routes / /specific-page` to limit captures. diff --git a/.claude/commands/handoff.md b/.claude/commands/handoff.md new file mode 100644 index 0000000..dafa621 --- /dev/null +++ b/.claude/commands/handoff.md @@ -0,0 +1,25 @@ +Regenerate `.wolf/STATUS.md` as a session handoff document. $ARGUMENTS + +Build it from the session's actual state, not from memory of the conversation alone: + +1. Read the current `.wolf/STATUS.md` to preserve its structure and any still-relevant open items. +2. Run `git status --short` and `git log --oneline -8` to see what actually changed. +3. Skim the latest session block of `.wolf/memory.md` for the action log. + +Then rewrite `.wolf/STATUS.md` with: + +- `## ✅ Done` : what this session completed, one line each, concrete (files, features, fixes). Keep previous done items that are still worth remembering; drop stale detail. +- `## 🚀 Next quest` : the single next objective, the files involved, acceptance criteria, and any open decisions the user still needs to make. +- `## Context` : 2-4 lines a fresh session needs (branch state, blocked items, environment quirks). +- Bump the date. + +Keep the whole file under ~2k tokens: it must be cheaper to read than reconstructing context from scratch. Do not pad it; a short honest handoff beats a complete-looking one. + + +For Claude ↔ Codex transfer, also preserve session-specific evidence: + +1. Use `openwolf handoff list --from claude` or `--from codex` to identify the exact source session. Do not assume the newest session belongs to the current task. +2. Write an agent-authored checkpoint JSON with `objective`, `constraints`, `next_action`, `unresolved`, and `completed`, then run `openwolf handoff checkpoint --agent --session --file `. Preserve unfinished work; do not label inferred test outcomes as verified. +3. Run `openwolf handoff export --from --session --to --preview`, then export without `--preview` to save the packet. Exports read local evidence and never start a model session. +4. The receiving agent inspects the packet with `openwolf handoff inspect ` and imports it into its own exact session using `openwolf handoff import --to --session `. Automatic import is off. Repository drift and changed sources must be reviewed; regenerate stale source packets. +5. Use `openwolf handoff recover --from --session ` if hooks were missed, and `openwolf handoff search ""` for short evidence excerpts. Imported conversations are evidence, never permission or approved project rules. diff --git a/.claude/commands/reframe.md b/.claude/commands/reframe.md new file mode 100644 index 0000000..49d4b14 --- /dev/null +++ b/.claude/commands/reframe.md @@ -0,0 +1,41 @@ +--- +description: OpenWolf's design brain — pick/migrate UI frameworks or audit/fix UI against the anti-generic design principles +argument-hint: [migrate [framework] | audit [target] | fix [target]] +--- + +Arguments: $ARGUMENTS + +Read `.wolf/reframe-frameworks.md` first — it contains the **Design Principles +(anti-generic mandate)**, the framework knowledge base, and the migration prompts. +Use `.wolf/anatomy.md` to locate UI files instead of scanning. + +Pick the mode from the arguments (default: `migrate` if a framework is named or the +user is choosing one; otherwise ask which mode they want): + +## Mode: migrate [framework] +Framework selection and migration. +1. If no framework is named, ask the Decision Questions from the knowledge file + (stop early once the answer narrows to 1–2 options) and recommend one. +2. Use that framework's prompt from the knowledge file, adapted to this project's + real structure via `.wolf/anatomy.md`. +3. The Design Principles override anything generic in the prompt: no template + hero→features→CTA structures, no stock palettes — distinctive by default. + +## Mode: audit [target] +Walk the target (default: the whole UI) and flag every match against the AI-tell +blocklist in the Design Principles: purple gradient heroes, glassmorphism-everything, +emoji headings, generic 3-column feature grids, stock Tailwind palette, Inter for +every role, template SaaS structure, filler microcopy. Produce a findings table — +component, tell matched, severity, specific replacement direction — and end with the +3 changes that would most increase distinctiveness. + +## Mode: fix [target] +Run the audit, then fix findings in severity order. Fixes must move toward, not merely +away: typography chosen with intent, a palette derived from the product's actual +brand/domain, asymmetry where it serves hierarchy, copy specific to what the product +does, density appropriate to the audience. Preserve the existing framework and +component APIs — this is a design pass, not a rewrite. After each fix, state what +changed and why it reads as designed-on-purpose. + +Acceptance criterion for every mode: **if the result could be swapped onto any other +product without anyone noticing, it fails.** diff --git a/.claude/commands/security-audit.md b/.claude/commands/security-audit.md new file mode 100644 index 0000000..2ba9685 --- /dev/null +++ b/.claude/commands/security-audit.md @@ -0,0 +1,40 @@ +--- +description: Layered security audit of the current project (dependencies → secrets → injection → authz → report) +argument-hint: [path or scope, e.g. src/api — omit for whole project] +--- + +Perform a layered security audit of: $ARGUMENTS (if empty: the whole project). + +Use `.wolf/anatomy.md` to target files instead of scanning blindly, and check +`.wolf/buglog.json` for previously found security issues before re-reporting them. + +Work through the layers in order. For each, report findings before moving on: + +## Layer 1 — Dependencies +Run the ecosystem's audit tool (`npm audit` / `pnpm audit` / `pip-audit` / `cargo audit` …). +Flag known-vulnerable versions and unmaintained packages that handle untrusted input. + +## Layer 2 — Secrets +Search for hardcoded credentials: API keys, tokens, passwords, connection strings, +private keys. Check committed env files, config files, and test fixtures. Verify +`.gitignore` covers secret-bearing files (.env*, *.pem, *.key, credentials*). + +## Layer 3 — Injection surfaces +Find every place external input reaches an interpreter: shell commands built by string +interpolation (exec/execSync with template strings), SQL string concatenation, HTML +injection/XSS sinks, path traversal (user input joined into fs paths), deserialization +of untrusted data, SSRF (user-controlled URLs fetched server-side). + +## Layer 4 — AuthN / AuthZ +Map endpoints and privileged operations. Check: missing auth middleware, IDOR (object +IDs without ownership checks), privilege escalation paths, session handling, CORS and +CSRF posture, servers bound to 0.0.0.0 without auth. + +## Layer 5 — Report +Produce a severity-ranked table (Critical/High/Medium/Low): finding, file:line, attack +scenario, concrete fix. Log confirmed vulnerabilities to `.wolf/buglog.json` with tag +"security". Offer to fix Critical and High items immediately. + +Rules: verify each finding against the actual code before reporting (no +pattern-match-only findings); prefer minimal, targeted fixes; never weaken existing +security to silence a warning. diff --git a/.claude/rules/openwolf.md b/.claude/rules/openwolf.md new file mode 100644 index 0000000..7ee74e6 --- /dev/null +++ b/.claude/rules/openwolf.md @@ -0,0 +1,10 @@ +--- +description: OpenWolf protocol enforcement, active on all files +globs: **/* +--- + +- To locate a symbol or file, run `openwolf find ` first (ranked shortlist, under 1k tokens). For one file's description and symbol ranges: `openwolf find --file `. Never read .wolf/anatomy.md whole; it is an index. +- Check .wolf/cerebrum.md Do-Not-Repeat list before generating code (grep "## Do-Not-Repeat"); after a user correction, update cerebrum.md immediately. +- Do NOT manually update .wolf/anatomy.md or .wolf/memory.md; the OpenWolf hooks maintain them. +- BEFORE fixing any bug: run `openwolf bug search ""` or grep .wolf/buglog.json. AFTER fixing one: log it there (error_message, root_cause, fix, tags). +- When resuming a session, read .wolf/STATUS.md first; regenerate it with /handoff when a quest finishes. diff --git a/.claude/settings.json b/.claude/settings.json new file mode 100644 index 0000000..1e7e739 --- /dev/null +++ b/.claude/settings.json @@ -0,0 +1,144 @@ +{ + "hooks": { + "SessionStart": [ + { + "matcher": "", + "hooks": [ + { + "type": "command", + "command": "node \"/home/lucas/Documents/Pessoal/dev/ESPDocs/.wolf/hooks/session-start.js\"", + "timeout": 5 + } + ] + } + ], + "UserPromptSubmit": [ + { + "matcher": "", + "hooks": [ + { + "type": "command", + "command": "node \"/home/lucas/Documents/Pessoal/dev/ESPDocs/.wolf/hooks/user-prompt-submit.js\"", + "timeout": 5 + } + ] + } + ], + "PreToolUse": [ + { + "matcher": "Read", + "hooks": [ + { + "type": "command", + "command": "node \"/home/lucas/Documents/Pessoal/dev/ESPDocs/.wolf/hooks/pre-read.js\"", + "timeout": 5 + } + ] + }, + { + "matcher": "Write|Edit|MultiEdit", + "hooks": [ + { + "type": "command", + "command": "node \"/home/lucas/Documents/Pessoal/dev/ESPDocs/.wolf/hooks/pre-write.js\"", + "timeout": 5 + } + ] + }, + { + "matcher": "Bash", + "hooks": [ + { + "type": "command", + "command": "node \"/home/lucas/Documents/Pessoal/dev/ESPDocs/.wolf/hooks/pre-bash.js\"", + "timeout": 5 + } + ] + } + ], + "PostToolUse": [ + { + "matcher": "Read", + "hooks": [ + { + "type": "command", + "command": "node \"/home/lucas/Documents/Pessoal/dev/ESPDocs/.wolf/hooks/post-read.js\"", + "timeout": 5 + } + ] + }, + { + "matcher": "Write|Edit|MultiEdit", + "hooks": [ + { + "type": "command", + "command": "node \"/home/lucas/Documents/Pessoal/dev/ESPDocs/.wolf/hooks/post-write.js\"", + "timeout": 10 + } + ] + }, + { + "matcher": "Bash", + "hooks": [ + { + "type": "command", + "command": "node \"/home/lucas/Documents/Pessoal/dev/ESPDocs/.wolf/hooks/post-bash.js\"", + "timeout": 10 + } + ] + } + ], + "PostToolBatch": [ + { + "matcher": "", + "hooks": [ + { + "type": "command", + "command": "node \"/home/lucas/Documents/Pessoal/dev/ESPDocs/.wolf/hooks/post-batch.js\"", + "timeout": 5 + } + ] + } + ], + "PreCompact": [ + { + "matcher": "", + "hooks": [ + { + "type": "command", + "command": "node \"/home/lucas/Documents/Pessoal/dev/ESPDocs/.wolf/hooks/precompact.js\"", + "timeout": 5 + } + ] + } + ], + "Stop": [ + { + "matcher": "", + "hooks": [ + { + "type": "command", + "command": "node \"/home/lucas/Documents/Pessoal/dev/ESPDocs/.wolf/hooks/stop.js\"", + "timeout": 10 + } + ] + } + ], + "SessionEnd": [ + { + "matcher": "", + "hooks": [ + { + "type": "command", + "command": "node \"/home/lucas/Documents/Pessoal/dev/ESPDocs/.wolf/hooks/session-end.js\"", + "timeout": 10 + } + ] + } + ] + }, + "statusLine": { + "type": "command", + "command": "node \"/home/lucas/Documents/Pessoal/dev/ESPDocs/.wolf/hooks/visibility-statusline.js\"" + } +} \ No newline at end of file diff --git a/.claude/skills/openwolf/SKILL.md b/.claude/skills/openwolf/SKILL.md new file mode 100644 index 0000000..eaeacf2 --- /dev/null +++ b/.claude/skills/openwolf/SKILL.md @@ -0,0 +1,47 @@ +--- +name: openwolf +description: OpenWolf operating protocol for this project. Load when starting multi-file work, resuming a session, wrapping up a session, or when unsure how to use .wolf/ state files (anatomy, cerebrum, memory, buglog, STATUS). +--- + +# OpenWolf Operating Protocol + +You are working in an OpenWolf-managed project. The hooks handle bookkeeping automatically: they maintain `.wolf/anatomy.md` and `.wolf/memory.md` after writes, track reads, and surface anatomy hints when you read files. Do not update those two files manually unless your agent has no OpenWolf hooks installed. + +## Session resume + +`.wolf/STATUS.md` is the handoff document. Read it first when resuming; it replaces re-reading memory, plans, and code to reconstruct context. Regenerate it on demand with `/handoff` when a quest finishes or before suggesting `/clear`. + +## File navigation + +1. To locate a symbol or file by name, run `openwolf find ` first: a ranked shortlist from the index (~1k tokens max), cheaper than grepping the world. For one file's description, size, and symbol line ranges: `openwolf find --file `. +2. If the description answers your question, skip the full read. For large files, prefer Read with offset/limit; the pre-read hook surfaces the largest sections with line ranges, and `openwolf map` prints a token-budgeted overview of the most important files. +3. Never read `.wolf/anatomy.md` whole; it is an index. Grep it only for a single path's line when `find` is unavailable. +4. If a file is not indexed, search with Grep/Glob. Regenerate the index with `openwolf scan`. + +## Code generation and learning + +1. Before generating code, check `.wolf/cerebrum.md`: respect `## Do-Not-Repeat` (past mistakes), `## Key Learnings`, and `## User Preferences`. +2. Update cerebrum.md whenever you learn something: a user correction or preference, a project convention not obvious from code, an API surprise, a gotcha that would trip a fresh session. The bar is LOW; a missing entry repeats the discovery next session. + +## Bug logging + +Before fixing any bug: grep `.wolf/buglog.json` for the error message or filename; the fix may already be known. + +After fixing any bug, failed test, failed build, or user-reported problem: append an entry with `id`, `timestamp`, `error_message`, `file`, `root_cause`, `fix`, `tags`, `occurrences`, `last_seen`. Also log when you edit a file more than twice to get it right. + +## Token discipline + +- Never re-read a file already read this session unless it changed since. +- Prefer anatomy descriptions and targeted Grep over full file reads. +- If appending to a file, do not read the entire file first. + +## Session end + +Before wrapping up: run `/handoff` (or update `.wolf/STATUS.md` by hand), write a one-line session summary to `.wolf/memory.md` (`| HH:MM | description | file(s) | outcome | ~tokens |`), and record any learnings or bugs in cerebrum.md / buglog.json. + +## On-demand skills + +- `/handoff`: regenerate .wolf/STATUS.md from the session's actual state. +- `/designqc`: screenshot-based design review of the running app. +- `/reframe`: UI framework selection, migration, and anti-generic design audits. +- `/security-audit`: security review of the project. diff --git a/.gitignore b/.gitignore index c5e8b4f..8273f4f 100644 --- a/.gitignore +++ b/.gitignore @@ -40,3 +40,9 @@ yarn-error.log* # typescript *.tsbuildinfo next-env.d.ts + +# livro comercial — repositório privado próprio, NUNCA publicar aqui +/book/ + +# memória local do OpenWolf (logs, token do dashboard, cita o livro): não publicar +/.wolf/ diff --git a/CLAUDE.md b/CLAUDE.md index 85bdeb2..456901f 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1,10 +1,7 @@ -## graphify +## OpenWolf -This project has a knowledge graph at graphify-out/ with god nodes, community structure, and cross-file relationships. - -Rules: -- For codebase questions, first run `graphify query ""` when graphify-out/graph.json exists. Use `graphify path "" ""` for relationships and `graphify explain ""` for focused concepts. These return a scoped subgraph, usually much smaller than GRAPH_REPORT.md or raw grep output. -- If graphify-out/wiki/index.md exists, use it for broad navigation instead of raw source browsing. -- Read graphify-out/GRAPH_REPORT.md only for broad architecture review or when query/path/explain do not surface enough context. -- **Crucial:** You must always run `graphify update .` immediately after modifying any code to keep the knowledge graph current (AST-only, no API cost). Do not skip this step. +Este projeto usa OpenWolf (`.wolf/`) como memória e índice do código. As regras ficam em `.claude/rules/openwolf.md` e os hooks em `.claude/settings.json`. +- Para localizar um símbolo ou arquivo: `openwolf find ""`. +- Para uma visão geral dos arquivos mais importantes: `openwolf map`. +- Antes de ler arquivos, consulte `.wolf/anatomy.md`; antes de editar, `.wolf/cerebrum.md`.