Skip to content

feat(workspace): add tiered bootstrap loading with configurable bootstrapTier#22439

Open
882soft wants to merge 10 commits intoopenclaw:mainfrom
882soft:feature/tiered-bootstrap-loading
Open

feat(workspace): add tiered bootstrap loading with configurable bootstrapTier#22439
882soft wants to merge 10 commits intoopenclaw:mainfrom
882soft:feature/tiered-bootstrap-loading

Conversation

@882soft
Copy link
Copy Markdown

@882soft 882soft commented Feb 21, 2026

Closes #22438

Motivation

Bootstrap files consume LLM tokens on every session. For users with large workspaces, loading all files into every session — including sub-agents and cron jobs — wastes context window budget on files the agent never references. This PR introduces tiered loading so users can control how much context each session type receives, reducing unnecessary token usage while preserving persona consistency where needed.

What

Introduces a three-tier bootstrap file loading system (minimal | standard | full) with a new agents.defaults.bootstrapTier configuration option.

Why

The current binary split (main=all, subagent/cron=minimal) doesn't support use cases where subagents need persona context or where main sessions should be lightweight. This adds a clean, backward-compatible middle ground that lets users optimize their token budget per session type.

How

  • resolveBootstrapTier(sessionKey, tierOverride) — Resolves effective tier from session type + optional config override
  • filterBootstrapFilesForSession(files, sessionKey, tierOverride) — Extended with optional tier parameter (backward compatible — no tierOverride = existing behavior)
  • Config: agents.defaults.bootstrapTier in zod schema, TypeScript types, labels, and help text

Testing

11 unit tests covering:

  • Default tier resolution for main/subagent/cron sessions
  • Config override behavior
  • File filtering per tier
  • Backward compatibility (no tier = existing behavior)
  • Full tier including extra bootstrap files

All tests pass.

Changes

File Change
src/agents/workspace.ts BootstrapTier type, resolveBootstrapTier(), extended filter
src/agents/bootstrap-files.ts Wire tier from config
src/config/zod-schema.agent-defaults.ts Zod schema for bootstrapTier
src/config/types.agent-defaults.ts TypeScript type
src/config/schema.labels.ts UI label
src/config/schema.help.ts Help text
src/agents/workspace.tiered-bootstrap.test.ts 11 tests

7 files changed, 145 insertions(+), 3 deletions(-)

@882soft 882soft force-pushed the feature/tiered-bootstrap-loading branch from ff1de5f to 8009d57 Compare February 21, 2026 05:18
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S labels Feb 21, 2026
@882soft 882soft force-pushed the feature/tiered-bootstrap-loading branch from 8009d57 to b138be0 Compare February 21, 2026 05:18
Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

8 files reviewed, 3 comments

Edit Code Review Agent Settings | Greptile

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Feb 21, 2026

Additional Comments (1)

src/hooks/bundled/bootstrap-extra-files/handler.ts
missing tierOverride parameter when filtering extra bootstrap files

the hook calls filterBootstrapFilesForSession without passing the tier from config (context.cfg?.agents?.defaults?.bootstrapTier), so extra files won't be filtered correctly for sessions with a configured tier

    const tierOverride = context.cfg?.agents?.defaults?.bootstrapTier as import("../../../agents/workspace.js").BootstrapTier | undefined;
    context.bootstrapFiles = filterBootstrapFilesForSession(
      [...context.bootstrapFiles, ...extras],
      context.sessionKey,
      tierOverride,
    );
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/hooks/bundled/bootstrap-extra-files/handler.ts
Line: 50-53

Comment:
missing `tierOverride` parameter when filtering extra bootstrap files

the hook calls `filterBootstrapFilesForSession` without passing the tier from config (`context.cfg?.agents?.defaults?.bootstrapTier`), so extra files won't be filtered correctly for sessions with a configured tier

```suggestion
    const tierOverride = context.cfg?.agents?.defaults?.bootstrapTier as import("../../../agents/workspace.js").BootstrapTier | undefined;
    context.bootstrapFiles = filterBootstrapFilesForSession(
      [...context.bootstrapFiles, ...extras],
      context.sessionKey,
      tierOverride,
    );
```

How can I resolve this? If you propose a fix, please make it concise.

@882soft 882soft force-pushed the feature/tiered-bootstrap-loading branch from b138be0 to e8916da Compare February 21, 2026 05:19
@882soft
Copy link
Copy Markdown
Author

882soft commented Feb 21, 2026

Usage Examples

Here are a few concrete scenarios where tiered bootstrap loading helps:

1. Lightweight sub-agents for quick tasks

Without this change, spawning a sub-agent to do a simple file search loads all 8 bootstrap files (~500+ tokens of context). With tiered loading, sub-agents stay on minimal by default:

# No config needed — sub-agents already default to minimal
# Only AGENTS.md + TOOLS.md are loaded

Token savings: ~300-400 tokens per sub-agent spawn, which adds up fast if you spawn 10+ sub-agents in a session.

2. Persona-consistent cron notifications

A daily summary cron job should sound like your configured persona, not a generic bot. Currently cron jobs only get AGENTS.md + TOOLS.md — no personality context:

agents:
  defaults:
    bootstrapTier: "standard"  # Now cron jobs load SOUL.md + IDENTITY.md too

Before: "Here is your daily summary. 3 tasks completed."
After: Matches your SOUL.md tone — e.g., casual, formal, or domain-specific language.

3. Token-conscious main sessions

Users with large MEMORY.md files (10K+ tokens) might want main sessions to skip heavy files on simple queries:

agents:
  defaults:
    bootstrapTier: "minimal"  # Main sessions load lean context

This is an advanced use case for power users who manage context budgets carefully.

4. Full context for long-running projects

agents:
  defaults:
    bootstrapTier: "full"  # Load standard files + any extraBootstrapFiles patterns

Useful when you have custom bootstrap files (e.g., PROJECT.md, CONVENTIONS.md) registered via extraBootstrapFiles and want them included automatically.


Happy to add any of these as documentation or adjust the implementation based on feedback!

@882soft
Copy link
Copy Markdown
Author

882soft commented Feb 21, 2026

CI failure is in tui-formatters.test.ts — unrelated to this PR. Same test fails on main.

@882soft 882soft force-pushed the feature/tiered-bootstrap-loading branch from d4f2f5e to 9441998 Compare February 21, 2026 06:54
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Feb 28, 2026

Greptile Summary

This PR successfully introduces a three-tier bootstrap loading system (minimal | standard | full) with configurable agents.defaults.bootstrapTier. The implementation is clean, well-tested, and fully backward compatible.

Key Changes:

  • Added resolveBootstrapTier() function to determine effective tier based on session type and config
  • Extended filterBootstrapFilesForSession() to accept optional tier override
  • Integrated tier configuration across config schema, types, labels, and help text
  • Added 11 unit tests with good coverage of tier resolution and filtering logic

Minor Issues:

  • Comment references non-existent config path agents.defaults.extraBootstrapFiles (should reference hook config)
  • "standard" and "full" tiers currently behave identically; consider adding distinct behavior for "full" to match documentation

The core functionality is solid and addresses the stated goal of reducing unnecessary token usage by allowing users to control context window budget per session type.

Confidence Score: 4/5

  • Safe to merge with minor documentation inconsistencies
  • The implementation is correct, well-tested, and backward compatible. The core logic properly handles tier resolution and file filtering. Two minor documentation/design issues were identified (incorrect config path in comment, and identical behavior between standard/full tiers), but these don't affect functionality or introduce bugs. The changes align well with the repository's coding standards and testing practices.
  • No files require special attention - all changes are straightforward and well-implemented

Last reviewed commit: 9441998

Comment thread src/agents/workspace.ts
Comment on lines +506 to +508
* - `"full"` — Standard set plus any extra bootstrap file patterns
* configured via `agents.defaults.extraBootstrapFiles`.
*/
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment mentions agents.defaults.extraBootstrapFiles but this config path doesn't exist. Extra files are configured via the bootstrap-extra-files hook config, not via agents.defaults. Update the comment to reference the correct configuration path.

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/agents/workspace.ts
Line: 506-508

Comment:
The comment mentions `agents.defaults.extraBootstrapFiles` but this config path doesn't exist. Extra files are configured via the `bootstrap-extra-files` hook config, not via `agents.defaults`. Update the comment to reference the correct configuration path.

How can I resolve this? If you propose a fix, please make it concise.

Comment thread src/agents/workspace.ts
Comment on lines 533 to 545
export function filterBootstrapFilesForSession(
files: WorkspaceBootstrapFile[],
sessionKey?: string,
tierOverride?: BootstrapTier,
): WorkspaceBootstrapFile[] {
if (!sessionKey || (!isSubagentSessionKey(sessionKey) && !isCronSessionKey(sessionKey))) {
return files;
const tier = resolveBootstrapTier(sessionKey, tierOverride);
if (tier === "minimal") {
return files.filter((file) => MINIMAL_BOOTSTRAP_ALLOWLIST.has(file.name));
}
return files.filter((file) => MINIMAL_BOOTSTRAP_ALLOWLIST.has(file.name));
// "standard" and "full" both include all loaded files.
// "full" additionally loads extra bootstrap patterns — handled by the caller.
return files;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently "standard" and "full" tiers behave identically - both include all loaded files (including extra bootstrap files from the hook). Consider adding logic to distinguish them, e.g., only include extra bootstrap files when tier is "full". This would make the tier names more intuitive and match the help text description that says full is "standard + extra patterns".

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/agents/workspace.ts
Line: 533-545

Comment:
Currently `"standard"` and `"full"` tiers behave identically - both include all loaded files (including extra bootstrap files from the hook). Consider adding logic to distinguish them, e.g., only include extra bootstrap files when tier is `"full"`. This would make the tier names more intuitive and match the help text description that says full is "standard + extra patterns".

<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>

How can I resolve this? If you propose a fix, please make it concise.

@882soft 882soft force-pushed the feature/tiered-bootstrap-loading branch from 403a49f to 469287a Compare February 28, 2026 01:24
@882soft
Copy link
Copy Markdown
Author

882soft commented Mar 1, 2026

Still active. Waiting for CI to pass on the latest push (38d9e0ab9). Will update once confirmed green.

@882soft 882soft force-pushed the feature/tiered-bootstrap-loading branch from 38d9e0a to 2838a32 Compare March 18, 2026 03:00
@882soft
Copy link
Copy Markdown
Author

882soft commented Mar 18, 2026

CI failures are unrelated to this PR (channel package build errors)

@openclaw-barnacle
Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added stale Marked as stale due to inactivity and removed stale Marked as stale due to inactivity labels Mar 24, 2026
@882soft
Copy link
Copy Markdown
Author

882soft commented Mar 29, 2026

This pull request has been automatically marked as stale due to inactivity. Please add updates or it will be closed.

Still active. Waiting for CI to pass on the latest push (38d9e0a). Will update once confirmed green.

@openclaw-barnacle
Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Apr 4, 2026
@882soft
Copy link
Copy Markdown
Author

882soft commented Apr 4, 2026

CI failures are from main, not this PR

@openclaw-barnacle openclaw-barnacle Bot removed the stale Marked as stale due to inactivity label Apr 17, 2026
@openclaw-barnacle
Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added stale Marked as stale due to inactivity and removed stale Marked as stale due to inactivity labels Apr 22, 2026
@steipete
Copy link
Copy Markdown
Contributor

steipete commented Apr 26, 2026

Codex review: needs maintainer review before merge.

What this changes:

The PR branch adds a schema-backed agents.defaults.bootstrapTier option, tier-aware workspace bootstrap filtering, extra-bootstrap hook tier wiring, generated config metadata/help, and focused tier tests.

Maintainer follow-up before merge:

This is an open implementation PR for prompt-context and public config semantics, paired with an open proposal and prior maintainer-side keep-open guidance; the next action is human product/API review and normal PR review, not an autonomous repair job.

Best possible solution:

Keep the PR open with #22438 for maintainer product/API review. If accepted, refresh it against current main and land the tier contract across source, hook, schema/types, generated metadata/help/docs, and focused tests; if maintainers prefer an existing or alternate context-control model, close it manually after that decision.

Acceptance criteria:

  • pnpm test src/agents/workspace.test.ts src/agents/bootstrap-files.test.ts src/hooks/bundled/bootstrap-extra-files/handler.test.ts src/config/zod-schema.agent-defaults.test.ts src/config/schema.base.generated.test.ts
  • pnpm exec oxfmt --check --threads=1 src/agents/workspace.ts src/agents/bootstrap-files.ts src/hooks/bundled/bootstrap-extra-files/handler.ts src/config/zod-schema.agent-defaults.ts src/config/types.agent-defaults.ts src/config/schema.labels.ts src/config/schema.help.ts
  • pnpm build if generated schema, public config, docs, or published surfaces change

What I checked:

  • current-main-no-tier-symbols: Exact symbol search found no bootstrapTier, BootstrapTier, resolveBootstrapTier, or tiered-bootstrap docs/tests in current main. (2d53b49b20e1)
  • current-filter-is-binary: filterBootstrapFilesForSession accepts only files plus optional session key; main/non-subagent sessions return all files, while subagent/cron sessions use a fixed minimal allowlist. (src/agents/workspace.ts:677, 2d53b49b20e1)
  • bootstrap-resolution-does-not-read-tier: resolveBootstrapFilesForRun calls filterBootstrapFilesForSession(rawFiles, sessionKey) and does not read params.config?.agents?.defaults?.bootstrapTier. (src/agents/bootstrap-files.ts:229, 2d53b49b20e1)
  • config-schema-lacks-bootstrap-tier: The agent defaults schema exposes skipBootstrap, contextInjection, bootstrapMaxChars, and bootstrapTotalMaxChars, but no bootstrapTier field. (src/config/zod-schema.agent-defaults.ts:91, 2d53b49b20e1)
  • extra-bootstrap-hook-not-tier-aware: The bundled bootstrap-extra-files hook appends extra files and reruns filtering with only context.sessionKey, so current main has no standard-vs-full tier distinction for extras. (src/hooks/bundled/bootstrap-extra-files/handler.ts:58, 2d53b49b20e1)
  • current-tests-cover-binary-behavior: Current workspace tests assert all files for main/non-subagent sessions and only allowlisted files for subagent/cron sessions; there are no tier override tests on main. (src/agents/workspace.test.ts:359, 2d53b49b20e1)

Likely related people:

  • steipete: The PR discussion includes maintainer-side review from steipete keeping this work open for product/API review, and recent history shows Peter Steinberger touched the central bootstrap/config/hook paths in the release consolidation commit available in this checkout. (role: maintainer reviewer / adjacent bootstrap-config owner; confidence: high; commits: be8c24633aaa; files: src/agents/workspace.ts, src/agents/bootstrap-files.ts, src/hooks/bundled/bootstrap-extra-files/handler.ts)
  • Vincent Koc: Current blame for the relevant bootstrap filtering, bootstrap resolution, hook, and config-schema lines points to commit ad2516b in this checkout, which touched the same central files shortly before the current main SHA. (role: recent maintainer; confidence: medium; commits: ad2516b1c876; files: src/agents/workspace.ts, src/agents/bootstrap-files.ts, src/hooks/bundled/bootstrap-extra-files/handler.ts)

Remaining risk / open question:

  • This changes user-facing prompt-context semantics for main, subagent, and cron sessions, so maintainers need to decide whether agents.defaults.bootstrapTier is the right public API versus existing lightContext, contextInjection, and newer AGENTS/SUBAGENTS direction.
  • The extra-bootstrap hook is prompt-exposure-sensitive; standard-vs-full behavior should be explicitly accepted so extra files are not injected into sessions unexpectedly.
  • If accepted, generated schema/help/docs and UI/config discoverability must stay aligned with the new public config field.

Codex review notes: model gpt-5.5, reasoning high; reviewed against 2d53b49b20e1.

882soft added 6 commits April 26, 2026 13:31
…trapTier

Introduces a three-tier bootstrap file loading system:
- 'minimal': AGENTS.md + TOOLS.md only (default for subagent/cron sessions)
- 'standard': All recognized bootstrap files (default for main sessions)
- 'full': Standard set plus extra bootstrap file patterns

The tier can be configured via agents.defaults.bootstrapTier, allowing
users to override the default session-type heuristic. For example,
subagent sessions can be promoted to 'standard' to receive SOUL.md,
IDENTITY.md, and other persona files.

Changes:
- Add BootstrapTier type and resolveBootstrapTier() to workspace.ts
- Extend filterBootstrapFilesForSession() with optional tierOverride
- Add bootstrapTier to config schema, types, labels, and help text
- Wire tier resolution through bootstrap-files.ts
- Add comprehensive test suite (11 tests)
- standard tier now filters to recognized bootstrap files only, excluding
  extra patterns loaded by the bootstrap-extra-files hook
- full tier includes all files (standard + extras)
- fix comment: agents.defaults.extraBootstrapFiles → bootstrap-extra-files hook
- add tests verifying standard vs full tier behavior
…ENTITY+USER)

Upstream expanded the minimal bootstrap allowlist to include SOUL.md,
IDENTITY.md, and USER.md alongside AGENTS.md and TOOLS.md. Align the
tiered bootstrap implementation with this change to fix CI failures
in workspace.test.ts and handler.test.ts.
@882soft 882soft force-pushed the feature/tiered-bootstrap-loading branch from 7f7fcc2 to cf99538 Compare April 26, 2026 04:32
@882soft
Copy link
Copy Markdown
Author

882soft commented Apr 26, 2026

@steipete Codex review acknowledged — keeping the PR alive.

Quick status update:

  • Rebased onto latest upstream/main (cf995381f1) — single conflict in zod-schema.agent-defaults.ts was the recent "never" literal addition to contextInjection; cleanly merged with our bootstrapTier field, both kept.
  • Last commit pushed: cf995381f1 ci: retry parity gate.
  • 11 unit tests in workspace.tiered-bootstrap.test.ts still pass against the rebased base.
  • Awaiting CI; recent failures (tui-formatters, "Approval turn tool followthrough" parity gate timeout) have been observed on main and adjacent feature branches, so they are not introduced by this change.

Ready for human review whenever bandwidth allows. Happy to split into a smaller PR or address any specific concerns flagged in the Codex bot's notes.

Upstream main consolidated DEFAULT_MEMORY_FILENAME = CANONICAL_ROOT_MEMORY_FILENAME and removed the separate _ALT_ constant. Our STANDARD bootstrap allowlist still referenced the old name, breaking type-check after the rebase.

The single DEFAULT_MEMORY_FILENAME entry already covers the canonical case, so the _ALT_ entry was redundant — drop it.
@882soft
Copy link
Copy Markdown
Author

882soft commented Apr 26, 2026

After today's rebase + fix push (08c5a695ff) the build/lint/type/test matrix is green except for one parity-gate flake:

  • Job: Run the OpenAI / Opus 4.6 parity gate against the qa-lab mock
  • Result: passed=11 failed=1 total=12
  • Failed scenario: thread-memory-isolation (8/12)
  • Failure reason: timed out after 45000ms on the step "answers the memory-backed fact inside the thread only" — not a wrong answer, the mock provider just didn't respond inside the 45s budget

Reasons we believe this is the same mock-LLM flake we noted on 2026-04-16, not a regression introduced by this PR:

  • The companion memory test Memory recall after context switch (7/12) passes, so the memory subsystem itself is intact
  • Different scenarios flake on different runs — approval-turn-tool-followthrough was the flaky one on the 2026-04-16 run, this run that scenario passes and thread-memory-isolation flakes instead
  • Gateway logs in the uploaded artifact (parity-gate-22439) contain no bootstrapTier / tier / bootstrap-loading error trace; the failure is a clean 45s timeout with no crash
  • 11 of 12 scenarios pass, including all the cases that actually exercise the bootstrap-loading code path this PR changes

Fork can't gh run rerun directly (admin rights required), so leaving this for maintainer attention rather than pushing another ci: retry parity gate commit and adding history noise. Happy to push a retry commit if a maintainer prefers — just give me a thumbs-up and I'll do it.

@clawsweeper
Copy link
Copy Markdown
Contributor

clawsweeper Bot commented Apr 29, 2026

Codex review: found issues before merge.

Summary
The PR adds agents.defaults.bootstrapTier, tier-aware workspace bootstrap filtering, extra-bootstrap hook wiring, generated config metadata/help, and focused tier tests.

Reproducibility: yes. for the blocking PR finding by source inspection: current main appends hook extras for a main session with no tier, while PR head resolves an undefined tier to standard and filters hook files out. The broader request is a feature/config change, so normal issue reproduction is not applicable.

Next step before merge
Human product/API review is the next step because the remaining decision is the public prompt-context tier contract; narrow backcompat and changelog repairs should follow that decision.

Security
Cleared: No concrete security or supply-chain regression found; the diff changes prompt-context filtering and config metadata, not dependencies, CI, secrets, downloads, or code execution.

Review findings

  • [P2] Preserve legacy extra-bootstrap injection — src/agents/workspace.ts:753-755
  • [P3] Add the required changelog entry — src/config/zod-schema.agent-defaults.ts:89-91
Review details

Best possible solution:

Keep this PR and #22438 open for maintainer product/API review; if accepted, preserve legacy no-tier extra-file behavior, document the public config, add the changelog entry, and validate the bootstrap/config test slice together.

Do we have a high-confidence way to reproduce the issue?

Yes for the blocking PR finding by source inspection: current main appends hook extras for a main session with no tier, while PR head resolves an undefined tier to standard and filters hook files out. The broader request is a feature/config change, so normal issue reproduction is not applicable.

Is this the best way to solve the issue?

No, not as-is. The tiered direction may be useful, but the branch should preserve backward compatibility, add required release/docs coverage, and get maintainer sign-off on the public API before merge.

Full review comments:

  • [P2] Preserve legacy extra-bootstrap injection — src/agents/workspace.ts:753-755
    When no bootstrapTier is configured, main sessions now resolve to standard, and the standard filter drops every hook-sourced file. The bundled hook passes an undefined override for existing configs, so users who already configured bootstrap-extra-files.paths stop receiving those extras despite the backward-compatible/no-tier claim. Keep the legacy undefined path, or only apply standard/full extra filtering when users explicitly opt into tier semantics.
    Confidence: 0.91
  • [P3] Add the required changelog entry — src/config/zod-schema.agent-defaults.ts:89-91
    This adds a user-facing agents.defaults.bootstrapTier config knob and changes prompt-context behavior, but the branch does not update CHANGELOG.md. OpenClaw policy requires user-facing feature changes to include a changelog entry before merge.
    Confidence: 0.94

Overall correctness: patch is incorrect
Overall confidence: 0.88

What I checked:

Likely related people:

  • steipete: The PR discussion includes maintainer-side review from steipete, and recent main history shows steipete touching workspace bootstrap and bootstrap-file resolution paths. (role: maintainer reviewer / adjacent bootstrap-config owner; confidence: high; commits: 3db60f7eab84, 217273037b26; files: src/agents/workspace.ts, src/agents/bootstrap-files.ts, src/config/zod-schema.agent-defaults.ts)
  • solstead: The bootstrap-extra-files hook history points to solstead's plugin API/bootstrap file globs work as the original merged feature area for the hook this PR changes semantically. (role: introduced hook surface; confidence: medium; commits: ab71fdf821b2; files: src/hooks/bundled/bootstrap-extra-files/handler.ts, src/agents/workspace.ts)
  • mainstay22: Recent main history added an adjacent workspace bootstrap config option across the same workspace/config/docs surface this PR extends. (role: recent adjacent config owner; confidence: medium; commits: 94543092be04; files: src/agents/workspace.ts, src/config/zod-schema.agent-defaults.ts, src/config/types.agent-defaults.ts)
  • vincentkoc: Recent main history includes bootstrap snapshot/loading and context-injection work near the affected bootstrap resolution path. (role: recent bootstrap maintainer; confidence: medium; commits: 015f7dc7472d, 9ba97ceaed89; files: src/agents/bootstrap-files.ts, src/agents/workspace.ts)

Remaining risk / open question:

  • The public bootstrapTier contract overlaps existing skipBootstrap, contextInjection, minimal subagent behavior, and related session-scoped extra-file work.
  • The standard/full distinction is prompt-context-sensitive and could surprise operators already using bootstrap-extra-files unless the no-tier path stays backward compatible.

Codex review notes: model gpt-5.5, reasoning high; reviewed against 978bc53e80cc.

882soft added 2 commits April 30, 2026 09:31
…ndard tier

The standard tier filter previously matched only on basename, so a
hook-loaded extra like packages/core/AGENTS.md would pass through
the root allowlist and inject extra prompt context — making
standard indistinguishable from full on the real hook path.

Tag each WorkspaceBootstrapFile with provenance ("root" | "hook")
at load time. The standard tier filter now excludes source="hook"
explicitly. Root-loaded files keep their existing semantics; the
field is optional and absent values default to root for back-compat.

- src/agents/workspace.ts: add WorkspaceBootstrapFileSource and
  source field; tag root files in loadWorkspaceBootstrapFiles and
  hook extras in loadExtraBootstrapFilesWithDiagnostics; update
  STANDARD filter to require source !== "hook".
- src/agents/workspace.tiered-bootstrap.test.ts: add regression
  unit test asserting hook-sourced files with allowlist-matching
  basenames are excluded under standard.
- src/hooks/bundled/bootstrap-extra-files/handler.test.ts: add
  hook-level tests with a real packages/core/AGENTS.md fixture
  covering both standard (excluded) and full (included) tiers;
  scope existing append test to full tier.

Addresses Codex review feedback (P2).
The public type comment claimed minimal is "AGENTS.md + TOOLS.md
only" but the actual implementation includes SOUL.md, IDENTITY.md,
and USER.md. Updated the jsdoc to match the resolved allowlist
and clarify that "full" extras are loaded via the
bootstrap-extra-files hook. The generated help text in
schema.help.ts and schema.base.generated.ts is already consistent
with this list.

Addresses Codex review feedback (P3).
@882soft
Copy link
Copy Markdown
Author

882soft commented Apr 30, 2026

CI status update — 2 fails were flaky, 1 fail appears upstream-related

After the retry commit (683f5576), the previously-failing checks resolved as follows:

  • checks-node-core — now passing
  • checks-node-core-support-boundary — now passing
  • Scan changed paths (precise) — same opengrep error: File not found: src/channels/plugins/contracts/test-helpers/CLAUDE.md

I verified locally:

  • git diff upstream/main...HEAD for this PR = 10 files (the intended bootstrap-tier changes only)
  • 0 references to CLAUDE.md / test-helpers / channels/plugins/contracts anywhere in the PR diff
  • The path in the opengrep error doesn't exist in the current tree (ls src/channels/plugins/contracts/test-helpers/ → no such directory)

This looks like an opengrep configuration / stale-path issue on main, unrelated to this PR. Could a maintainer take a look at scripts/run-opengrep.sh (or the rules config) to confirm? Happy to help dig if it would be useful.

Locally pnpm test test/scripts/test-projects.test.ts -t "narrows default-lane"
passes both at baseline 08c5a69 and at HEAD 4098f81 — diff between commits
on **/test-projects* is empty. The previous run's 'narrows default-lane changed
source files to include globs' failure appears to be flaky / build-cache state
on the core-support-boundary shard, unrelated to the four files this PR touches
(workspace.ts, types.agent-defaults.ts, workspace.tiered-bootstrap.test.ts,
bootstrap-extra-files/handler.test.ts). Retriggering the workflow.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Tiered bootstrap file loading for progressive context control

2 participants