LoadContext: Claude desktop Code-tab sessions never load the constitutional layer (fallback covers sdk-ts/sdk-py only)

Abierto Apto para principiantes
#3,121 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 5 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
86/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
bun, typescript

Línea de trabajo

Comienza por hooks/LoadContext.hook.ts, cerca de la línea 430, y por el fallback existente de sdk-ts/sdk-py para LIFEOS_SYSTEM_PROMPT.md. Reproduce el problema con el comando Bun CLAUDE_CODE_ENTRYPOINT=claude-desktop del issue y, a continuación, añade el punto de entrada de escritorio a ese fallback conservando la exclusión de la reanudación. Ejecuta las comprobaciones de inicio para claude-desktop, sdk-ts, cli y una reanudación de escritorio; terminado significa que solo los hosts admitidos sin reanudación emiten el recordatorio.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Version

LifeOS 8.761.0 · attestation: not run

What is broken

Sessions started from the Claude desktop app's Code tab (CLAUDE_CODE_ENTRYPOINT=claude-desktop) run without the LifeOS constitutional layer. The desktop app starts the CLI itself, never through the lifeos launcher, so --append-system-prompt-file is never passed. The fallback in hooks/LoadContext.hook.ts (public PR #2240) tells the session to Read LIFEOS_SYSTEM_PROMPT.md, but only for sdk-ts and sdk-py. claude-desktop passes the channel gate (notification-channel maps it to desktop, public PR #2105), so it reaches that check and gets nothing.

The session-start banner still says "Constitutional rules are in the system prompt", so the session believes the rules are loaded. In practice rules such as flag-ambiguity-first and the response format never reach the model.

Where (file:line)

hooks/LoadContext.hook.ts:430

Repro on a clean tree
On a clean 8.761.0 install:

```bash
echo '{"source":"startup"}' | CLAUDE_CODE_ENTRYPOINT=claude-desktop bun ~/.claude/hooks/LoadContext.hook.ts 2>/dev/null | grep -c 'constitutional layer is not loaded'

Prints 0. With CLAUDE_CODE_ENTRYPOINT=sdk-ts (and a TERM set) it prints 1. Opening a Code-tab session in the desktop app shows the same: no Read of the system prompt and no reminder to do it.


### Negative control

Probe: `echo '{"source":"startup"}' | CLAUDE_CODE_ENTRYPOINT=claude-desktop bun /tmp/claude-1000/-home-<name>-ai-projects-tools-LifeOS/ec2673f7-837d-4c31-ba00-839575e86289/scratchpad/up/LifeOS/install/hooks/LoadContext.hook.ts 2>/dev/null | grep -q 'constitutional layer is not loaded'` · exit 1 · captured 2026-12-01T22:46:05.094Z

(no output)


### Suggested fix

Add `claude-desktop` to the entrypoints that get the reminder, and word the reminder so it fits a host that skipped the flag, not only one that replaced it:

```ts
const noPromptFileHosts = ['sdk-ts', 'sdk-py', 'claude-desktop'];
if (noPromptFileHosts.includes(entrypoint) && startSource !== 'resume' && existsSync(systemPromptFile)) {

Tested locally: claude-desktop and sdk-ts startups get the reminder, cli and a claude-desktop resume do not.

Environment
  • OS: Ubuntu 26.04.1 LTS (x64)
  • Harness: claude-code
  • bun: 1.4.5 · git: 2.53.0
  • Doctor broken: none
Lenguaje dominante
TypeScript
Estrellas
20k
Forks
2.5k
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de danielmiessler/LifeOS

Todos los issues de danielmiessler/LifeOS

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.