Zero-cost background coding agent with layered memory, idle-time dreaming, and Ollama support.
Project description
DeepSleep-bets
DeepSleep is the open-source background agent for local models.
It gives developers a ds workflow, a compact 3-layer memory file, and idle-time "dreaming" that summarizes recent work while they are away.
It is written from scratch and safe to publish. The architecture is inspired by the broader always-on agent pattern, not copied from leaked source code or source maps.
Why it lands fast
pip install deepsleep-aids initdsds dream
That is the product.
You initialize a repo once, ask natural questions in the terminal, and let DeepSleep update session context after you stop typing.
Core promise
Zero-cost agent: runs on local Ollama models instead of paid tokensIdle-time dreaming: watches your repo and summarizes after inactivity3-layer memory:project,session, andephemeralTerminal-native: hacker-style interactive UI with file completion
Quick demo
pip install deepsleep-ai
ollama pull deepseek-r1
ds init
ds dream --once
ds
Then ask:
What was I doing?
Refactor src/deepsleep_ai/cli.py
Summarize the recent changes
The leaked-spec hook, done safely
DeepSleep explicitly implements a 3-layer memory stack:
project: long-term repo identity, goals, and factssession: what you were doing recently, which files were active, and the latest dream summaryephemeral: last turns, open questions, and the most recent file changes
All of it lives in .deepsleep/memory.json, and the compactor keeps that file under 2KB so it stays fast, deterministic, and portable.
Zero-cost local model stack
DeepSleep is built for Ollama and targets deepseek-r1 by default.
If Ollama is offline, DeepSleep still works with deterministic local fallbacks so demos do not collapse and the tool remains usable on day one.
Idle-time dreaming
Run ds dream, leave your editor open, and DeepSleep watches your project for file saves.
After 5 minutes of inactivity, it:
- collects the files you touched
- reads compact local snippets
- writes a fresh session summary into memory
- preserves only the highest-signal context under the 2KB cap
That is what makes What was I doing? feel instant the next time you open the project.
Install
PyPI
pip install deepsleep-ai
Local development
python3 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
Ollama
ollama serve
ollama pull deepseek-r1
Commands
ds init
ds
ds chat
ds dream
ds dream --idle-seconds 300
ds status
ds doctor
First-run workflow
1. Initialize a project
ds init
This creates:
.deepsleep/memory.json.deepsleep/activity.jsonl.deepsleep/prompt_history.txt
2. Validate your setup
ds doctor
It checks the memory files, Ollama reachability, and whether your chosen model is available.
3. Start the interactive UI
ds
Inside the prompt you can ask:
What was I doing?Refactor src/deepsleep_ai/cli.pySummarize the recent changes
Slash commands:
/help/status/memory/dream/quit
4. Start the dream loop
ds dream
DeepSleep watches the current project with Watchdog and writes fresh session context after idle periods.
5. One-shot demo mode
ds dream --once
This is great for screenshots, demos, and launch videos because it snapshots recently touched files even if the watcher was not already running.
Package layout
The MVP is centered on these four files:
cli.py: Typer entrypoint and Prompt Toolkit UIwatcher.py: Watchdog-based idle watcher and dream loopmemory_manager.py: layered memory store with 2KB compactionllm_client.py: Ollama connector with safe local fallback
Trust signals
- publishable
pyproject.tomlforpip install deepsleep-ai dsconsole entrypoint- MIT license
- GitHub Actions CI
- tests for memory compaction, watcher behavior, offline fallback, and chat exit flow
Self-test
pytest -q
python -m deepsleep_ai --help
Launch kit
If you want this repo to travel, keep the demo brutally simple:
ds init- edit two files
ds dream --once- show
.deepsleep/memory.json - ask
What was I doing? - run
ds doctor
That story is short, visual, and immediately understandable.
There is a practical launch playbook in LAUNCH.md and a contributor plan in CONTRIBUTING.md.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file deepsleep_ai-0.1.0.tar.gz.
File metadata
- Download URL: deepsleep_ai-0.1.0.tar.gz
- Upload date:
- Size: 18.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8bd3cb3b45624b913f2e1c0da5f36642902d69646378940daf6dac1ac37cc30b
|
|
| MD5 |
51ac0f34c852092089c85550fa23cfcf
|
|
| BLAKE2b-256 |
5b7d4d8d21c964e6e7f222ac2ac462a4a69ab1bad87ad172173883544ccb2fa1
|
Provenance
The following attestation bundles were made for deepsleep_ai-0.1.0.tar.gz:
Publisher:
publish.yml on Keshavsharma-code/DeepSleep-beta
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
deepsleep_ai-0.1.0.tar.gz -
Subject digest:
8bd3cb3b45624b913f2e1c0da5f36642902d69646378940daf6dac1ac37cc30b - Sigstore transparency entry: 1206844216
- Sigstore integration time:
-
Permalink:
Keshavsharma-code/DeepSleep-beta@4a31dd7a04266c363c951c3f4dc02cdfd4d9f6cf -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Keshavsharma-code
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@4a31dd7a04266c363c951c3f4dc02cdfd4d9f6cf -
Trigger Event:
push
-
Statement type:
File details
Details for the file deepsleep_ai-0.1.0-py3-none-any.whl.
File metadata
- Download URL: deepsleep_ai-0.1.0-py3-none-any.whl
- Upload date:
- Size: 15.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f973995eaece1bcefd1d9fdcaf4ac115ed787b39e7b4f4041a9aab88a019cdd6
|
|
| MD5 |
2532dd90a253b7e2fdc40b48567a5a5c
|
|
| BLAKE2b-256 |
bc0b4c6e1bd61c41d10e9515111452a4b753da659616dfcc1328ac3ae65dffd3
|
Provenance
The following attestation bundles were made for deepsleep_ai-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on Keshavsharma-code/DeepSleep-beta
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
deepsleep_ai-0.1.0-py3-none-any.whl -
Subject digest:
f973995eaece1bcefd1d9fdcaf4ac115ed787b39e7b4f4041a9aab88a019cdd6 - Sigstore transparency entry: 1206844224
- Sigstore integration time:
-
Permalink:
Keshavsharma-code/DeepSleep-beta@4a31dd7a04266c363c951c3f4dc02cdfd4d9f6cf -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Keshavsharma-code
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@4a31dd7a04266c363c951c3f4dc02cdfd4d9f6cf -
Trigger Event:
push
-
Statement type: