Summary
When Command Code is launched with the working directory set to the user's home
directory ($HOME), the instructions in ~/.commandcode/AGENTS.md are injected
into the system prompt multiple times. In the affected session the content
appeared up to three times, headed by two different Memory from: source paths
that both resolve to the same physical file. The project tier is being loaded
even though $HOME is not a real project.
This breaks the workflow of keeping a single global instructions file as user
tier memory while launching Command Code from $HOME (home directory doubling
as the project root).
Environment:
- Platform: Windows
- Working directory (
$PWD): C:\Users\probs
$HOME: C:\Users\probs
- The working directory equals
$HOME and is also detected as the project root
(project slug c-users-probs exists under ~/.commandcode/projects/).
Expected Behavior
Per the public memory documentation (https://commandcode.ai/docs, "Memory"),
Command Code loads three tiers of memory — user, project, and subdirectory — and
"every one that exists is loaded." The project tier is the project root's
<project>/AGENTS.md or <project>/.commandcode/AGENTS.md. When $HOME is the
project root, the user tier and the project tier resolve to the same physical
file, so its content is injected twice.
Expected: when the user-tier file and the project-tier file are the same
physical file (home directory == project root), the content should be loaded
exactly once, not once per tier.
Actual Behavior
The system prompt contains the same AGENTS.md content repeated, with these
Memory from: headers (observed across consecutive fresh sessions):
# Memory from: C:\Users\probs/.commandcode/AGENTS.md
<mandatory_instructions>
you must execute shell in ps7!
... (identical content) ...
</mandatory_instructions>
# Memory from: C:\Users\probs/.commandcode/AGENTS.md
<mandatory_instructions>
you must execute shell in ps7!
... (identical content) ...
</mandatory_instructions>
After adding an (empty) placeholder C:\Users\probs\AGENTS.md, the second head
changed to the root path but still contained the full content:
# Memory from: C:\Users\probs/.commandcode/AGENTS.md
# Memory from: C:\Users\probs/AGENTS.md
The model in a fresh session still reported both blocks as containing the full
instructions, even though C:\Users\probs\AGENTS.md was a zero-byte file on
disk (size = 0, sha256 = E3B0C442, the empty-string hash).
Steps to reproduce the issue
- Install Command Code (1.32.1) on Windows and create a global instructions
file at ~/.commandcode/AGENTS.md.
- Launch Command Code from
$HOME as the working directory
($PWD = $HOME = C:\Users\probs), so the home directory is detected as
the project root (~/.commandcode/projects/c-users-probs is created).
- Inspect the system prompt of a fresh session.
- Observe that the
~/.commandcode/AGENTS.md content is injected more than
once, under duplicate Memory from: headers pointing at the same physical
file.
Command Code Version
1.32.1
Operating System
Windows
Terminal/IDE
Unknown
Shell
cmd.exe
Session file (optional)
Not provided.
Fix prompt (optional)
Route the memory-resolution logic so it de-duplicates blocks whose resolved
source file is identical — dedupe by absolute path or content hash — and/or skip
the project tier when the project root equals $HOME (i.e., when there is no
real project). See the memory tier table in memory.md for the resolution order.
Additional context
The same master content (sha256 aab185f8...) is synced into multiple agents'
directories under $HOME by a personal sync script. Only Command Code
double-loads it:
AAB185F8 C:\Users\probs\.commandcode\AGENTS.md <- Command Code user tier (also project tier)
AAB185F8 C:\Users\probs\.dsh\AGENTS.md
AAB185F8 C:\Users\probs\.omp\agent\AGENTS.md
AAB185F8 C:\Users\probs\.pi\agent\AGENTS.md
AAB185F8 C:\Users\probs\Downloads\AGENTS.md
~/.claude/CLAUDE.md (Claude Code) is separate and read by its own agent; it
does not touch ~/.commandcode/AGENTS.md.
The relevant memory-resolution logic is documented in
https://commandcode.ai/docs/memory (bundled as memory.md):
Command Code reads three tiers, and every one that exists is loaded — they add up, they don't replace each other.
| Tier | Location |
| ------------ | -------------------------------------------------------------- |
| User | ~/.commandcode/AGENTS.md |
| Project | <project>/AGENTS.md or <project>/.commandcode/AGENTS.md |
| Subdirectory | <subdir>/AGENTS.md or <subdir>/.commandcode/AGENTS.md |
Project memory
Both <project>/AGENTS.md and <project>/.commandcode/AGENTS.md are checked, in
that order — the first one that exists is used, not both.
What I've tried:
- Created an empty placeholder at
C:\Users\probs\AGENTS.md so the project tier
would resolve to it (first-match) instead of re-reading
~/.commandcode/AGENTS.md. Result: the second Memory from: header changed
to C:\Users\probs/AGENTS.md but still carried the full content despite being
a zero-byte file. The duplication persisted.
- Removed the placeholder and restored the sync script (all experimental
changes reverted; setup back to original state).
- Searched the product docs and
cmd config list for a setting to disable the
project tier or de-duplicate memory when tiers share a file — no such setting
exists.
This is not fixable from the user side (short of launching from a different
directory, which breaks the home-directory workflow), because there is no
configuration to stop the project tier from loading a file it shares with the
user tier.
Please let me know if you need any further environment details or the full
session transcript excerpts.
Summary
When Command Code is launched with the working directory set to the user's home
directory (
$HOME), the instructions in~/.commandcode/AGENTS.mdare injectedinto the system prompt multiple times. In the affected session the content
appeared up to three times, headed by two different
Memory from:source pathsthat both resolve to the same physical file. The project tier is being loaded
even though
$HOMEis not a real project.This breaks the workflow of keeping a single global instructions file as user
tier memory while launching Command Code from
$HOME(home directory doublingas the project root).
Environment:
$PWD):C:\Users\probs$HOME:C:\Users\probs$HOMEand is also detected as the project root(project slug
c-users-probsexists under~/.commandcode/projects/).Expected Behavior
Per the public memory documentation (https://commandcode.ai/docs, "Memory"),
Command Code loads three tiers of memory — user, project, and subdirectory — and
"every one that exists is loaded." The project tier is the project root's
<project>/AGENTS.mdor<project>/.commandcode/AGENTS.md. When$HOMEis theproject root, the user tier and the project tier resolve to the same physical
file, so its content is injected twice.
Expected: when the user-tier file and the project-tier file are the same
physical file (home directory == project root), the content should be loaded
exactly once, not once per tier.
Actual Behavior
The system prompt contains the same AGENTS.md content repeated, with these
Memory from:headers (observed across consecutive fresh sessions):After adding an (empty) placeholder
C:\Users\probs\AGENTS.md, the second headchanged to the root path but still contained the full content:
The model in a fresh session still reported both blocks as containing the full
instructions, even though
C:\Users\probs\AGENTS.mdwas a zero-byte file ondisk (size = 0, sha256 =
E3B0C442, the empty-string hash).Steps to reproduce the issue
file at
~/.commandcode/AGENTS.md.$HOMEas the working directory(
$PWD=$HOME=C:\Users\probs), so the home directory is detected asthe project root (
~/.commandcode/projects/c-users-probsis created).~/.commandcode/AGENTS.mdcontent is injected more thanonce, under duplicate
Memory from:headers pointing at the same physicalfile.
Command Code Version
1.32.1
Operating System
Windows
Terminal/IDE
Unknown
Shell
cmd.exe
Session file (optional)
Not provided.
Fix prompt (optional)
Route the memory-resolution logic so it de-duplicates blocks whose resolved
source file is identical — dedupe by absolute path or content hash — and/or skip
the project tier when the project root equals
$HOME(i.e., when there is noreal project). See the memory tier table in memory.md for the resolution order.
Additional context
The same master content (sha256
aab185f8...) is synced into multiple agents'directories under
$HOMEby a personal sync script. Only Command Codedouble-loads it:
~/.claude/CLAUDE.md(Claude Code) is separate and read by its own agent; itdoes not touch
~/.commandcode/AGENTS.md.The relevant memory-resolution logic is documented in
https://commandcode.ai/docs/memory (bundled as
memory.md):What I've tried:
C:\Users\probs\AGENTS.mdso the project tierwould resolve to it (first-match) instead of re-reading
~/.commandcode/AGENTS.md. Result: the secondMemory from:header changedto
C:\Users\probs/AGENTS.mdbut still carried the full content despite beinga zero-byte file. The duplication persisted.
changes reverted; setup back to original state).
cmd config listfor a setting to disable theproject tier or de-duplicate memory when tiers share a file — no such setting
exists.
This is not fixable from the user side (short of launching from a different
directory, which breaks the home-directory workflow), because there is no
configuration to stop the project tier from loading a file it shares with the
user tier.
Please let me know if you need any further environment details or the full
session transcript excerpts.