agentleFS
NeerajG03NeerajG03/JEFF/CLAUDE.md

JEFF

CLAUDE.md1 starsChanged 3 months agoMITView on GitHub

Agent workspace manager — Go CLI + SDK built on gig. Each package has its own CLAUDE.md with contextual detail — auto-loaded when working in that area. ⚠️ NEVER touch, repoint, or replace the live jeff command, and never build a local dev build into it. Do NOT go install, go build -o jeff into PATH, symlink, alias, mv, or otherwise overwrite/shadow the installed jeff binary or change what jeff on PATH resolves to. The running orchestrator and every active…

  • Installs packages

The file

Show its rules and text

We split this CLAUDE.md into the rules it gives an agent

16 rules. About 0 are common, 5 are distinctive, and 11 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 11

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    SDK-first: All logic in root package + sub-packages.

    line 46
  2. Very specific:

    gig is the brain: All task state in gig via SDK (import "github.com/NeerajG03/gig").

    line 47
  3. Very specific:

    All public SDK functions return (*Type, error) or error.

    line 50
  4. Very specific:

    All of it lives in home.go.

    line 58
  5. Distinctive:

    When the ownership test is uncertain, do nothing.

    line 192
  6. Distinctive:

    Test the collision, not just the happy path: Every one of the four shipped with tests that passed, because the fixtures never contained a …

    line 193
  7. Very specific:

    Don't store task state in JEFF — use gig SDK.

    line 239
  8. Very specific:

    Don't shell out to gig CLI — use import "github.com/NeerajG03/gig".

    line 240
  9. Very specific:

    Don't hardcode JEFF_HOME paths — use ResolveHome() (or cfg.Home in cmd/jeff).

    line 241
  10. Very specific:

    Don't write the home pointer outside jeff init / jeff home use — see JEFF_HOME above.

    line 242
  11. Very specific:

    Don't persist absolute paths inside the home — use internal/homepath.

    line 243
  12. Very specific:

    Don't pass $HOME where a JEFF home is wanted — they are different things.

    line 244
  13. Distinctive:

    Don't delete a task workspace on close — retire it (see above).

    line 245
  14. Very specific:

    Don't use workspace.List to show active work — use ListActive.

    line 246
  15. Very specific:

    Don't match a path with strings.Contains — see "Matching paths" above.

    line 247
  16. Distinctive:

    Don't re-tag released versions — Go module proxy caches checksums.

    line 248

≈ “Common” is an estimate: at least 1 in 5 of the 29,248 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

JEFF

Agent workspace manager — Go CLI + SDK built on gig.

Layout

JEFF/
├── jeff.go             # Core types: AgentTool, IDE enums
├── config.go           # LoadConfig, SaveConfig, ResolveHome, RepoConfig
├── repo.go             # AddRepo, RemoveRepo, ListRepos, SetPostSetup
├── attrs.go            # EnsureAttrs — define JEFF custom attributes in gig
├── crew/               # Multi-agent orchestration (SQLite + tmux)
├── embed/              # Embedded assets (CLAUDE.md template, claude-settings.json)
├── hooks/              # Hook system: registry, builtin hooks, claude/opencode delivery
├── memory/             # Persona memory + repo learnings management
├── persona/            # Embedded persona templates (dickson, eric, hardy, jenko, marlowe, schmidt)
├── skill/              # Skill registry, matching, and injection (symlinks into task dirs)
├── tui/                # Bubbletea dashboard (jeff dashboard)
├── workspace/          # Task workspace + worktree management + branch naming
├── cmd/jeff/           # CLI (cobra) — thin wrapper over SDK
├── docs/               # Guides (testing, adding commands, config reference)
└── *_test.go           # Unit tests alongside source

Each package has its own CLAUDE.md with contextual detail — auto-loaded when working in that area.

Build & Test

go build -o /tmp/jeff-dev ./cmd/jeff/   # local test build — throwaway path, invoke explicitly: /tmp/jeff-dev ...
go test ./...
go vet ./...

⚠️ NEVER touch, repoint, or replace the live jeff command, and never build a local dev build into it. Do NOT go install, go build -o jeff into PATH, symlink, alias, mv, or otherwise overwrite/shadow the installed jeff binary or change what jeff on PATH resolves to. The running orchestrator and every active crew worker depend on the installed jeff — swapping it out mid-session kills them (this has repeatedly caused workers to die). For local testing always build to a throwaway path (e.g. /tmp/jeff-dev) and invoke that path explicitly; leave the system jeff untouched. Shipping a real change goes through the normal PR + release flow, not by repointing the local command.

Conventions

  • SDK-first: All logic in root package + sub-packages. CLI is a thin cobra wrapper.
  • gig is the brain: All task state in gig via SDK (import "github.com/NeerajG03/gig"). Never shell out to gig CLI.
  • SQLite for crew only: crew/ uses SQLite (modernc.org/sqlite, no CGO) for session state. Everything else uses filesystem + gig.
  • Module path: github.com/NeerajG03/JEFF — must match GitHub repo URL.
  • All public SDK functions return (*Type, error) or error.
  • Tests use t.TempDir() for isolation.
  • No CGO dependencies.
  • Task dirs are ephemeral — gig is the source of truth, not the filesystem.

JEFF_HOME

Resolved via: JEFF_HOME env var → ~/.config/jeff/home pointer → ~/.jeff/ default. All of it lives in home.go. Read that file's header before touching anything home-related — the rules below are load-bearing, and four shipped bugs came from breaking them.

Two operations, never conflated

QuestionWho asksMay write the pointer?
Selection"where should a home live?"jeff init, jeff home use — onceyes
Resolution"where is my home?"every other command, every runnever
  • ResolveHome() / ResolveHomeWithSource() — resolution. Read-only by contract.
  • SelectHomeForInit(SelectHomeOpts{...}) — selection. --home → --here → env → pointer → default.
  • WriteHomePointer() — selection path only.

ResolveHomeWithSource also returns a HomeSource (flag/env/pointer/default). Surface it in anything user-facing — jeff home and jeff doctor both print it. Every bug here was hard to see because the provenance was invisible.

The three layers are three scopes, not three ways to do one thing

LayerLifetimeWhy it must exist
$JEFF_HOMEone process / one tmux sessioncrew.Start does tmux set-environment JEFF_HOME so every pane inherits one home and workers can't drift onto a different jeff.db
~/.config/jeff/homeper user, persistentthe install record — the only thing that knows a non-default home exists
~/.jeffbootstrapthe very first run, before any pointer

Rules

  1. Never write the pointer from a read path. It used to "self-heal" on every command, so one throwaway JEFF_HOME=/tmp/x jeff status permanently repointed the pointer for every future shell — the most transient layer promoting itself to the most durable. Pinned by TestResolveHomeNeverWrites.
  2. Never derive a home yourself. No os.UserHomeDir() + ".jeff", no second ResolveHome() inside a process that already has cfg.Home. A duplicate resolver drifts from the real one (jeff init did, → #82; --global did, → #85). Inside cmd/jeff, prefer cfg.Home; resolvedJeffHome() encodes that preference.
  3. Store paths inside the home as home-relative via internal/homepath — Rel on write, Abs on read. Absolute paths are what made the home non-relocatable (#84). Paths genuinely outside the home stay absolute; they aren't the home's to move.
  4. $JEFF_HOME is not $HOME. identity.ProjectDirName (.jeff) is a per-directory marker like .git; the home is a different thing that merely defaults to ~/.jeff. identity.GlobalFilePathIn takes the JEFF home.
  5. Relocating a home is mv + jeff home use <path>. Registries travel on their own; home use repairs leftovers and regenerates the per-agent settings, whose hook commands must be absolute to be executable. jeff doctor flags stored paths that escape the resolved home (home_paths_relative).
JEFF_HOME/
├── CLAUDE.md           # agent instructions (editable, resettable)
├── jeff.json           # config: agent, IDE, repos, hooks
├── .claude/            # Claude Code settings + hooks
├── .opencode/          # opencode settings
├── hooks/              # hook scripts (managed by jeff)
├── scripts/            # user scripts (branch naming, post-setup, etc.)
├── repos/              # registered codebases (git clones)
├── tasks/              # active task workspaces (ephemeral)
├── worktrees/          # centralized git worktrees (symlinked into tasks)
├── projects/           # project workspaces (jeff project init|open|list)
├── .skills/            # user-added skills (jeff skill add)
├── .personas/          # user-added persona templates
└── exports/            # generated artifacts

Task workspaces vs worktrees — the cost asymmetry

worktrees/<repo>/<branch>/   ~200 MB–1 GB   a full checkout
tasks/<slug>/                ~20 KB         hook scripts, .claude/settings.json, symlinks

A task dir is not just where a task's files live — it is the running session's life support: its cwd, the hook SCRIPTS themselves, and the settings.json that names those scripts by absolute path. jeff done used to RemoveAll it, which killed every subsequent hook and Bash spawn in the invoking session (#94) — and silently dropped the SessionEnd memory/transcript capture with it.

So the two are treated by cost, not symmetry:

jeff donejeff cleanup
worktreeremoves it — this is the reclamationremoves orphans (clean; dirty needs --force)
task dirretires it: drops dangling symlinks, writes .closedcollects it (no live worker, past --older-than)

--purge on done restores the old delete-everything behavior.

Rules:

  1. Never delete a task dir on close. The fix works by construction — no cwd detection needed, and it holds however the task was closed, including from another terminal, which cwd inspection can never see.
  2. Anything presenting workspaces as current work must use workspace.ListActive, not List — a directory existing no longer means the task is live. Same for the .closed check in taskWorkspaces (hook sync).
  3. Creating a workspace un-retires it (workspace.Create → Unretire). A closed task can be reopened and picked up into the very dir it was retired in; a stale marker would hide it from status, skip its hook sync, and let the GC delete it under a live session.
  4. The GC never guesses. It skips a workspace with a live anchored worker, a non-terminal task, or one inside the grace period, and never discards a dirty worktree without --force. An unreachable gig store means "not terminal", so a store failure can never cause a deletion.

Matching paths — the house failure mode

Four separate defects here have had one shape: match a path coarsely, then mutate on the match. Three were caught only in review, none by tests. Assume the fifth is in whatever you are writing now.

MatchedThenConsequence
#95script basenamerewrote the entrysilently rewrote a user's own hook
#96gig id anywhere in a pathdeleted the worktreecould delete a live worktree for an open task
#106script basename, cross-eventdeleted the blockdeleted a user's hand-registered hook outright
gig-0459hotfix as a substringrenamed the branchwould misfire on 5 real branches in our own repos

The rules, in order of how often they would have saved us:

  1. Match whole path segments, never substrings. feature/CB-8888_workflow_status_hotfix is not a hotfix branch. worktrees/gig-app/jeff/gig-b222-x does not belong to gig-app. Split on the separator and compare segments; if you find yourself reaching for strings.Contains on a path, stop.
  2. Scope the match to the part you mean. A worktree path is <worktrees>/<repo>/<branch...>; a task id lives in the branch portion, so match there and nowhere else (taskIDForWorktree). Rejecting a path that escapes the root matters too — filepath.Rel will happily hand you a ../.. walk that still matches.
  3. Before mutating something you did not write, prove you own it. isRepairableHookRef and isJeffOwnedCrossEventRef are the pattern: absolute path, under our layout, and carrying our marker (or demonstrably dangling). A live file someone else owns is never yours to rewrite or delete.
  4. Prefer the failure direction that leaks over the one that loses. Under- deleting leaves garbage a later sweep collects; over-deleting destroys work. When the ownership test is uncertain, do nothing.
  5. Test the collision, not just the happy path. Every one of the four shipped with tests that passed, because the fixtures never contained a same-key different-owner case. Construct one deliberately: a foreign file sharing a basename, a repo named like a task id, a branch containing the keyword.

Config (jeff.json)

{
  "$schema": "https://raw.githubusercontent.com/NeerajG03/JEFF/main/schemas/jeff-config.json",
  "agent": "claude",
  "ide": "cursor",
  "gig_home": "",
  "repos": {
    "backend": {
      "url": "https://github.com/org/backend.git",
      "base_branch": "origin/develop",
      "branch_name": "scripts/branch.sh",
      "post_setup": "scripts/setup.sh"
    }
  },
  "hooks": {
    "gig-ready-tasks": false
  }
}

See docs/config.md for full reference.

Package Guides

Each package has a CLAUDE.md with types, file roles, and extension patterns:

PackageGuideWhat it covers
crew/crew/CLAUDE.mdSQLite store, session lifecycle, tmux ops, message types
hooks/hooks/CLAUDE.md16 built-in hooks, static vs dynamic scripts, delivery
memory/memory/CLAUDE.mdPersona memory, repo learnings, /learn command
persona/persona/CLAUDE.mdEmbedded templates, model defaults, adding personas
skill/skill/CLAUDE.mdRegistry, matching logic, injection, embedded skills
tui/tui/CLAUDE.mdBubbletea dashboard, tabs, refresh, styles
workspace/workspace/CLAUDE.mdTask dirs, worktrees, branch naming, .jeff-base
cmd/jeff/cmd/jeff/CLAUDE.mdCLI conventions, key helpers, thin wrapper pattern

What NOT to Do

  • Don't store task state in JEFF — use gig SDK.
  • Don't shell out to gig CLI — use import "github.com/NeerajG03/gig".
  • Don't hardcode JEFF_HOME paths — use ResolveHome() (or cfg.Home in cmd/jeff).
  • Don't write the home pointer outside jeff init / jeff home use — see JEFF_HOME above.
  • Don't persist absolute paths inside the home — use internal/homepath.
  • Don't pass $HOME where a JEFF home is wanted — they are different things.
  • Don't delete a task workspace on close — retire it (see above); a live session lives there.
  • Don't use workspace.List to show active work — use ListActive.
  • Don't match a path with strings.Contains — see "Matching paths" above.
  • Don't re-tag released versions — Go module proxy caches checksums.

Personas

Embedded in binary via persona/templates/. Used via --persona flag on pickup.

PersonaRole
dicksonOrchestrator — plans, delegates, reviews. Does NOT write code.
ericResearcher — explores, documents, recommends. Does NOT change code.
hardyReviewer — reviews diffs, checks quality, flags issues.
jenkoImplementer — writes code, runs tests, ships. Default persona.
marloweMemory curator — curates proposals into canonical memory. Used by jeff memory curate.
schmidtDebugger — investigates, traces root causes, finds the fix.

Further Reading

  • docs/config.md — full configuration reference (repos, hooks, branch naming, IDE)
  • docs/testing.md — test infrastructure, existing test files
  • docs/adding-commands.md — step-by-step guide for new CLI commands crew, memory may import the root package; the root package must never import them

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.