Skip to content

docs(guide): recommended workspace layout for Trinity-compatible agents (#3797) - #3801

Merged
vybe merged 4 commits into
devfrom
feature/3797-workspace-layout
Oct 19, 2026
Merged

vybe merged 4 commits into
devfrom
feature/3797-workspace-layout

Conversation

@vybe

@vybe vybe commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #3797. This adds a recommended workspace layout to the Trinity-compatible agent guide.

What

docs/TRINITY_COMPATIBLE_AGENT_GUIDE.md → ## Directory Structure gains H3 subsections with a recommended layout: what is committed and what is gitignored, project folders, side clones, scratch space, and the directories the platform reserves. The heading is unchanged, so existing links still resolve.

  • Project work goes in project_files/<slug>/. Committed outputs go in reports/<kind>/.
  • Side clones are gitignored, one top-level directory per clone, named for its role (no repos/ wrapper). setup.sh clones if missing, refreshes with git pull --ff-only, prints the sha, and puts no token in the URL. A fetch + reset --hard refresh is only for a clone the agent never writes to. Submodules are only for an exact pin, with the caveats (bug: agent workspaces with git submodules are second-class in the platform's own git paths — create_agent skips them, git_pull fails on a moved pointer #2366, and a reset leaving the submodule checkout stale).
  • Scratch: use $TMPDIR (~/.tmp/), one subdirectory per job, and never clear it wholesale (~/.tmp/codex/). /tmp is a small RAM-backed noexec tmpfs sized by the operator.
  • memory/ is committed and shared across all users. Claude Code's auto-memory lives under ~/.claude/projects/ and is shared too. Per-person facts go through write_user_memory.
  • .trinity/ is reserved by the platform but written by the agent. People cannot edit it from the Files tab.

Pull vs reset, stated once and the same everywhere:

  • An ordinary pull rebases onto the remote and does not reset.
  • A reset to the template's main overwrites tracked files except those listed in .trinity/persistent-state.yaml. Without that file, a default set is kept: workspace/, .trinity/, .mcp.json, .claude.json and .claude/.credentials.json. Kept files are snapshotted to .trinity/backup/<ts>/. Untracked files are never touched.
  • A force-replace pull (offered on a pull conflict, and through the MCP git_pull tool) is the exception: it resets to the remote and runs git clean -fd, deleting untracked files that are not gitignored.
  • data/ is gitignored only once the agent declares data_paths; it is not in the fleet-wide patterns.

The fix commit makes the rest of the docs agree with the new section:

  • The Content Folder table, commit_paths example and Best Practices now name reports/<kind>/; outputs/ still works for older templates.
  • "Re-pull = reset" claims are corrected in docs/user-docs/faq/agents.md, docs/user-docs/agents/agent-data.md and docs/memory/feature-flows/agent-data-volumes.md.
  • Memory Management gains a pointer to memory/, and preferences.json is relabelled as agent preferences, never a person's details.

Commits: 7f9be37c7 guide section · 6d51351c3 FAQ pointer · 24c65fbf1 review fixes · a178c5efc validation round 1 fixes (force-replace pull, pull rebases, data/ ignore condition).

Rulings carried

Review + security

  • Reading review on an independent model returned MERGEABLE AFTER FIXES. Every fact was checked against its owning code and against the sibling prompt block, with no contradiction either way.
  • The review raised three consistency items (C1 committed folder, C2 reset default, C3 pull vs reset) plus a two-line Memory Management fix. All are fixed in 24c65fbf1.
  • /cso --diff found nothing; docker was down, which does not matter for a docs-only diff.
  • /validate-pr round 1 (review 5567835276) APPROVED with suggestions S1–S3. S1 was feat(prompt): "Your environment" block in the platform prompt (trinity-enterprise#945) #3800's blocker, so this PR was held as a draft and both were fixed together in round 2.
  • .claude and src/backend/enterprise are untouched. The only URL is a your-org placeholder, and the setup.sh example carries no token.

Tests

The five files that read the guide or the FAQ all pass (re-run on a178c5efc, same counts):

  • test_1402_prompt_contract: 18
  • test_1908_bundled_template_gitignore: 94
  • test_2007_mcp_template_render: 36
  • test_2110_widget_type_parity: 16
  • test_github_init_gitignore: 7

The guide still has exactly three gitignore fences, with the first untouched. All new internal links and the TOC resolve. The old #outputs-vs-content anchor has no inbound links.

Before merge

Handoffs (follow-ups, not in this PR)

Built by trinity-pm's build-chain run chain-agent-env (plan → rulings → implement → review → fix) through the fleet engineer.

🤖 Generated with Claude Code

Trinity Agent (trinity) and others added 3 commits October 19, 2026 01:30
Restates ## Directory Structure as three zones (platform-owned, committed,
volume-only) with three rules, project_files/<slug>/, $TMPDIR scratch,
gitignored side clones vs submodules (#2366), the .gitignore read as a
consequence of the zones, and source links. Drops the stale
.claude/skills-library/ mount line. Wording kept consistent with the
platform prompt's environment block (trinity-enterprise#945).

Refs #3797

Co-Authored-By: Claude Opus 5.5 <[email protected]>
#3797)

- Content Folder Convention, Best Practices and the commit_paths example
  name reports/<kind>/ as the committed work folder, matching the new
  Directory Structure tree; outputs/ is kept as a legacy name that still works.
- The reset-to-main sentence states the default persistent set used when
  .trinity/persistent-state.yaml is absent, and that untracked files are
  never touched.
- The FAQ, agent-data.md, the guide's data_paths section and the
  agent-data-volumes flow no longer call an ordinary template pull a reset.
- Memory Management points at the repo-level memory/ and keeps per-person
  facts out of it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@trinity-ability trinity-ability left a comment

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.

PR Validation Report: #3801

Lane A (docs only: 4 files, +115/−41), base dev, tip 24c65fbf1. Draft.

Category Status Notes
Commit messages ✅ 3 × docs(guide): … (#3797)
Base branch / size ✅ dev, 4 files
Status auto-promotion ⚠️ Body says Implements #3797, which is not a closing keyword. #3797 will not auto-promote. Its current label is status-ready, not status-in-progress.
Requirements / architecture ➖ Docs only
Feature flows ✅ agent-data-volumes.md reworded only; format unchanged
Security §4.1–4.3, 4.10, enterprise-docs grep ✅ No hits. The only /home/ path is the container's /home/developer/, and the only URL is the your-org placeholder. Trinity-enterprise#945 is cited by number only.
Merge gate (Tier 1) ✅ All required checks plus pytest (head) and regression diff are green. dev-ci is success and no dev-ci red issue is open.
Execution coverage ✅ Guard tests that read the guide/FAQ re-run in the PR worktree: test_1402_prompt_contract 18, test_1908_bundled_template_gitignore 94, test_2007_mcp_template_render 36, test_2110_widget_type_parity 16, test_github_init_gitignore 7. All pass.

Facts checked against the owning code

  • _DEFAULT_PERSISTENT_STATE = workspace/**, .trinity/**, .mcp.json, .claude.json, .claude/.credentials.json (docker/base-image/agent_server/routers/files.py:327). Snapshot goes to .trinity/backup/<ts>/ and the reset is reset --hard origin/main with no clean (routers/git.py:2766,2774). ✅
  • $TMPDIR = /home/developer/.tmp (capabilities.py:116) and .tmp/ is in _GITIGNORE_PATTERNS. /tmp is noexec with an operator-tunable size, default 512m (capabilities.py:83-92). .tmp/codex is Codex's home (files.py:263-270). ✅
  • public/ is PUBLISH_DIR, uploads/ is UPLOAD_BASE, content/ is created by startup.sh:768, and .trinity/* is write-denied in the Files tab (agent_service/files.py:71). ✅
  • Skills land at ~/.claude/skills/<name>/ (skill_service.py:13,407). The library lives at /data/skills-library on the backend, not as an agent mount, so removing the skills-library line is correct. ✅
  • #2366 is open and matches the submodule claim. Every new link and anchor resolves (#5-gitignore-required, #runtime-data-data_paths--1169, #platform-skills, …). ✅
  • Cross-check with #3800 (### Your environment): the user, durable volume, noexec /tmp → $TMPDIR, the reset-to-main default set, untracked files untouched, the folder list, .trinity/ (agent writes, Files tab cannot), committed memory/, and auto-memory under ~/.claude/projects/ all agree. No contradiction found.

Critical (block merge)

None.

Warnings

  • W1: closing keyword. Change Implements #3797 to Closes #3797 in the PR body, or #3797 strands without status-in-dev after merge.

Suggestions (non-blocking; fine as follow-ups)

  • S1: the force-reset pull deletes untracked files. docs/user-docs/agents/agent-data.md:11 says "neither wipes untracked files", and faq/agents.md:47 says the same. That is accurate for reset-to-main and the default pull. But the force_reset pull strategy (GitConflictModal and MCP git_pull) runs git clean -fd after its reset (routers/git.py:2567). That removes untracked, non-ignored files, for example uncommitted memory/ or reports/ files. Gitignored side clones and data/ survive. One clause would close the gap.
  • S2: "merges" vs rebase. The default (clean) pull is git pull --rebase (routers/git.py:2232). The guide (:442), FAQ and agent-data say "merges"; the feature flow and PR body say "merge or rebase". The feature-flow wording is the precise one.
  • S3: data/ is not gitignored by default. The zone table (TRINITY_COMPATIBLE_AGENT_GUIDE.md:405) says data/ is "never" committed. data/ is only gitignored once data_paths is declared (trinity_files.py:59,211), as the guide's own "Why the .gitignore" block says. Consider "never (gitignored when you declare data_paths)". The same unconditional "gitignored" appears in #3800's block. That is a note for its validation, not a contradiction with this guide.

Recommendation

APPROVE. The docs are accurate against the code and consistent with #3800, and every gate is green. Fix W1 before merge; S1–S3 are optional. Per the chain, merge alongside #3800.

@vybe

vybe commented Oct 19, 2026

Copy link
Copy Markdown
Contributor Author

Held as a draft by the build-chain orchestrator despite the APPROVE. Suggestion S1 (a force-replace pull runs git clean -fd) is the same fact that blocked the companion PR #3800. S2 (the default pull is --rebase) and S3 (data/ is gitignored only once data_paths is declared) were verified on dev too. Both PRs get the same correction in a fix commit, then CI and validation again.

#3797)

A force-replace pull (strategy=force_reset) runs git reset --hard then
git clean -fd, so it deletes untracked files that are not gitignored;
the default pull is git pull --rebase; data/ is gitignored only once
data_paths is declared. Wording matches the companion PR #3800.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@trinity-ability trinity-ability left a comment

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.

/validate-pr: round 2 on a178c5efc, APPROVE

Lane A. The PR changes only 4 docs files and makes no deletions in tests/. Secret, email, IP, file-mode and enterprise-guard greps found nothing. The only absolute path is /home/developer/, the agent container's home, not a host path. Tier 1 is green: 18 pass, 6 skipped, 0 failing. dev-ci is success.

Round-1 items

Item Status
S1 force-replace pull runs git clean -fd ✅ Fixed in all four files (guide Submodules + data_paths "already durable", FAQ, agent-data.md, feature flow). The sentence is word-for-word the #3800 ### Your environment wording. It matches the code: force_reset → git clean -fd in agent_server/routers/git.py, and the MCP git_pull exposes force_reset.
S2 the default pull is --rebase ✅ Guide, FAQ and agent-data.md say "rebases onto the remote", and the flow says "(a rebase)". This matches git pull --rebase in the agent server. No "pull merges" wording is left in the four files.
S3 data/ is gitignored only once data_paths is declared ✅ Zone table: "data/ never (gitignored once you declare data_paths)". This matches #3800's data/ bullet.
W1 closing keyword ✅ The body says "Fixes #3797".

Agreement with the #3800 block (8fd08e2)

  • Reset-to-main default keep-set (workspace/, .trinity/, .mcp.json, .claude.json, .claude/.credentials.json): identical. The guide adds the .trinity/backup/<ts>/ snapshot, which is an addition, not a contradiction.
  • Force-replace pull: identical sentence.
  • data/ ignore condition: same condition.
  • memory/ committed: stated in both. The guide's rule 3 and Memory Management also carry the shared-across-users caveat, matching #3800.
  • .trinity/: both say it is reserved or shared with the platform, the agent writes to it, and people cannot edit it from the Files tab.

Execution coverage (§5.4)

This is a docs-only PR. The five tests that read the guide or FAQ (test_1402, test_1908, test_2007, test_2110, test_github_init_gitignore) were re-run in the PR worktree on a178c5efc: 171 passed.

New findings

None blocking.

  • ⚠️ Note: #3797 carries status-ready, not status-in-progress. The on-merge promotion moves status-in-progress → status-in-dev, so the label may need a manual bump after merge.
  • Merge alongside #3800, as the body already says.

@vybe
vybe marked this pull request as ready for review October 19, 2026 07:30
@vybe
vybe merged commit 8aec1c8 into dev Oct 19, 2026
25 checks passed
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.

2 participants