feat: add CLAUDEMAN_SCREEN env var to inform Claude sessions

Claude sessions spawned by Claudeman now receive environment variables:
- CLAUDEMAN_SCREEN=1 - Indicates running within Claudeman
- CLAUDEMAN_SESSION_ID - The session's unique identifier
- CLAUDEMAN_SCREEN_NAME - The GNU Screen session name (when applicable)

This helps prevent Claude from attempting to kill its own screen session
and allows sessions to be aware of their managed environment.

Also updated the default CLAUDE.md template to document this behavior.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
arkon
2026-01-21 04:30:08 +01:00
co-authored by Claude Opus 4.5
parent 3a44cfda32
commit 9bbd00db9a
3 changed files with 153 additions and 8 deletions
+20 -3
View File
@@ -551,7 +551,13 @@ export class Session extends EventEmitter {
cols: 120,
rows: 40,
cwd: this.workingDir,
env: { ...process.env, TERM: 'xterm-256color' },
env: {
...process.env,
TERM: 'xterm-256color',
// Inform Claude it's running within Claudeman (helps prevent self-termination)
CLAUDEMAN_SCREEN: '1',
CLAUDEMAN_SESSION_ID: this.id,
},
});
}
@@ -707,7 +713,12 @@ export class Session extends EventEmitter {
cols: 120,
rows: 40,
cwd: this.workingDir,
env: { ...process.env, TERM: 'xterm-256color' },
env: {
...process.env,
TERM: 'xterm-256color',
CLAUDEMAN_SCREEN: '1',
CLAUDEMAN_SESSION_ID: this.id,
},
});
}
@@ -803,7 +814,13 @@ export class Session extends EventEmitter {
cols: 120,
rows: 40,
cwd: this.workingDir,
env: { ...process.env, TERM: 'xterm-256color' },
env: {
...process.env,
TERM: 'xterm-256color',
// Inform Claude it's running within Claudeman
CLAUDEMAN_SCREEN: '1',
CLAUDEMAN_SESSION_ID: this.id,
},
});
this._pid = this.ptyProcess.pid;