Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

session-lifecycle-hook appends duplicate exports to CLAUDE_ENV_FILE on every SessionStart

Open Beginner friendly
#788 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
88/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
javascript
Domain
tooling

Research direction

Start in scripts/session-lifecycle-hook.mjs at appendEnvVar() and trace how it runs for SessionStart events. Reproduce repeated startup, resume, clear, or compact events using the existing hook entry point, then verify that CLAUDE_ENV_FILE contains only one export line per variable and that repeated events no longer grow the file.

Written by the indexing model from the issue text.

Description

scripts/session-lifecycle-hook.mjs appendEnvVar() uses fs.appendFileSync on every SessionStart (startup, resume, clear, compact). Claude Code keeps the same env file for the session, so a long-lived session collects one duplicate 3-line block per compaction (31 blocks, 9.5 KB seen). On Windows this helped push the Bash tool past an 8,186-char command limit and broke Bash in that session. Fix: skip lines already present, or rewrite the file each time. The local patch that does this:

const line = `export ${name}=${shellEscape(value)}`;
let existing = "";
try { existing = fs.readFileSync(process.env.CLAUDE_ENV_FILE, "utf8"); } catch {}
if (existing.split("\n").includes(line)) return;
fs.appendFileSync(process.env.CLAUDE_ENV_FILE, `${line}\n`, "utf8");

Related: anthropics/claude-code#97692

Dominant language
JavaScript
Stars
34.2k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from openai/codex-plugin-cc

All issues in openai/codex-plugin-cc

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.