chore: migrate habitat dependencies to conda and add cocotb for hardware verification

- Move habitat-baselines and habitat-lab from pip to conda environment
- Add cocotb and cocotb-tools to pyproject.toml dependencies
- Update ty environment roots to include hw/sim directory
- Add sim/sim_build to gitignore
- Create CLAUDE.md with project spec, coding guidelines, and directory structure
- Update uv.lock to reflect dependency changes
This commit is contained in:
2026-04-29 22:19:19 +08:00
parent d9745f45dc
commit ad45123022
6 changed files with 279 additions and 1113 deletions

189
AGENTS.md
View File

@@ -1,91 +1,126 @@
# Project Spec & Rules # Memorix — Automatic Memory Rules
## 代码规范 You have access to Memorix memory tools. Follow these rules to maintain persistent context across sessions.
### Google风格代码 ## RULE 1: Session Start — Bind Project, Then Load Context
详细参阅https://raw.githubusercontent.com/shendeguize/GooglePythonStyleGuideCN/refs/heads/master/README.md
### 代码编写原则 At the **beginning of every conversation**, BEFORE responding to the user:
- 简洁,清晰易懂,最小闭环实现
- 条件或循环分支不能超过三层提前Return以减少分支的出现
- 变量说明注释、条件或循环分支注释完全
- 无需向后兼容,避免添加过多功能
- 非用户要求,不能编写测试代码
- 英文注释,中文文档
- 完成代码编写后在文档的框架不变的情况下更新文档如CLAUDE.md
### 测试编写原则 1. Call `memorix_session_start` with parameters:
- 精简、干净、快速 - `agent`: your agent identifier (e.g. "windsurf", "codex", "antigravity")
- 核心关键逻辑或算法必须测试 - `projectRoot`: the **absolute path** of the current workspace or repo root
- 需要加载transformer模型进行验证的测试与无需加载模型的测试分离 This binds the session to the correct project. Without `projectRoot`, memories may go to the wrong bucket.
2. Then call `memorix_search` with a query related to the user's first message for additional context
3. If search results are found, use `memorix_detail` to fetch the most relevant ones
4. Reference relevant memories naturally — the user should feel you "remember" them
### 文档更新说明 **Important:** `projectRoot` is a detection anchor only; Git remains the source of truth for project identity.
仅在工程目录变化时,更新此文档的目录说明部分。 In HTTP control-plane mode (`memorix serve-http` / `memorix background start`), explicit `projectRoot` binding is required for correct multi-project isolation.
如需修改其他部分,请先询问,在进行修改。 `memorix_session_start` is lightweight by default: it starts memory/session context only. Do not set `joinTeam` unless the user explicitly needs autonomous Agent Team tasks, messages, file locks, or orchestrated CLI-agent workflows.
## 工程说明 ## RULE 2: Store Important Context
使用UV管理整个工程pytest用于测试justfile用于快捷命令jujutsu用于版本管理。
本地开发环境欠缺无法验证需要调用GPU相关的测试因此请勿在本地跑验证。
请在远程开发环境中进行相关验证(相关脚本暂时为编写完毕)。
### 目录说明 **Proactively** call `memorix_store` when any of the following happen:
**核心模块** ### What MUST be recorded:
- mini-nav/main.py — CLI 入口 (Typer) - Architecture/design decisions → type: `decision`
- mini-nav/database.py — LanceDB 单例管理,用于向量存储与检索 - Bug identified and fixed → type: `problem-solution`
- mini-nav/feature_retrieval.py — DINOv2 图像特征提取与检索 - Unexpected behavior or gotcha → type: `gotcha`
- Config changed (env vars, ports, deps) → type: `what-changed`
- Feature completed or milestone → type: `what-changed`
- Trade-off discussed with conclusion → type: `trade-off`
**源代码目录 (mini-nav/)** ### What should NOT be recorded:
- mini-nav/configs/ — 配置管理 (Pydantic + YAML) - Simple file reads, greetings, trivial commands (ls, pwd, git status)
- mini-nav/commands/ — CLI 命令 (train, benchmark, visualize, generate)
- mini-nav/compressors/ — 特征压缩算法
- hash_compressor.py — 哈希压缩器与训练loss
- pipeline.py — 压缩流水线(整合 DINO 特征提取)
- train.py — 压缩器训练脚本
- mini-nav/data_loading/ — 数据加载与合成
- loader.py — 数据加载器
- insdet_scenes.py — InsDet场景数据集加载
- synthesizer.py — 场景合成器
- mini-nav/utils/ — 工具函数
- feature_extractor.py — 特征提取工具
- sam.py — SAM 2.1 分割工具
- mini-nav/tests/ — pytest 测试集
- mini-nav/benchmarks/ — 基准测试 (recall@k)
- tasks/
- multi_object_retrieval.py — 多目标检索基准任务
- mini-nav/visualizer/ — Dash + Plotly 可视化应用
**数据目录** ### Use topicKey for evolving topics:
- datasets/ — 数据集目录 For decisions, architecture docs, or any topic that evolves over time, ALWAYS use `topicKey` parameter.
- outputs/ — 默认输出目录 (数据库、模型权重等) This ensures the memory is UPDATED instead of creating duplicates.
Use `memorix_suggest_topic_key` to generate a stable key.
### Python库 Example: `topicKey: "architecture/auth-model"` — subsequent stores with the same key update the existing memory.
详细可查询pyproject.toml或使用`uv pip list`获取详细的库信息,请基于目前的库实现功能。
如需添加新库,请先询问,用户确认后才能使用`uv add <package>`新增库。
## 版本管理 ### Track progress with the progress parameter:
本项目使用 Jujutsu (jj) 进行版本控制。 When working on features or tasks, include the `progress` parameter:
```json
- 技能调用: 必须使用 jujutsu 相关工具技能来执行分支、提交、修改describe等操作禁止直接通过 Shell 执行冗长的 Git 兼容指令。 {
- 描述规范 (jj desc): "progress": {
- 执行 jj desc 时,首行必须是精简的变更标题。 "feature": "user authentication",
- 空一行后,仅记录改动的核心业务点。 "status": "in-progress",
- 语言使用英文进行描述 "completion": 60
- 禁忌: 禁止在 jj 描述中堆砌复杂的算法逻辑或长篇的设计决策。 }
}
### 描述示例
```text
refactor(compressors): Simplify module by removing SAM/DINO separation code
- Remove dino_compressor.py and segament_compressor.py
- Rewrite pipeline.py to inline DINO into HashPipeline
- Maintain backward compatibility: SAMHashPipeline alias
- Update tests and benchmark.py
``` ```
Status values: `in-progress`, `completed`, `blocked`
### 提交步骤 ## RULE 3: Resolve Completed Memories
- 执行`jj diff --no-pager`获取当前所有更改
- 根据更改内容与openspec生成的相关文档进行总结重点在于更改内容及其决策逻辑 When a task is completed, a bug is fixed, or information becomes outdated:
- 调用记忆功能如Memorix记忆先前总结的内容
- 遵循描述规范使用jj进行更改的描述 1. Call `memorix_resolve` with the observation IDs to mark them as resolved
- 执行`jj new`开启一个新的更改 2. Resolved memories are hidden from default search, preventing context pollution
This is critical — without resolving, old bug reports and completed tasks will keep appearing in future searches.
## RULE 4: Session End — Store Decision Chain Summary
When the conversation is ending, create a **decision chain summary** (not just a checklist):
1. Call `memorix_store` with type `session-request` and `topicKey: "session/latest-summary"`:
**Required structure:**
```
## Goal
[What we were working on — specific, not vague]
## Key Decisions & Reasoning
- Chose X because Y. Rejected Z because [reason].
- [Every architectural/design decision with WHY]
## What Changed
- [File path] — [what changed and why]
## Current State
- [What works now, what's pending]
- [Any blockers or risks]
## Next Steps
- [Concrete next actions, in priority order]
```
**Critical: Include the "Key Decisions & Reasoning" section.** Without it, the next AI session will lack the context to understand WHY things were done a certain way and may suggest conflicting approaches.
2. Call `memorix_resolve` on any memories for tasks completed in this session
## RULE 5: Compact Awareness
Memorix automatically compacts memories on store:
- **With LLM API configured:** Smart dedup — extracts facts, compares with existing, merges or skips duplicates
- **Without LLM (free mode):** Heuristic dedup — uses similarity scores to detect and merge duplicate memories
- **You don't need to manually deduplicate.** Just store naturally and compact handles the rest.
- If you notice excessive duplicate memories, call `memorix_deduplicate` for batch cleanup.
## Guidelines
- **Use concise titles** (~5-10 words) and structured facts
- **Include file paths** in filesModified when relevant
- **Include related concepts** for better searchability
- **Always use topicKey** for recurring topics to prevent duplicates
- **Always resolve** completed tasks and fixed bugs
- **Always include reasoning** — "chose X because Y" is 10x more valuable than "did X"
- Search defaults to `status="active"` — use `status="all"` to include resolved memories
## Beyond These Rules
This file contains the **minimum operating rules** for Memorix memory tools. It is NOT the complete truth about runtime behavior, support tiers, or team semantics.
For authoritative, up-to-date details on:
- **Support tiers** (core / extended / community) and what "installed" vs "runtime-ready" means
- **HTTP control-plane binding** and `projectRoot` isolation rules
- **Opt-in team semantics** (`joinTeam`, `team_manage join`, roles, task claim, handoff validation)
- **Install vs runtime-ready distinction** — hook config written ≠ agent will execute it
- **Agent-specific caveats** (Copilot project-level only, OpenCode plugin lifecycle, etc.)
→ **Read `docs/AGENT_OPERATOR_PLAYBOOK.md`** in the Memorix source or npm package.
If this file and the playbook conflict, the playbook is authoritative.

91
CLAUDE.md Normal file
View File

@@ -0,0 +1,91 @@
# Project Spec & Rules
## 代码规范
### Google风格代码
详细参阅https://raw.githubusercontent.com/shendeguize/GooglePythonStyleGuideCN/refs/heads/master/README.md
### 代码编写原则
- 简洁,清晰易懂,最小闭环实现
- 条件或循环分支不能超过三层提前Return以减少分支的出现
- 变量说明注释、条件或循环分支注释完全
- 无需向后兼容,避免添加过多功能
- 非用户要求,不能编写测试代码
- 英文注释,中文文档
- 完成代码编写后在文档的框架不变的情况下更新文档如CLAUDE.md
### 测试编写原则
- 精简、干净、快速
- 核心关键逻辑或算法必须测试
- 需要加载transformer模型进行验证的测试与无需加载模型的测试分离
### 文档更新说明
仅在工程目录变化时,更新此文档的目录说明部分。
如需修改其他部分,请先询问,在进行修改。
## 工程说明
使用UV管理整个工程pytest用于测试justfile用于快捷命令jujutsu用于版本管理。
本地开发环境欠缺无法验证需要调用GPU相关的测试因此请勿在本地跑验证。
请在远程开发环境中进行相关验证(相关脚本暂时为编写完毕)。
### 目录说明
**核心模块**
- mini-nav/main.py — CLI 入口 (Typer)
- mini-nav/database.py — LanceDB 单例管理,用于向量存储与检索
- mini-nav/feature_retrieval.py — DINOv2 图像特征提取与检索
**源代码目录 (mini-nav/)**
- mini-nav/configs/ — 配置管理 (Pydantic + YAML)
- mini-nav/commands/ — CLI 命令 (train, benchmark, visualize, generate)
- mini-nav/compressors/ — 特征压缩算法
- hash_compressor.py — 哈希压缩器与训练loss
- pipeline.py — 压缩流水线(整合 DINO 特征提取)
- train.py — 压缩器训练脚本
- mini-nav/data_loading/ — 数据加载与合成
- loader.py — 数据加载器
- insdet_scenes.py — InsDet场景数据集加载
- synthesizer.py — 场景合成器
- mini-nav/utils/ — 工具函数
- feature_extractor.py — 特征提取工具
- sam.py — SAM 2.1 分割工具
- mini-nav/tests/ — pytest 测试集
- mini-nav/benchmarks/ — 基准测试 (recall@k)
- tasks/
- multi_object_retrieval.py — 多目标检索基准任务
- mini-nav/visualizer/ — Dash + Plotly 可视化应用
**数据目录**
- datasets/ — 数据集目录
- outputs/ — 默认输出目录 (数据库、模型权重等)
### Python库
详细可查询pyproject.toml或使用`uv pip list`获取详细的库信息,请基于目前的库实现功能。
如需添加新库,请先询问,用户确认后才能使用`uv add <package>`新增库。
## 版本管理
本项目使用 Jujutsu (jj) 进行版本控制。
- 技能调用: 必须使用 jujutsu 相关工具技能来执行分支、提交、修改describe等操作禁止直接通过 Shell 执行冗长的 Git 兼容指令。
- 描述规范 (jj desc):
- 执行 jj desc 时,首行必须是精简的变更标题。
- 空一行后,仅记录改动的核心业务点。
- 语言使用英文进行描述
- 禁忌: 禁止在 jj 描述中堆砌复杂的算法逻辑或长篇的设计决策。
### 描述示例
```text
refactor(compressors): Simplify module by removing SAM/DINO separation code
- Remove dino_compressor.py and segament_compressor.py
- Rewrite pipeline.py to inline DINO into HashPipeline
- Maintain backward compatibility: SAMHashPipeline alias
- Update tests and benchmark.py
```
### 提交步骤
- 执行`jj diff --no-pager`获取当前所有更改
- 根据更改内容与openspec生成的相关文档进行总结重点在于更改内容及其决策逻辑
- 调用记忆功能如Memorix记忆先前总结的内容
- 遵循描述规范使用jj进行更改的描述
- 执行`jj new`开启一个新的更改

View File

@@ -1,18 +1,20 @@
name: mini-nav name: mini-nav
channels: channels:
- pytorch - pytorch
- nvidia - nvidia
- aihabitat-nightly - aihabitat-nightly
- conda-forge - conda-forge
dependencies: dependencies:
- python=3.10 - python=3.10
- pip - pip
- habitat-sim=0.3.3 - habitat-sim=0.3.3
- withbullet - habitat-baselines=0.3.320250127
- pytorch - habitat-lab=0.3.320250127
- torchvision - withbullet
- pytorch-cuda=12.1 - pytorch
# Toolsets - torchvision
- uv - pytorch-cuda=12.1
- just # Toolsets
- nodejs>=20.0.0 - uv
- just
- nodejs>=20.0.0

1
hw/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
sim/sim_build

View File

@@ -10,8 +10,6 @@ dependencies = [
"dash-ag-grid>=33.3.3", "dash-ag-grid>=33.3.3",
"dash-mantine-components>=2.5.1", "dash-mantine-components>=2.5.1",
"datasets>=4.5.0", "datasets>=4.5.0",
"habitat-baselines>=0.3.320250127",
"habitat-lab>=0.3.320250127",
"httpx[socks]>=0.28.1", "httpx[socks]>=0.28.1",
"lancedb>=0.30.1", "lancedb>=0.30.1",
"marimo[mcp]>=0.22.0", "marimo[mcp]>=0.22.0",
@@ -29,17 +27,19 @@ dependencies = [
dev = [ dev = [
"basedpyright>=1.37.4", "basedpyright>=1.37.4",
"pip>=26.0.1", "pip>=26.0.1",
"cocotb>=2.0.1",
"pytest>=9.0.2", "pytest>=9.0.2",
"pytest-mpi>=0.6", "pytest-mpi>=0.6",
"python-lsp-server>=1.14.0", "python-lsp-server>=1.14.0",
"ruff>=0.15.7", "ruff>=0.15.7",
"ty>=0.0.24", "ty>=0.0.24",
"websockets>=16.0", "websockets>=16.0",
"cocotb-tools>=0.1.0",
] ]
[tool.ty.environment] [tool.ty.environment]
python = "$UV_PROJECT_ENVIRONMENT" python = "$UV_PROJECT_ENVIRONMENT"
root = ["./mini-nav", "./notebooks"] root = ["./mini-nav", "./notebooks", "./hw/sim"]
[tool.basedpyright] [tool.basedpyright]
include = ["mini-nav", "notebooks"] include = ["mini-nav", "notebooks"]

1073
uv.lock generated

File diff suppressed because it is too large Load Diff