Skip to content

app: --home is a home the person keeps: other tools' skills, program copies, fence - #2819

Merged
AbirAbbas merged 10 commits into
app/v3from
fix/app-home-keeps-login-skills
Nov 19, 2026
Merged

AbirAbbas merged 10 commits into
app/v3from
fix/app-home-keeps-login-skills

Conversation

@AbirAbbas

@AbirAbbas AbirAbbas commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

What was wrong

The desktop app runs codeaf app --home <dir> so its chats and settings stay apart from the command line's. That sets CODEAF_HOME for the whole process, and home.Login() follows CODEAF_HOME on purpose, so a disposable run or a test never imports a real person's skills. The side effect: under --home the engine looked for <dir>/.claude/skills, <dir>/.codex/skills, the Claude plugins and the rest, and the person's real ones were no longer imported.

Design

  • home.Login() is now THE accessor for the person's real login home. It answers, in order: the real home that home.KeepLogin() recorded in CODEAF_LOGIN_HOME; else CODEAF_HOME alone (unchanged quarantine); else the login home the state root resolves from.
  • runApp applies --home through a small useAppHome: it sets CODEAF_HOME as before and calls home.KeepLogin(). The record is put back when runApp returns, so an in-process test of the app door cannot leave one behind.
  • skills.Options gets OwnHomeDir. Codeaf's own <dir>/.codeaf/skills is read from it; every other root (.agents, .claude, .codex, .cursor, .gemini, .opencode, .goose, ~/.config/{opencode,goose}, Claude plugins, Codex's bundled skills) is read from HomeDir. Empty means HomeDir, so nothing changes for any caller that does not set it.
  • home.OwnLogin(dir) answers the app's folder when dir is the recorded real login home, and dir itself otherwise. Each of the six discovery callers passes it as OwnHomeDir.
  • An environment variable carries it to subprocesses: yes, CODEAF_LOGIN_HOME. The app's CODEAF_HOME already travels through the environment to the engine host and other children. Without the second variable a child would resolve Login() to the app folder and miss the real skills again. It is registered as operator plumbing in the settings allowlist, since only runApp writes it.

--home is a persistent home of its own, not a disposable one

The same root cause (every reader treating the state home as "the person's home") shows up in three more places, one commit each:

  • Program copies (R7). A kept app home's program copies (git worktrees of the person's checkouts) used to live under <state>/worktrees, inside the app's data folder. They now go to the OS cache folder, in a folder of their own per state home (<cache>/codeaf/worktrees/<name>-<12 hex of a hash of the state root>), so two installs never share a folder. A disposable home (a test or a CODEAF_HOME-only run) keeps its copies inside it, and an install without --home keeps its current place. Nothing deletes another install's live copies: the program copy cleanup only removes what its own state recorded. The repo's exclude file is shared by all installs, so programCopiesOnDisk now counts copies in the shared cache parent too, and one install finishing does not drop the exclude lines another install's copies still need.
  • --home before the state root is read (R10). main now applies --home first, before Adopt, Witness and telemetry read the state root, so those no longer act on the command line's ~/.codeaf for an app run. The pre-parse uses the same flag declarations as runApp (one newAppFlags), so the two cannot drift, and it only reacts to app. Other commands leave the environment alone.
  • The fence (R9). The unattended fence hid the state home's secret files. When the state home is the app's, the command line's own home (home.DefaultUnder(<login home>)) holds secrets too, and they were reachable. The fence now takes OtherCodeafHomes and hides them as well (skipped when it equals the state home).

Also pinned by tests: the canvas shelf the desk installs lives at exactly <state>/.codeaf/skills/workaf-canvas/SKILL.md and is found there, and <state>/skills/... is not read. Claude Code plugin discovery follows the login home.

Validation contract

  • Under app --home X, skills of the other harnesses (and plugins, Codex system skills) are read from the real login home.
  • Under app --home X, codeaf's own skills folder is X/.codeaf/skills; the command line's ~/.codeaf/skills is neither read nor written. State, sessions, logs, sockets and profile stay where --home puts them.
  • Without --home, behaviour is unchanged.
  • A process that sets only CODEAF_HOME keeps the quarantine. In a test binary, the recorded real home goes through the same gate as Dir()/Login(): with no pinned HOME it records the quarantine, and a CODEAF_LOGIN_HOME the test process was merely handed is not obeyed.
  • Project-scope skill roots are unaffected.
  • A child process inherits the app's environment and answers the same way.
  • An app home's program copies are in the cache folder, distinct per state home; a disposable home's stay inside it; the exclude lines survive while any install's copies exist.
  • --home is in effect before Adopt, Witness and telemetry read the state root.
  • The fence hides the command line's home too when the state home is elsewhere.

Tests

Each maps to a contract item above: internal/home (H11, H12), internal/skills (own_home_test.go: own-folder moved, unchanged without it, project scope, folded into the login home, InputPaths), internal/resident (import under app home, only-CODEAF_HOME quarantine, nothing moved), internal/remote (hosted folder list), internal/claudeagent (Claude Code plugin), cmd/codeaf (useAppHome, the early pre-parse, the fence's other home), internal/session (program copy folder per home, shared exclude), internal/executor (fence hides another home's secrets). They use temp dirs and set HOME/CODEAF_HOME/CODEAF_LOGIN_HOME explicitly.

Notes for reviewers

  • One subtle case: with the workspace opened at the login home itself, Discover still folds the home into the project as before (the project scope there reads <home>/.codeaf/skills, which is the project's own root by the existing rule) and reads the app's own folder once as a user root.
  • Other readers of foreign-harness files should switch to home.Login() rather than os.UserHomeDir().
  • Not handled here: a legacy pre-rename folder from an older build is not in the fence's hidden list. Left alone on purpose.
  • Manual pages and the app protocol doc are updated (copy folder, skills from other tools, CODEAF_LOGIN_HOME).

🤖 Generated with Claude Code

AbirAbbas and others added 10 commits November 18, 2026 20:42
…ills folder

Login is now the one accessor for the person's real login home, where other
programs keep their dot-folders. It answers the home that KeepLogin recorded in
CODEAF_LOGIN_HOME when the state root was moved for the desktop app, CODEAF_HOME
alone as before (a disposable run keeps its quarantine), and otherwise the
login home the state root is resolved from. A recorded value a test binary was
merely handed is not obeyed, and the value KeepLogin records goes through the
same test-binary gate as the rest.

skills.Options gains OwnHomeDir, so codeaf's own <dir>/.codeaf/skills can be
read from the app's folder while every other root, the plugins and Codex's
bundled skills are read from HomeDir. InputPaths follows it. With OwnHomeDir
empty nothing changes.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
`codeaf app --home <dir>` moved the state root and, with it, the login home the
engine read other programs' skills from, so the app stopped seeing the skills
kept for Claude Code, Codex and the rest. The flag is now applied by
useAppHome, which sets CODEAF_HOME as before and also records the real login
home (home.KeepLogin) in the environment, so the engine's child processes
answer the same way. The record is restored when runApp returns.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The import pass and its change stamps, the hosted engine's folder list, the
Claude Code plugin, the terminal picker and the app's skill list all call
skills.Discover with the login home. Each now also passes home.OwnLogin of that
home as OwnHomeDir, so under the desktop app's --home other programs' skills
are read from the real home and codeaf's own from the app's folder, and the
command line's ~/.codeaf/skills is not read. Everywhere else OwnLogin answers
the home it was given and nothing changes.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…a folder of their own

Program copies are git worktrees of the person's repositories. Under
`codeaf app --home` home.Moved() is true, so they were made under the app's
state folder, which the person keeps and backs up. A home the person keeps
(home.Kept: the app's --home) now makes them in the account's cache folder,
under a folder named for the state home, so no install makes or finishes
another's. A home that only CODEAF_HOME moved keeps today's behaviour, copies
inside it, and so does a test.

The exclude lines codeaf adds for a copy's links live in the repository's one
shared exclude file, so programCopiesOnDisk counts a worktree under any
install's folder: with a folder per home an install would otherwise take the
lines out from under another's live copy.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
main ran the legacy-folder adoption, the first witness of the state root and the
crash-telemetry configuration before runApp parsed --home, so a WorkAF start read
its telemetry consent from the command line's profile and could adopt the
command line's legacy folder. useAppHomeEarly reads --home for `app` at the top
of main, from the same flag set runApp uses (newAppFlags), and applies it with
useAppHome. runApp still applies it, which is idempotent.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…hidden too

The unattended fence hid only the secret files of home.Dir(). Under
`codeaf app --home` that is the app's folder, so the command line's keys and
sign-ins in the person's own ~/.codeaf were readable by the app's unattended
runs. FenceOptions gains OtherCodeafHomes, and the fence names the person's
default codeaf folder there when it is not the state home.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@AbirAbbas AbirAbbas changed the title app: --home keeps the person's login home, so other tools' skills are still read app: --home is a home the person keeps: other tools' skills, program copies, fence Nov 19, 2026
@AbirAbbas
AbirAbbas merged commit 2097ee7 into app/v3 Nov 19, 2026
7 of 10 checks passed
@AbirAbbas
AbirAbbas deleted the fix/app-home-keeps-login-skills branch November 19, 2026 02:27
AbirAbbas added a commit that referenced this pull request Nov 23, 2026
… (#2883)

app/v3 was landed on dev on 2026-11-11. Five pull requests merged into app/v3 afterwards are now on dev, one commit each in this change:

- connect: GitHub is a connector, and it is the Factory's GitHub (app/v3 #2645)
- fix(app): connect independent custom providers and revalidate saves (app/v3 #2649)
- app: --home is a home the person keeps: other tools' skills, program copies, fence (app/v3 #2819)
- update: an engine inside a macOS app bundle is left to its app (app/v3 #2820)
- update: a desktop app's engine is told to update the app, not to rebuild (app/v3 #2840)

Co-authored-by: Santosh <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant