docs: update project scoping to use git remote for cross-machine consistency
This commit is contained in:
parent
2a87dfafcf
commit
bae42fb141
3 changed files with 19 additions and 4 deletions
|
|
@ -137,6 +137,8 @@ The template includes a working agent integration and docker-compose setup. See
|
||||||
- Stores decisions, configurations, learnings
|
- Stores decisions, configurations, learnings
|
||||||
- Retrieved via `/memory?project=...`
|
- Retrieved via `/memory?project=...`
|
||||||
|
|
||||||
|
**Project scoping**: Use a stable identifier for the `project` parameter (e.g., git remote URL like `https://github.com/username/repo`). This ensures your project's conventions and memories follow you across machines, even if file paths differ. The template agent auto-detects the git remote.
|
||||||
|
|
||||||
## MCP Server Integration
|
## MCP Server Integration
|
||||||
|
|
||||||
If you use Claude Desktop, add to your config:
|
If you use Claude Desktop, add to your config:
|
||||||
|
|
|
||||||
6
SETUP.md
6
SETUP.md
|
|
@ -191,9 +191,13 @@ Edit `.env` if needed:
|
||||||
```env
|
```env
|
||||||
API_URL=http://helm:8675
|
API_URL=http://helm:8675
|
||||||
API_KEY= # Only if auth enabled
|
API_KEY= # Only if auth enabled
|
||||||
PROJECT=/path/to/your/project # Optional, for context scoping
|
# PROJECT= # Optional. If not set, agent auto-detects git remote origin (recommended)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**Project scoping**: The `PROJECT` variable determines how conventions and memories are scoped. We recommend using the git remote origin URL (e.g., `https://github.com/username/repo.git`) as a stable identifier that follows you across machines, even if file paths differ. If `PROJECT` is not set, the agent automatically detects the git remote origin (if the working directory is a git repository). This ensures your project's knowledge base is consistent regardless of where you clone the repo.
|
||||||
|
|
||||||
|
For non-git directories, set `PROJECT` to any unique string that identifies the project across machines.
|
||||||
|
|
||||||
#### 3. Run Your Agent
|
#### 3. Run Your Agent
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|
|
||||||
15
USAGE.md
15
USAGE.md
|
|
@ -251,11 +251,20 @@ decisions = resp.json()["entries"]
|
||||||
|
|
||||||
### Starting a New Session
|
### Starting a New Session
|
||||||
|
|
||||||
1. **Define your project identifier** - a path or unique string:
|
1. **Define your project identifier** - we recommend using git remote origin for consistency across machines:
|
||||||
```python
|
```python
|
||||||
PROJECT = "/home/user/myapp" # or "my-discord-bot", "workspace-123"
|
# Option A: Auto-detect (recommended) - agent template does this automatically
|
||||||
|
project = get_project_identifier() # returns git remote origin if available, else env var, else dir name
|
||||||
|
|
||||||
|
# Option B: Explicit project identifier (stable across machines)
|
||||||
|
PROJECT = "git@github.com:username/repo.git" # or "https://github.com/username/repo"
|
||||||
|
|
||||||
|
# Option C: Use environment variable
|
||||||
|
# export PROJECT="git@github.com:username/repo.git"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**Why git remote?** If you work on the same repository from multiple machines (different file paths), using the git remote as the project identifier ensures your conventions and memories follow you. The same repo gets the same context regardless of where you clone it.
|
||||||
|
|
||||||
2. **Load past memories** (optional but helpful):
|
2. **Load past memories** (optional but helpful):
|
||||||
```python
|
```python
|
||||||
memories = httpx.get("http://helm:8675/memory", params={"project": PROJECT}).json()["entries"]
|
memories = httpx.get("http://helm:8675/memory", params={"project": PROJECT}).json()["entries"]
|
||||||
|
|
@ -284,7 +293,7 @@ If your agent works across multiple projects:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
# Switch project context mid-conversation
|
# Switch project context mid-conversation
|
||||||
PROJECT = "/home/user/project1" # current active project
|
PROJECT = "git@github.com:company/project-a.git" # stable identifier
|
||||||
|
|
||||||
# Each project has its own conventions and memories
|
# Each project has its own conventions and memories
|
||||||
context = await get_context(query, project=PROJECT)
|
context = await get_context(query, project=PROJECT)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue