Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ __pycache__/
.claude/
*.py[cod]
*$py.class
data/
data/*
!data/default_claude_md

.env
.env.*
Expand Down
6 changes: 6 additions & 0 deletions data/default_claude_md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# {project_name}

## Guidelines

- Before starting any large or complex task, present a plan to the user and wait for approval before proceeding. Do not begin implementation until the user confirms.
- Persist important context, decisions, and project knowledge in this CLAUDE.md file rather than relying solely on session-based memory.
3 changes: 3 additions & 0 deletions src/agent_box/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ def weixin_state_dir(self) -> Path:
agent_permission_mode: str = "bypassPermissions"
agent_max_turns: int | None = None

# Default CLAUDE.md template for new projects
default_claude_md_path: Path = Path(__file__).resolve().parent.parent.parent / "data" / "default_claude_md"



settings = Settings()
12 changes: 12 additions & 0 deletions src/agent_box/session_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def create(self, name: str, agent_type: str | None = None) -> ProjectInfo:

project_path = self.workspace / name
project_path.mkdir(parents=True, exist_ok=True)
self._init_claude_md(project_path, name)

info = ProjectInfo(
name=name,
Expand All @@ -74,6 +75,17 @@ def create(self, name: str, agent_type: str | None = None) -> ProjectInfo:
def get(self, name: str) -> ProjectInfo | None:
return self._projects.get(name)

def _init_claude_md(self, project_path: Path, name: str) -> None:
target = project_path / "CLAUDE.md"
if target.exists():
return
template_path = settings.default_claude_md_path
if not template_path.is_file():
return
content = template_path.read_text().replace("{project_name}", name)
target.write_text(content)
log.info("initialized CLAUDE.md for project %s", name)

def list_all(self) -> list[ProjectInfo]:
return list(self._projects.values())

Expand Down
Loading