Skip to content

Not enough custimization User freedom. #476

@0xAdamFortuna

Description

@0xAdamFortuna

Feature Request: Auto-Inject USER Context Files at Session Start

Summary

I created Markdown files with personal context (communication preferences, environment rules, life goals) that I want auto-injected at the beginning of each session.

Currently, it doesn't seem like there is a way to auto-inject USER files without risk of them being overwritten during future PAI system updates.

Below are my observations and different approaches I discovered.


The Problem

Current Behavior

  1. LoadContext.hook.ts only injects skills/CORE/SKILL.md (line 164-175)
  2. SKILL.md contains an instruction: "Upon loading this file, also read: ${PAI_DIR}/skills/CORE/USER/TELOS/*.md"
  3. But instructions ≠ automatic injection — the AI doesn't reliably execute file reads from instructions
  4. Files like USER/DAIDENTITY.md and USER/TELOS/*.md exist but are never loaded into context

What I Want

  • Auto-inject USER/TELOS/*.md files at session start (personal goals, communication preferences, environment rules)
  • Auto-inject USER/DAIDENTITY.md (AI personality customization)
  • Have these survive PAI updates without re-applying changes

Evidence

I tested this across multiple sessions. When asked "Did you read USER/DAIDENTITY.md?" the AI consistently answered:

"No, I have not read USER/DAIDENTITY.md. The CORE skill references it as the location for personality and interaction style configuration, but I was not shown its contents."

Same result for TELOS files — they only get loaded when explicitly invoked via /Telos skill or manual file reads.


Current Architecture Understanding

Location Tier Survives Updates?
hooks/*.ts SYSTEM No
settings.json HYBRID Values preserved, structure may change
skills/CORE/SKILL.md SYSTEM No
skills/CORE/SYSTEM/* SYSTEM No
skills/CORE/USER/* USER Yes
skills/_ALLCAPS/* USER Yes

The USER tier is protected, but there's no mechanism to auto-inject USER content.


Possible Solutions

Option 1: Modify LoadContext.hook.ts (Current Workaround)

Add USER file loading after line 175:

// Read USER context files
const userContextFiles = [
  join(paiDir, 'skills/CORE/USER/DAIDENTITY.md'),
  ...globSync(join(paiDir, 'skills/CORE/USER/TELOS/*.md'))
];

let userContext = '';
for (const file of userContextFiles) {
  if (existsSync(file)) {
    userContext += `\n\n--- ${file} ---\n` + readFileSync(file, 'utf-8');
  }
}
Pros Cons
Works immediately hooks/ is SYSTEM tier
Clean implementation Must re-apply after every PAI update

Option 2: Add USER Hook Support

Allow hooks to be defined in USER tier, e.g., skills/CORE/USER/hooks/:

// settings.json
"SessionStart": [
  { "command": "${PAI_DIR}/hooks/LoadContext.hook.ts" },
  { "command": "${PAI_DIR}/skills/CORE/USER/hooks/LoadUserContext.hook.ts" }
]
Pros Cons
User hook code survives settings.json hook config might be overwritten
Clean separation Requires settings.json structure change

Option 3: Make USER Auto-Load a Core Feature

Modify LoadContext.hook.ts to always check for and load:

  • skills/CORE/USER/DAIDENTITY.md (if exists)
  • skills/CORE/USER/TELOS/*.md (if directory exists)
  • skills/CORE/USER/AUTOLOAD/*.md (new convention)
Pros Cons
Permanent solution Requires PR acceptance
Benefits all PAI users Increases context size
USER files naturally protected

Option 4: Environment Variable for Extra Context Files

Add a setting like:

// settings.json
"contextFiles": [
  "${PAI_DIR}/skills/CORE/USER/DAIDENTITY.md",
  "${PAI_DIR}/skills/CORE/USER/TELOS/*.md"
]

Then LoadContext.hook.ts reads this array and injects those files.

Pros Cons
User configurable settings.json might be overwritten
Explicit control More complex

Option 5: Dedicated AUTOLOAD Directory

Create convention: skills/CORE/USER/AUTOLOAD/*.md — any .md file here gets auto-injected.

Pros Cons
Simple convention Requires LoadContext.hook.ts change
USER tier (survives updates)
Easy to manage

Recommended Approach

Option 3 or Option 5 — Make it a core PAI feature that USER context files are auto-loaded.

The files already exist in the right place (USER/TELOS/*.md, USER/DAIDENTITY.md). The SKILL.md already instructs reading them. The infrastructure is 90% there — just needs LoadContext.hook.ts to actually read them.

Suggested implementation:

// In LoadContext.hook.ts, after reading SKILL.md

// Auto-load USER context files (these survive PAI updates)
const userAutoloadPaths = [
  join(paiDir, 'skills/CORE/USER/DAIDENTITY.md'),
  join(paiDir, 'skills/CORE/USER/TELOS/*.md'),
  join(paiDir, 'skills/CORE/USER/AUTOLOAD/*.md')  // Optional: explicit autoload dir
];

let userContext = '\n\n--- USER CONTEXT (Auto-loaded) ---\n';
for (const pattern of userAutoloadPaths) {
  const files = globSync(pattern);
  for (const file of files) {
    if (existsSync(file)) {
      userContext += `\n### ${basename(file)}\n` + readFileSync(file, 'utf-8') + '\n';
    }
  }
}

// Append to paiContent before outputting
paiContent += userContext;

This maintains the SYSTEM/USER separation while actually delivering on the promise of USER customization.


Environment Info

  • PAI Version: 2.3
  • Platform: WSL2 (Ubuntu) on Windows
  • Claude Code with Claude Opus 4.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions