locksmith
CLAUDE.md4 starsChanged 6 months agoApache-2.0View on GitHub
This project has a CodeGraph MCP server (codegraph_* tools) configured. CodeGraph is a tree-sitter-parsed knowledge graph of every symbol, edge, and file. Reads are sub-millisecond and return structural information grep cannot. Use codegraph for structural questions — what calls what, what would break, where is X defined, what is X's signature. Use native grep/read only for literal text queries (string contents, comments, log messages) or after you already have a specific file open. The MCP server returns "not initialized." Ask…
- Commits and pushes
In this repository8 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .claude/CLAUDE.mdCLAUDE.md
- .cursor/rules/codegraph.mdcCursor rule
- changelogSkill
- check-licensesSkill
- release-prepSkill
- verificationSkill
- version-bumpSkill
The file
Show its rules and text
We split this CLAUDE.md into the rules it gives an agent
25 rules. About 0 are common, 10 are distinctive, and 15 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈10
Distinctive · estimate
This author's own choices. Worth a look.
15
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 12
Use codegraph for structural questions — what calls what, what would break, where is X defined, what is X's signature.
- Very specific: line 29
Don't grep first: when looking up a symbol by name.
- Very specific: line 30
Don't chain
codegraph_search+codegraph_node: when you just want context — codegraph_context is one call. - Distinctive: line 40
All code, comments, commit messages, and documentation must be in English.
- Distinctive: line 41
When conversing with the user, always respond in the user's language.
- Distinctive: line 97
Never use git add -f on these files.
- Very specific: line 108
Every superpowers plan MUST end with a task that runs the verification skill.
- Very specific: line 116
Do not mark a feature branch done until this task passes with all gates green.
- Very specific: line 131
When opening a PR, the default base branch is develop unless the change is an explicit release PR or hotfix to main.
- Distinctive: line 135
Follow Conventional Commits (see CONTRIBUTING.md).
- Distinctive: line 136
No mentions of AI tools, agents, or assistants anywhere in commits.
- Distinctive: line 153
If any commits lack a valid signature, offer to re-sign them.
- Distinctive: line 162
Do not mention GPG during the session - only check at the very end, after all other work is done.
- Distinctive: line 166
All tests must pass under the race detector
- Very specific: line 167
Run make test-coverage and make test-race before committing
- Very specific: line 191
Run it before committing any change to go.mod / go.sum.
- Very specific: line 201
Use internal/log (zerolog).
- Very specific: line 204
All documentation lives in docs/.
- Very specific: line 218
When you add a new vault plugin under plugins/<name>/, update the following in the same change:
- Very specific: line 231
Agent templates: - update every template under internal/initflow/agents/<agent>/templates/ to add a usage example in the "Retrieving …
- Very specific: line 244
Run make verify to ensure all gates pass.
- Very specific: line 250
Default plugins (gopass, keychain) and locksmith-pinentry ship embedded inside the locksmith binary as a per-platform zip.
- Very specific: line 260
Every user-visible change must be recorded in CHANGES.md under ## Development in the same commit as the code change - never as a follow-up.
- Very specific: line 266
When writing a superpowers plan, include an explicit task for updating CHANGES.md before the "commit" step:
- Distinctive: line 279
All documentation and comments must use ASCII punctuation only:
≈ “Common” is an estimate: at least 1 in 5 of the 26,980 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Locksmith - Project Rules
Repository: https://github.com/lorem-dev/locksmith
<!-- CODEGRAPH_START -->CodeGraph
This project has a CodeGraph MCP server (codegraph_* tools) configured. CodeGraph is a tree-sitter-parsed knowledge graph of every symbol, edge, and file. Reads are sub-millisecond and return structural information grep cannot.
When to prefer codegraph over native search
Use codegraph for structural questions — what calls what, what would break, where is X defined, what is X's signature. Use native grep/read only for literal text queries (string contents, comments, log messages) or after you already have a specific file open.
| Question | Tool |
| "Where is X defined?" / "Find symbol named X" | codegraph_search |
| "What calls function Y?" | codegraph_callers |
| "What does Y call?" | codegraph_callees |
| "What would break if I changed Z?" | codegraph_impact |
| "Show me Y's signature / source / docstring" | codegraph_node |
| "Give me focused context for a task/area" | codegraph_context |
| "Survey an unfamiliar module/topic" | codegraph_explore |
| "What files exist under path/" | codegraph_files |
| "Is the index healthy?" | codegraph_status |
Rules of thumb
- Trust codegraph results. They come from a full AST parse. Do NOT re-verify them with grep — that's slower, less accurate, and wastes context.
- Don't grep first when looking up a symbol by name.
codegraph_searchis faster and returns kind + location + signature in one call. - Don't chain
codegraph_search+codegraph_nodewhen you just want context —codegraph_contextis one call. codegraph_exploreis the heavy hitter for unfamiliar areas — it returns full source from all relevant files in one call, but is token-heavy. If your harness supports parallel subagents (e.g., Claude Code's Task tool), spawn one for explore-class questions to keep main session context clean.- Index lag: the file watcher debounces ~500ms behind writes; don't re-query immediately after editing a file in the same turn.
If .codegraph/ doesn't exist
The MCP server returns "not initialized." Ask the user: "I notice this project doesn't have CodeGraph initialized. Want me to run codegraph init -i to build the index?"
<!-- CODEGRAPH_END -->Language
All code, comments, commit messages, and documentation must be in English. When conversing with the user, always respond in the user's language.
Module Names
- Main module:
github.com/lorem-dev/locksmith - SDK:
github.com/lorem-dev/locksmith/sdk - Gopass plugin:
github.com/lorem-dev/locksmith-plugin-gopass - Keychain plugin:
github.com/lorem-dev/locksmith-plugin-keychain - 1Password plugin:
github.com/lorem-dev/locksmith-plugin-1password
Project Structure
cmd/locksmith/- CLI + daemon entry pointcmd/locksmith-pinentry/- pinentry helper binary (main.go only; logic lives in internal/pinentry)internal/- daemon internals (not importable externally)internal/pinentry/- Assuan/pinentry protocol implementationsdk/- public SDK for vault plugin authors (split into subpackages)sdk/vault- Provider interface, Serve(), plugin wiringsdk/errors- VaultError type and constructorssdk/log- LogConfig, NewLogWriter, IsDebugsdk/session- HideSessionId, MaskSessionIdsdk/platform- Platform string constants (Darwin, Linux)
plugins/- default vault plugins (each is a standalone Go module)proto/- protobuf definitionsgen/proto/- generated code (do not edit manually, gitignored)docs/- documentation (architecture, configuration, plugins)docs/superpowers/plans/- superpowers implementation plans (gitignored, default plan location)docs/superpowers/specs/- superpowers design specs (gitignored, default spec location).worktrees/- git worktrees (gitignored, default worktree location)
Project skills (.claude/skills/)
Locksmith ships project-specific skills that drive recurring
workflows. Invoke them via the Skill tool. Each skill is
self-contained; consult its SKILL.md for the exact step list.
| Skill | When to use |
verification | Mandatory final step of every superpowers plan. Runs lint, race, coverage, build, GPG, docs, and CHANGES.md checks via .scripts/verification.sh. |
check-licenses | After adding or removing any direct Go dependency. Audits license compatibility with Apache 2.0 and updates LICENSE. |
release-prep | On develop before cutting a release. Verifies each accumulated ## Development bullet has matching docs updates since the last tag, then drives version-bump. Read-only; never pushes or tags. |
version-bump | Driven by release-prep (rarely invoked directly). Bumps sdk/version/VERSION, syncs the README install pin, and invokes changelog. Prints the git commands; does not execute them. |
changelog | Compresses ## Development into a versioned ## Version vX.Y.Z section. Triages bullets into BREAKING / Features / Fixes; drops internal noise. |
Skills that print commands never run them. release-prep and
version-bump are read-only: they print the git add, git push,
gh pr create, and git tag commands for the maintainer to copy.
The maintainer is responsible for pushing branches, opening PRs,
merging them, and creating the release tag.
Superpowers Conventions
- Plans and specs MUST be saved under
docs/superpowers/. Never save them under.claude/, the user's home directory,/tmp, or anywhere else. This applies to every agent and skill that writes superpowers artefacts, regardless of any built-in default the agent may have. - Plans: save to
docs/superpowers/plans/YYYY-MM-DD-<feature>.md - Specs: save to
docs/superpowers/specs/YYYY-MM-DD-<feature>-design.md - Both directories are gitignored and MUST NOT be committed to git.
Never use
git add -fon these files. They are local working artifacts only. - Use CodeGraph for code navigation during superpowers workflows.
Brainstorming, writing-plans, executing-plans, debugging, and code-review
skills all benefit from
codegraph_*tools (see the CodeGraph section above). Prefercodegraph_search/codegraph_context/codegraph_impactover grep when scoping work, locating call sites, or estimating blast radius. Sub-agents dispatched from these skills inherit the same rule.
Final Verification (mandatory last step in every superpowers plan)
Every superpowers plan MUST end with a task that runs the verification
skill. When writing a plan, the last numbered task must be:
### Task N: Final Verification
- [ ] Run the `verification` skillDo not mark a feature branch done until this task passes with all
gates green. Consult the skill's SKILL.md for the gate list.
Branching
- Do not commit directly to
main. The only exception is hotfixes targeting a released version - and even those should go via a PR unless the situation is genuinely urgent. See the "Hotfix flow" section inCONTRIBUTING.mdfor the branch-from-main pattern and the## Developmentcleanup that follows. - Day-to-day work lands on
develop, either via PRs from feature branches or directly by maintainers. - Releases are cut by opening a PR from
developintomain. The merge commit onmainis the release commit; the tag is created from that commit. SeeCONTRIBUTING.mdfor the full release flow. - When opening a PR, the default base branch is
developunless the change is an explicit release PR or hotfix tomain.
Commits
Follow Conventional Commits (see CONTRIBUTING.md).
- No mentions of AI tools, agents, or assistants anywhere in commits.
- No
Co-Authored-By: Claude ...or any other AI co-author lines. - No "generated by", "with AI assistance", or similar phrases in any part of a commit.
GPG Signing
Commits in this repository are expected to be GPG-signed.
At the end of any session that produces commits (superpowers workflows, standalone fixes, or any other work), before wrapping up, run:
git log --format="%G? %h %s" | head -20G= good signature - nothing to do.NorB= unsigned or bad signature.
If any commits lack a valid signature, offer to re-sign them. Do NOT do this automatically - ask first and only proceed if the user confirms. The re-sign command is:
LAST_SIGNED=$(git log --format="%G? %H" | awk '$1=="G"{print $2; exit}')
git rebase --onto "$LAST_SIGNED" "$LAST_SIGNED" HEAD \
--exec "git commit --amend --no-edit -S && git restore go.work.sum 2>/dev/null; true"Do not mention GPG during the session - only check at the very end, after all other work is done.
Testing
- Coverage must be ≥ 90% per package
- All tests must pass under the race detector
- Run
make test-coverageandmake test-racebefore committing
Makefile
make is the entry-point for all build, lint, test, and code-generation tasks.
| Command | Purpose |
make init | First-time setup: install tools, generate protobuf |
make build | Build locksmith and locksmith-pinentry |
make build-all | Build locksmith + all vault plugins |
make lint | Run golangci-lint and buf linter |
make test | Unit tests across all workspace modules |
make test-race | Unit tests with race detector |
make test-coverage | Coverage report (HTML + summary table in .reports/) |
make test-integration | Integration tests (require running daemon + plugins) |
make verify | Run all quality gates (lint, race, coverage, build, GPG, docs) |
make proto | Regenerate protobuf Go code from .proto files |
make tidy | Run go mod tidy across all workspace modules |
make install-tools | Install pinned tool versions into $GOPATH/bin |
Dependency Changes
Whenever a dependency is added or removed, run the check-licenses skill.
This audits third-party Go dependencies for license compatibility with Apache 2.0.
Run it before committing any change to go.mod / go.sum.
Code Conventions
CLI command files (internal/cli/)
Each Cobra subcommand lives in its own file named <command>_cmd.go (e.g. get_cmd.go,
serve_cmd.go). Files that do not define a command (e.g. root.go, client.go,
color.go, errors.go) are exempt. Tests for a command go in <command>_cmd_test.go.
Logging
Use internal/log (zerolog). Never use fmt.Print* in daemon/plugin code.
Documentation
All documentation lives in docs/. Keep README.md focused on install + quickstart.
Plugin Documentation
Each built-in plugin under plugins/<name>/ ships its own README.md covering
installation, configuration examples, and troubleshooting. The canonical YAML
schema lives in docs/configuration.md; the plugin README links to it rather
than duplicating it.
Whenever a plugin's behavior, configuration fields, or external requirements
change, update plugins/<name>/README.md in the same commit.
Adding a new vault plugin
When you add a new vault plugin under plugins/<name>/, update the
following in the same change:
internal/config/types.go- add aVault<Name>constant.internal/initflow/detect.go- add detection of the vault binary and flipImplemented: trueonce the plugin is shipped.docs/configuration.md- new section describing the vault type and its options.docs/plugins/README.md- add to the bundled-plugins list.README.md- update the vault-comparison table and the Configuration example.PLUGINS.md- add to the opening paragraph.CHANGES.md- bullet under## Development.Agent templates - update every template under
internal/initflow/agents/<agent>/templates/to add a usage example in the "Retrieving Secrets" section:locksmith get --vault <type> --path "<example-path>"Templates touched:
agents/claude/templates/claude_md.md.tmpl,agents/claude/templates/claude_skill.md.tmpl,agents/codex/templates/codex_agents.md.tmpl,agents/gemini/templates/gemini_md.md.tmpl,agents/opencode/templates/instructions.md.tmpl, andagents/generic/templates/instructions.md.tmpl.- Run
make verifyto ensure all gates pass. The cross-template tests ininternal/initflow/agents_test.goblock regressions by asserting that every shipped vault appears in every template.
Bundled Plugins
Default plugins (gopass, keychain) and locksmith-pinentry ship
embedded inside the locksmith binary as a per-platform zip. locksmith
init extracts the plugins for the chosen vaults to
~/.config/locksmith/plugins/ and pinentry to
~/.config/locksmith/bin/locksmith-pinentry. Plugin version is locked to
the host locksmith version - no network resolution. See
PLUGINS.md for the full overview.
Changelog (CHANGES.md)
Every user-visible change must be recorded in CHANGES.md under
## Development in the same commit as the code change - never
as a follow-up. One bullet per logical change. Breaking changes
start with BREAKING: (see the changelog skill for the full
rules).
When writing a superpowers plan, include an explicit task for
updating CHANGES.md before the "commit" step:
- [ ] Update CHANGES.md under ## Development with a summary of the changeFor releases, run the release-prep skill on develop: it
verifies docs are updated for each accumulated change, then drives
version-bump (which itself invokes changelog for compression).
See CONTRIBUTING.md for the release-via-PR flow.
Typography
All documentation and comments must use ASCII punctuation only:
- Hyphens (
-) instead of em dashes (-) or en dashes - Straight double quotes (
") instead of curly quotes (" ") - Straight single quotes (
') instead of curly apostrophes (' ')
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

