Repository navigation
Description
Context
gstack-skill-start stores two feature acknowledgement markers beside its resolved runtime path:
.feature-prompted-continuous-checkpoint.feature-prompted-model-overlay
When GStack runs through a supported project-local sidecar such as .agents/skills/gstack/bin, the runtime path is inside the caller's repository. The emitted instructions therefore tell the agent to create machine-specific state inside that repository.
Priority: P1. A normal GStack skill invocation mutates the caller's repository outside the requested task. This violates the project boundary, dirties Git worktrees, and can cause machine-specific files to enter commits and pull requests.
Current state
Verified against main on 2026-08-29.
bin/gstack-skill-start:54 already defines the correct machine-state directory:
_GH="${GSTACK_HOME:-$HOME/.gstack}"The instruction layer separately derives an installation and asset root at bin/gstack-skill-start:315:
_ROOT_DIR=$(dirname "$_BIN")The feature gates at bin/gstack-skill-start:324-332 incorrectly use _ROOT_DIR for both their existence checks and emitted touch commands.
For a project-local invocation, the emitted command becomes:
touch "/repo/.agents/skills/gstack/.feature-prompted-continuous-checkpoint"The first affected skill invocation creates the checkpoint marker. The next invocation creates the model-overlay marker because the gates use if/elif.
Codex explicitly supports this project-local runtime layout:
hosts/codex.ts:9defines.agents/skills/gstackaslocalSkillRoot.hosts/codex.ts:19-22documents the repo-local runtime sidecar.setup:1170implementscreate_agents_sidecar.
Standard global installations usually hide the symptom because their runtime path sits outside the consumer repository. The state is still stored under the wrong ownership boundary, but git status remains clean.
The deterministic runtime behaviour arrived in v1.71 through PR #2691, commit 394db326f2d3aaccd4804fe846b82aaa7d189dee.
Root cause
The runtime uses _ROOT_DIR for two different purposes:
- Resolving installed GStack assets.
- Storing machine-specific acknowledgement state.
Those concerns have different ownership. Asset paths may follow a project-local runtime symlink. Machine state must remain under GSTACK_HOME, regardless of how the runtime was invoked.
Proposed change
Use _GH for only the two feature acknowledgement markers:
if [ ! -f "$_GH/.feature-prompted-continuous-checkpoint" ]; then
# Emit touch command using $_GH
elif [ ! -f "$_GH/.feature-prompted-model-overlay" ]; then
# Emit touch command using $_GH
fiKeep _ROOT_DIR unchanged for installed asset lookup, including gstack-upgrade/SKILL.md.
Add a regression test that invokes gstack-skill-start through a project-local bin symlink while setting a separate temporary GSTACK_HOME.
Acceptance criteria
- A project-local invocation emits the checkpoint marker path under
GSTACK_HOME. - The emitted checkpoint marker path does not contain
.agents/skills/gstack. - After the checkpoint marker exists, the next invocation emits the model-overlay marker path under
GSTACK_HOME. - The emitted model-overlay marker path does not contain
.agents/skills/gstack. - Feature discovery continues to emit no more than one feature prompt per invocation.
_ROOT_DIRremains in use for installed asset lookup.- Running a GStack skill through a project-local sidecar leaves the caller's Git worktree unchanged.
- Existing
gstack-skill-starttests pass.
Testing plan
| Layer | Test |
|---|---|
| Behaviour | Invoke gstack-skill-start through .agents/skills/gstack/bin, with a separate temporary GSTACK_HOME |
| Checkpoint gate | Assert the emitted touch path uses GSTACK_HOME and excludes the project sidecar |
| Overlay gate | Seed the checkpoint marker, invoke again, and assert the overlay path uses GSTACK_HOME |
| Regression | Run bun test test/gstack-skill-start.test.ts |
A local implementation has been verified:
- Two files changed.
- The new regression test fails against the original implementation.
bun test test/gstack-skill-start.test.ts: 14 passed, 0 failed.
Rollback plan
Revert the change to bin/gstack-skill-start and the corresponding regression test. No persisted data migration is required. Existing markers under GSTACK_HOME are zero-byte acknowledgement files.
Effort estimate
- Runtime change: approximately 5 minutes.
- Regression test: approximately 15 minutes.
- Targeted verification: approximately 10 minutes.
- Total: approximately 30 minutes.
Files reference
| File | Change |
|---|---|
bin/gstack-skill-start:54 |
Reuse the existing _GH machine-state root |
bin/gstack-skill-start:315 |
Preserve _ROOT_DIR for installed assets |
bin/gstack-skill-start:324-332 |
Route both marker checks and emitted commands through _GH |
test/gstack-skill-start.test.ts |
Add project-local symlink regression coverage |
hosts/codex.ts:9 |
Evidence that the project-local sidecar is supported |
setup:1170 |
Evidence for sidecar creation |
Out of scope
- Changing the project-local sidecar design.
- Adding marker files to
.gitignore. - Moving asset lookup from
_ROOT_DIR. - Changing feature-discovery sequencing or prompts.
- Moving GBrain artifacts or recovery checkpoints.
- Migrating or deleting marker files already created in consumer repositories.
Related
- PR v1.71.0.0 feat: token-load reduction — preamble runtime scripts, gated onboarding, 20 skill carves, CLAUDE.md trim #2691, runtime preamble consolidation.
- Issue setup --host claude leaves untracked files #840, related repository side effects from sidecar setup, but not a duplicate.
Activity
[-][P1] gstack-skill-start writes machine-state feature markers into project-local repositories[/-][+][P2] gstack-skill-start writes machine-state feature markers into project-local repositories[/+][-][P2] gstack-skill-start writes machine-state feature markers into project-local repositories[/-][+]gstack-skill-start writes machine-state feature markers into project-local repositories[/+]