Skip to content

feat(ambient): inject ambient-router skill at session start#84

Open
dean0x wants to merge 1 commit intomainfrom
feat/ambient-session-injection
Open

feat(ambient): inject ambient-router skill at session start#84
dean0x wants to merge 1 commit intomainfrom
feat/ambient-session-injection

Conversation

@dean0x
Copy link
Owner

@dean0x dean0x commented Mar 6, 2026

Summary

  • Restructures session-start-memory.sh to not early-exit when no memory file exists
  • Injects ambient-router/SKILL.md content directly into session context at startup
  • Updates ambient-prompt.sh preamble to reference "skill already in your session context" instead of requiring a Read tool call

Problem

ambient-prompt.sh line 38 tells Claude to "Read the ambient-router skill" — this requires Claude to make a Read tool call, which it often skips, making ambient mode appear broken. Additionally, the session-start hook exits early if no .memory/WORKING-MEMORY.md exists, meaning ambient injection would never fire for projects without working memory.

Fix

  1. Remove early exit: Session-start hook now builds context incrementally — memory section (if exists) + ambient section (if enabled) — either can fire independently
  2. Direct injection: Ambient router skill content is injected into additionalContext at session start, eliminating the need for a Read tool call
  3. Simplified preamble: ambient-prompt.sh now references the skill "already in your session context"

Test plan

  • npm run build passes (40 skill copies, 20 agent copies)
  • npm test — all 178 tests pass
  • With memory + ambient: context contains both memory and ambient router content
  • Without memory, with ambient: context still contains ambient router content (critical fix)
  • Without ambient: no ambient content injected

Closes #79
Part of #78

Restructures session-start-memory.sh to not early-exit when no memory
file exists. Ambient skill content is now injected directly into session
context, eliminating the unreliable "Read the ambient-router skill"
instruction in ambient-prompt.sh.

Key changes:
- session-start-memory.sh: builds context incrementally (memory section
  + ambient section), either can fire independently
- ambient-prompt.sh: references "skill already in your session context"
  instead of requiring a Read tool call

Fixes the critical gap where ambient mode was broken for projects
without working memory enabled.

Closes #79
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.

feat(ambient): inject ambient-router skill at session start

1 participant