Skip to content

Commit d0bd54e

Browse files
committed
Add DheeFS virtual context shell
1 parent 83a6c6e commit d0bd54e

19 files changed

Lines changed: 1782 additions & 65 deletions

.github/workflows/test.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
14-
python-version: ["3.9", "3.11", "3.12"]
14+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
1515

1616
steps:
1717
- uses: actions/checkout@v4
@@ -21,8 +21,13 @@ jobs:
2121
with:
2222
python-version: ${{ matrix.python-version }}
2323

24+
- name: Set up Rust
25+
uses: dtolnay/rust-toolchain@stable
26+
2427
- name: Install dependencies
25-
run: pip install -e ".[dev]"
28+
run: |
29+
pip install -e ./dhee-accel
30+
pip install -e ".[dev]"
2631
2732
- name: Run tests
2833
run: pytest tests/ -v

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,8 @@ runs/
164164
data/
165165

166166
# Internal scripts & docs
167-
scripts/
167+
scripts/*
168+
!scripts/verify_full_suite.sh
168169
deep-research-report.md
169170
launch-article.md
170171
pitch-deck.md

README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
<p align="center">
2929
<a href="#what-is-dhee">What is Dhee</a> ·
3030
<a href="#shared-agent-learning">Shared Agent Learning</a> ·
31+
<a href="#dheefs">DheeFS</a> ·
3132
<a href="#quick-start">Quick Start</a> ·
3233
<a href="#repo-shared-context">Repo-Shared Context</a> ·
3334
<a href="#benchmarks">Benchmarks</a> ·
@@ -99,6 +100,41 @@ This is the product contract: **with Dhee, a learning proven in one agent can be
99100

100101
---
101102

103+
## <span id="dheefs">DheeFS — one local learning space every agent already understands</span>
104+
105+
Agents already understand files and shell verbs. DheeFS exposes Dhee's memory, router, handoff, artifacts, shared tasks, and learning exchange as one virtual context space:
106+
107+
```bash
108+
dhee shell "ls /learnings"
109+
dhee shell "cat /handoff/latest.md"
110+
dhee shell "grep parser /learnings/promoted"
111+
dhee shell "cat /router/ptr/R-abc123"
112+
```
113+
114+
The first version is a virtual shell, not FUSE. It intentionally supports a small approved command set: `ls`, `cat`, `grep`, `why`, `promote`, `reject`, `broadcast`, `provision`, and `snapshot`. The same surface is available through MCP as `dhee_shell(command)` and through Python:
115+
116+
```python
117+
from dhee import ContextWorkspace
118+
119+
result = ContextWorkspace(repo=".").execute("provision 'fix parser bug'")
120+
print(result.stdout)
121+
```
122+
123+
External systems such as Slack, Gmail, and Notion are future **context sources** under `/sources`, not generic remote action backends. They can sync and search evidence into Dhee artifacts, learnings, and handoffs without making the core install depend on SaaS SDKs.
124+
125+
```text
126+
/learnings candidates, promoted, rejected, archived
127+
/handoff latest repo/session continuity
128+
/router/ptr raw pointer lookup when explicitly requested
129+
/artifacts host-parsed files and chunks
130+
/repo .dhee/context decisions and conventions
131+
/agents Hermes, Claude Code, Codex views
132+
/shared inbox, broadcasts, shared task results
133+
/sources optional future Slack/Gmail/Notion context mounts
134+
```
135+
136+
---
137+
102138
## Quick Start
103139

104140
**One command. No venv. No config. No pasting into `settings.json`.**
@@ -404,6 +440,13 @@ source .venv-dhee/bin/activate
404440
pytest
405441
```
406442

443+
For the same full-suite path CI expects, including the local Rust acceleration
444+
extension and async test plugin:
445+
446+
```bash
447+
./scripts/verify_full_suite.sh
448+
```
449+
407450
---
408451

409452
<p align="center">

dhee-accel/Cargo.lock

Lines changed: 12 additions & 59 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dhee-accel/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ name = "dhee_accel"
1010
crate-type = ["cdylib"]
1111

1212
[dependencies]
13-
pyo3 = { version = "0.22", features = ["extension-module"] }
13+
pyo3 = { version = "0.28.3", features = ["extension-module"] }
1414
rayon = "1.10"

dhee/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
from dhee.memory.main import FullMemory
2626
from dhee.simple import Dhee, Engram
2727
from dhee.plugin import DheePlugin
28+
from dhee.fs import ContextWorkspace
2829
from dhee.core.category import CategoryProcessor, Category, CategoryType, CategoryMatch
2930
from dhee.core.echo import EchoProcessor, EchoDepth, EchoResult
3031
from dhee.configs.base import MemoryConfig, FadeMemConfig, EchoMemConfig, CategoryMemConfig, ScopeConfig
@@ -44,6 +45,8 @@
4445
"Dhee",
4546
# Universal plugin
4647
"DheePlugin",
48+
# DheeFS
49+
"ContextWorkspace",
4750
# CategoryMem
4851
"CategoryProcessor",
4952
"Category",

dhee/cli.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,38 @@ def cmd_setup(args: argparse.Namespace) -> None:
8484
run_setup()
8585

8686

87+
def cmd_shell(args: argparse.Namespace) -> None:
88+
"""Run a DheeFS virtual shell command."""
89+
from dhee.fs import ContextWorkspace
90+
91+
command = " ".join(getattr(args, "shell_command", []) or []).strip()
92+
if not command:
93+
print("Error: shell command is required", file=sys.stderr)
94+
sys.exit(2)
95+
96+
repo = getattr(args, "repo", None)
97+
if repo is None:
98+
repo = os.getcwd()
99+
workspace = ContextWorkspace(
100+
repo=repo,
101+
user_id=getattr(args, "user_id", "default"),
102+
agent_id=getattr(args, "agent_id", None) or "cli",
103+
db=_get_db(),
104+
workspace_id=getattr(args, "workspace_id", None) or os.path.abspath(os.path.expanduser(repo)),
105+
)
106+
result = workspace.execute(command)
107+
if getattr(args, "json", False):
108+
_json_out(result.to_dict())
109+
else:
110+
stream = sys.stderr if result.exit_code else sys.stdout
111+
if result.stdout:
112+
print(result.stdout, file=stream)
113+
elif result.stderr:
114+
print(result.stderr, file=sys.stderr)
115+
if result.exit_code:
116+
sys.exit(result.exit_code)
117+
118+
87119
# ---------------------------------------------------------------------------
88120
# repo-link commands — personal vs repo context
89121
# ---------------------------------------------------------------------------
@@ -2073,6 +2105,18 @@ def build_parser() -> argparse.ArgumentParser:
20732105
# setup
20742106
sub.add_parser("setup", help="Interactive setup wizard")
20752107

2108+
# shell — DheeFS virtual learning/context space
2109+
p_shell = sub.add_parser(
2110+
"shell",
2111+
help="Run a DheeFS virtual shell command, e.g. `dhee shell \"ls /learnings\"`",
2112+
)
2113+
p_shell.add_argument("shell_command", nargs=argparse.REMAINDER, help="Command to run in DheeFS")
2114+
p_shell.add_argument("--repo", help="Repository/workspace root (default: cwd)")
2115+
p_shell.add_argument("--workspace-id", help="Explicit workspace id override")
2116+
p_shell.add_argument("--user-id", default="default", help="User ID")
2117+
p_shell.add_argument("--agent-id", default="cli", help="Agent ID for mutating commands")
2118+
p_shell.add_argument("--json", action="store_true", help="JSON output")
2119+
20762120
# remember / add (aliases)
20772121
p_remember = sub.add_parser("remember", help="Store a fact or preference")
20782122
p_remember.add_argument("text", help="Memory content")
@@ -2625,6 +2669,7 @@ def build_parser() -> argparse.ArgumentParser:
26252669

26262670
COMMAND_MAP = {
26272671
"setup": cmd_setup,
2672+
"shell": cmd_shell,
26282673
"remember": cmd_add, # alias
26292674
"add": cmd_add,
26302675
"recall": cmd_search, # alias

dhee/fs/__init__.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
"""DheeFS virtual learning/context shell."""
2+
3+
from dhee.fs.types import DheeFSEntry, DheeFSError, DheeFSResult, DheeMount
4+
from dhee.fs.workspace import CommandRegistry, ContextWorkspace
5+
6+
__all__ = [
7+
"CommandRegistry",
8+
"ContextWorkspace",
9+
"DheeFSEntry",
10+
"DheeFSError",
11+
"DheeFSResult",
12+
"DheeMount",
13+
]

0 commit comments

Comments
 (0)