Skip to content

Bind a folder of repositories once as a workspace - #7

Merged
Ukaykhingmarma28 merged 3 commits into
mainfrom
feat/workspace-init
Nov 23, 2026
Merged

Ukaykhingmarma28 merged 3 commits into
mainfrom
feat/workspace-init

Conversation

@Ukaykhingmarma28

Copy link
Copy Markdown
Collaborator

Summary

Bind a folder of repositories once; agents started in any of them record into that one Project and share one memory (ADR-0015).

acme-shop/                    ← atlas-cli init --workspace (once)
├── .atlas/workspace.json     ← marker; sessions.db stays the app's schema
├── frontend/   (git)         ← hooks installed · sessions + memory → acme-shop
└── backend/    (git)         ← hooks installed · sessions + memory → acme-shop
 Discover(cwd)
   walk up from cwd to the scope root; the nearest binding wins
-  nothing bound → not initialised
+  nothing bound → keep walking up, accepting only a bound workspace
+    found     → Project = the workspace folder, memory = the workspace folder
+  nothing     → not initialised   (a plain binding above a repository is still never found)
atlas-cli init --workspace         opt-in: on a terminal init asks, "This folder only" pre-selected;
                                   without one it only names the repositories
atlas-cli workspace                members and the agents hooked in each
atlas-cli workspace sync           hook repositories added since
atlas-cli workspace on | off       turn a bound folder into a workspace, or back
atlas-cli workspace add | remove   folders without git

Also in this PR:

  • Command tests start in a temporary directory: a test that did not chdir resolved the Project above the source tree and ran workspace off on a real one.
  • Taking Atlas's entries out of a JSON config that held nothing else removes the file instead of leaving {}, which became an untracked .mcp.json in every member repository.

Not yet: shell changes and commit links in member repositories (git still runs in the workspace folder, which is outside git).

Evidence

Sandbox: Docker, a clean copy of the sources, no network except the model download.

  • Before (the v0.6.1 binary, same end-to-end script): 14 passed, 42 failed. An agent in backend/ gets "not initialised" and nothing is recorded.
    After: 62 of 62 workspace checks pass:

    init --workspace in acme/ (frontend, backend)
    session in backend/              → acme store: 1 session, no .atlas/ in backend
    session in frontend/             → acme store: 2 sessions
    remember in backend/             → found by memory_search in frontend/; cited as backend/src/ttl.go
    git init mobile/, workspace sync → mobile hooked, its session recorded
    init in backend/                 → split off: its own store, left out of the workspace
    init without --workspace         → not a workspace; prints the repositories and `atlas-cli workspace on`
    workspace off, uninstall         → every member unhooked, no "{}" files left
    
  • Unit tests: go test and -race pass on all 34 packages. The earlier end-to-end checks pass (20 offline, 7 online). Lint reports 0 issues, go mod tidy -diff is clean, and the four release targets cross-compile. make release-check passes, make snapshot builds the archives, and install.sh installs the snapshot from them.

Merge Danger

Door: two-way for the code. Without .atlas/workspace.json every folder behaves as in v0.6.1, and atlas-cli workspace off returns a workspace to a single folder. Sessions captured in a cloud-bound workspace and already synced stay in that cloud Project.

Blast Radius: discovery

Every command and hook resolves its Project through Discover. Folders without a workspace marker resolve as before; tests cover a plain binding above a repository, a marker without a binding, and nested bindings. A config file that held only Atlas's entries is now deleted on removal rather than rewritten as {}.

🤖 Generated with Claude Code

Ukaykhingmarma28 and others added 3 commits November 24, 2026 00:04
A command test that does not chdir runs in the package directory, where
project discovery resolves whatever Project lies above the source tree.
Once discovery can reach a workspace above a repository, such a test acts
on a real Project: the stub test ran `workspace off` on one and unhooked
its repositories. Every command test now starts in an empty temporary
directory.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Taking Atlas's hooks or memory entry out of a JSON config that held
nothing else wrote it back as "{}". In a git repository that is an
untracked .mcp.json, and a workspace leaves one in every member
repository. The file is removed instead, as the Codex, Copilot and
OpenCode writers already do with theirs; a file that keeps other keys is
written as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Some teams keep one folder per product with each part (frontend/,
backend/, ...) its own git repository. Discovery stopped at the
repository, so an agent started in backend/ found no Project.

`atlas-cli init --workspace` binds the folder once (ADR-0015). The marker
is a sidecar, .atlas/workspace.json, so sessions.db stays the app's
schema. Discovery walks past a repository's root only to a bound
workspace: sessions from every member land in the workspace's store, and
memory lives in the workspace folder, shared by all of them. Agent and
git hooks go into every member. `atlas-cli workspace` lists the members
and which agents are hooked in each, hooks new ones (sync), converts a
bound folder (on, off) and takes folders without git (add, remove).

A workspace captures every repository below it, so it is opt-in: on a
terminal init asks with "This folder only" pre-selected, and without one
it only names the repositories and `atlas-cli workspace on`.

Shell changes and commit links in member repositories are not captured
yet: git still runs in the workspace folder, which is outside git.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Ukaykhingmarma28
Ukaykhingmarma28 merged commit 0cc3fc9 into main Nov 23, 2026
14 of 15 checks passed
@Ukaykhingmarma28
Ukaykhingmarma28 deleted the feat/workspace-init branch November 23, 2026 18:25
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.

1 participant