agentdream 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. agentdream-0.1.0/.gitignore +16 -0
  2. agentdream-0.1.0/CODE_OF_CONDUCT.md +129 -0
  3. agentdream-0.1.0/CONTRIBUTING.md +90 -0
  4. agentdream-0.1.0/LICENSE +21 -0
  5. agentdream-0.1.0/PKG-INFO +494 -0
  6. agentdream-0.1.0/README.md +461 -0
  7. agentdream-0.1.0/SECURITY.md +28 -0
  8. agentdream-0.1.0/SPEC.md +84 -0
  9. agentdream-0.1.0/docs/ARCHITECTURE.md +660 -0
  10. agentdream-0.1.0/docs/BACKENDS.md +132 -0
  11. agentdream-0.1.0/docs/CLAUDE_CODE.md +154 -0
  12. agentdream-0.1.0/docs/CONFIG.md +114 -0
  13. agentdream-0.1.0/docs/EDGE_CASES.md +264 -0
  14. agentdream-0.1.0/docs/TESTING.md +351 -0
  15. agentdream-0.1.0/docs/architecture.mmd +50 -0
  16. agentdream-0.1.0/docs/architecture.png +0 -0
  17. agentdream-0.1.0/docs/architecture.svg +1 -0
  18. agentdream-0.1.0/docs/demo.gif +0 -0
  19. agentdream-0.1.0/docs/social-preview.png +0 -0
  20. agentdream-0.1.0/examples/integrations/claude-code.md +19 -0
  21. agentdream-0.1.0/examples/integrations/cursor-mcp.json +11 -0
  22. agentdream-0.1.0/examples/memory/MEMORY.md +17 -0
  23. agentdream-0.1.0/examples/memory/notes/project.md +4 -0
  24. agentdream-0.1.0/examples/run_example.py +26 -0
  25. agentdream-0.1.0/examples/sessions/session-01.jsonl +6 -0
  26. agentdream-0.1.0/examples/sessions/session-02.jsonl +5 -0
  27. agentdream-0.1.0/examples/sessions/session-03.jsonl +4 -0
  28. agentdream-0.1.0/examples/sessions/session-04-claude-code.jsonl +5 -0
  29. agentdream-0.1.0/examples/sessions/session-05-openai.json +7 -0
  30. agentdream-0.1.0/pyproject.toml +114 -0
  31. agentdream-0.1.0/scripts/edge_case_table.py +156 -0
  32. agentdream-0.1.0/scripts/edge_cases_intro.md +44 -0
  33. agentdream-0.1.0/src/agentdream/__init__.py +60 -0
  34. agentdream-0.1.0/src/agentdream/__main__.py +5 -0
  35. agentdream-0.1.0/src/agentdream/_toml.py +286 -0
  36. agentdream-0.1.0/src/agentdream/adapters/__init__.py +122 -0
  37. agentdream-0.1.0/src/agentdream/adapters/base.py +63 -0
  38. agentdream-0.1.0/src/agentdream/adapters/jsonstore.py +219 -0
  39. agentdream-0.1.0/src/agentdream/adapters/markdown.py +476 -0
  40. agentdream-0.1.0/src/agentdream/adapters/sqlite.py +146 -0
  41. agentdream-0.1.0/src/agentdream/adapters/stancelog.py +191 -0
  42. agentdream-0.1.0/src/agentdream/api.py +73 -0
  43. agentdream-0.1.0/src/agentdream/backends/__init__.py +77 -0
  44. agentdream-0.1.0/src/agentdream/backends/base.py +97 -0
  45. agentdream-0.1.0/src/agentdream/backends/builtin.py +124 -0
  46. agentdream-0.1.0/src/agentdream/blocking.py +128 -0
  47. agentdream-0.1.0/src/agentdream/chunking.py +231 -0
  48. agentdream-0.1.0/src/agentdream/claude_hook.py +594 -0
  49. agentdream-0.1.0/src/agentdream/cli.py +444 -0
  50. agentdream-0.1.0/src/agentdream/config.py +361 -0
  51. agentdream-0.1.0/src/agentdream/context.py +212 -0
  52. agentdream-0.1.0/src/agentdream/engine/__init__.py +47 -0
  53. agentdream-0.1.0/src/agentdream/engine/deterministic.py +1012 -0
  54. agentdream-0.1.0/src/agentdream/engine/llm.py +907 -0
  55. agentdream-0.1.0/src/agentdream/jobs.py +386 -0
  56. agentdream-0.1.0/src/agentdream/loaders.py +420 -0
  57. agentdream-0.1.0/src/agentdream/mcp_server.py +194 -0
  58. agentdream-0.1.0/src/agentdream/models.py +219 -0
  59. agentdream-0.1.0/src/agentdream/pipeline.py +380 -0
  60. agentdream-0.1.0/src/agentdream/redact.py +372 -0
  61. agentdream-0.1.0/src/agentdream/report.py +194 -0
  62. agentdream-0.1.0/src/agentdream/review.py +319 -0
  63. agentdream-0.1.0/src/agentdream/scheduler.py +164 -0
  64. agentdream-0.1.0/src/agentdream/text.py +486 -0
  65. agentdream-0.1.0/src/agentdream/util.py +167 -0
  66. agentdream-0.1.0/tests/conftest.py +69 -0
  67. agentdream-0.1.0/tests/edge/edgekit.py +151 -0
  68. agentdream-0.1.0/tests/edge/test_concurrency.py +110 -0
  69. agentdream-0.1.0/tests/edge/test_contradictions.py +125 -0
  70. agentdream-0.1.0/tests/edge/test_crash_recovery.py +264 -0
  71. agentdream-0.1.0/tests/edge/test_empty_inputs.py +195 -0
  72. agentdream-0.1.0/tests/edge/test_limits.py +168 -0
  73. agentdream-0.1.0/tests/edge/test_line_endings.py +134 -0
  74. agentdream-0.1.0/tests/edge/test_llm_ids.py +179 -0
  75. agentdream-0.1.0/tests/edge/test_malformed.py +177 -0
  76. agentdream-0.1.0/tests/edge/test_model_misbehavior.py +322 -0
  77. agentdream-0.1.0/tests/edge/test_path_traversal.py +158 -0
  78. agentdream-0.1.0/tests/edge/test_permissions.py +157 -0
  79. agentdream-0.1.0/tests/edge/test_properties.py +243 -0
  80. agentdream-0.1.0/tests/edge/test_review_edges.py +180 -0
  81. agentdream-0.1.0/tests/edge/test_scheduler_edges.py +190 -0
  82. agentdream-0.1.0/tests/edge/test_secrets.py +213 -0
  83. agentdream-0.1.0/tests/edge/test_timestamps.py +147 -0
  84. agentdream-0.1.0/tests/edge/test_unicode.py +163 -0
  85. agentdream-0.1.0/tests/live/test_live_backends.py +205 -0
  86. agentdream-0.1.0/tests/synth.py +74 -0
  87. agentdream-0.1.0/tests/test_adapters.py +220 -0
  88. agentdream-0.1.0/tests/test_backends.py +233 -0
  89. agentdream-0.1.0/tests/test_chunking.py +375 -0
  90. agentdream-0.1.0/tests/test_claude_hook.py +429 -0
  91. agentdream-0.1.0/tests/test_cli_mcp.py +138 -0
  92. agentdream-0.1.0/tests/test_config.py +280 -0
  93. agentdream-0.1.0/tests/test_consolidate.py +142 -0
  94. agentdream-0.1.0/tests/test_docs.py +217 -0
  95. agentdream-0.1.0/tests/test_engine_cases.py +233 -0
  96. agentdream-0.1.0/tests/test_infra_edges.py +345 -0
  97. agentdream-0.1.0/tests/test_insights.py +86 -0
  98. agentdream-0.1.0/tests/test_io_edges.py +253 -0
  99. agentdream-0.1.0/tests/test_jobs_review.py +232 -0
  100. agentdream-0.1.0/tests/test_live.py +31 -0
  101. agentdream-0.1.0/tests/test_loaders.py +117 -0
  102. agentdream-0.1.0/tests/test_pokemon.py +109 -0
  103. agentdream-0.1.0/tests/test_portability.py +61 -0
  104. agentdream-0.1.0/tests/test_redact.py +273 -0
  105. agentdream-0.1.0/tests/test_safety.py +151 -0
  106. agentdream-0.1.0/tests/test_scheduler.py +114 -0
  107. agentdream-0.1.0/tests/test_stancelog_adapter.py +186 -0
@@ -0,0 +1,16 @@
1
+ __pycache__/
2
+ *.pyc
3
+ .venv/
4
+ *.egg-info/
5
+ .pytest_cache/
6
+ .agentdream/
7
+ dist/
8
+ build/
9
+ .scratch/
10
+ .coverage
11
+ .coverage.*
12
+ coverage.xml
13
+ htmlcov/
14
+ .mypy_cache/
15
+ .ruff_cache/
16
+ .hypothesis/
@@ -0,0 +1,129 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, caste, color, religion, or sexual
10
+ identity and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the overall
26
+ community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or advances of
31
+ any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
33
+ * Public or private harassment
34
+ * Publishing others' private information, such as a physical or email address,
35
+ without their explicit permission
36
+ * Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official e-mail address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement by opening a
63
+ private report through GitHub (a [private vulnerability report](https://github.com/mvplab-ai/agentdream/security/advisories/new)
64
+ is appropriate if the report itself should stay confidential; otherwise contact
65
+ the maintainers via the `mvplab-ai` GitHub organization).
66
+
67
+ All complaints will be reviewed and investigated promptly and fairly.
68
+
69
+ All community leaders are obligated to respect the privacy and security of the
70
+ reporter of any incident.
71
+
72
+ ## Enforcement Guidelines
73
+
74
+ Community leaders will follow these Community Impact Guidelines in determining
75
+ the consequences for any action they deem in violation of this Code of Conduct:
76
+
77
+ ### 1. Correction
78
+
79
+ **Community Impact**: Use of inappropriate language or other behavior deemed
80
+ unprofessional or unwelcome in the community.
81
+
82
+ **Consequence**: A private, written warning from community leaders, providing
83
+ clarity around the nature of the violation and an explanation of why the
84
+ behavior was inappropriate. A public apology may be requested.
85
+
86
+ ### 2. Warning
87
+
88
+ **Community Impact**: A violation through a single incident or series of
89
+ actions.
90
+
91
+ **Consequence**: A warning with consequences for continued behavior. No
92
+ interaction with the people involved, including unsolicited interaction with
93
+ those enforcing the Code of Conduct, for a specified period of time. This
94
+ includes avoiding interactions in community spaces as well as external channels
95
+ like social media. Violating these terms may lead to a temporary or permanent
96
+ ban.
97
+
98
+ ### 3. Temporary Ban
99
+
100
+ **Community Impact**: A serious violation of community standards, including
101
+ sustained inappropriate behavior.
102
+
103
+ **Consequence**: A temporary ban from any sort of interaction or public
104
+ communication with the community for a specified period of time. No public or
105
+ private interaction with the people involved, including unsolicited interaction
106
+ with those enforcing the Code of Conduct, is allowed during this period.
107
+ Violating these terms may lead to a permanent ban.
108
+
109
+ ### 4. Permanent Ban
110
+
111
+ **Community Impact**: Demonstrating a pattern of violation of community
112
+ standards, including sustained inappropriate behavior, harassment of an
113
+ individual, or aggression toward or disparagement of classes of individuals.
114
+
115
+ **Consequence**: A permanent ban from any sort of public interaction within the
116
+ community.
117
+
118
+ ## Attribution
119
+
120
+ This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org),
121
+ version 2.1, available at
122
+ https://www.contributor-covenant.org/version/2/1/code_of_conduct.html.
123
+
124
+ Community Impact Guidelines were inspired by
125
+ [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
126
+
127
+ For answers to common questions about this code of conduct, see the FAQ at
128
+ https://www.contributor-covenant.org/faq. Translations are available at
129
+ https://www.contributor-covenant.org/translations.
@@ -0,0 +1,90 @@
1
+ # Contributing to agentdream
2
+
3
+ Thanks for helping! agentdream aims to stay small, dependable and dependency-free.
4
+
5
+ Please follow the [Code of Conduct](CODE_OF_CONDUCT.md). Security reports belong in
6
+ [SECURITY.md](SECURITY.md), not in a public issue.
7
+
8
+ ## Ground rules
9
+
10
+ - **The core stays stdlib-only.** No required runtime dependencies. HTTP goes through `urllib`, MCP is
11
+ hand-rolled JSON-RPC. Optional integrations must import lazily and degrade gracefully.
12
+ - **Never mutate input.** Every adapter writes a *new* store. If you add an adapter, add it to the
13
+ parametrized hash-before/after test in `tests/test_safety.py`.
14
+ - **Heuristics must be general.** Deterministic rules should be phrased in terms of language patterns
15
+ (polarity, value slots, confirmation/failure cues), never in terms of specific test strings. New rules
16
+ need a test with *different* wording than the motivating example (see `test_correction_is_general_not_hardcoded`).
17
+ - **Every change must be explainable.** Operations carry a reason, and corrections and insights carry
18
+ transcript evidence (`file:line` + quote).
19
+
20
+ ## Setup
21
+
22
+ ```bash
23
+ python -m venv .venv
24
+ .venv/bin/pip install -e ".[dev]" # pytest, pytest-cov, hypothesis, ruff, mypy
25
+ .venv/bin/pip install "git+https://github.com/systemagents-ai/stancelog" # optional: run the stancelog adapter tests too
26
+ .venv/bin/python -m pytest -q # ~25 s
27
+ .venv/bin/python -m pytest -q -m edge # only the edge-case suite (tests/edge)
28
+ .venv/bin/python scripts/edge_case_table.py --write docs/EDGE_CASES.md # refresh EDGE_CASES.md + the table in docs/TESTING.md
29
+ .venv/bin/python -m pytest -q --cov=agentdream --cov-report=term-missing # CI enforces fail_under
30
+ .venv/bin/ruff check src tests examples
31
+ .venv/bin/mypy # config in pyproject.toml
32
+ ```
33
+
34
+ Docs are tested too: `tests/test_docs.py` runs every Python block marked `<!-- test: run -->` in the
35
+ README and `docs/`, parses every `agentdream ...` command line against the real CLI, and lints the Mermaid
36
+ diagrams. Regenerate the README's before/after sample with `python examples/run_example.py` if you change
37
+ the heuristics.
38
+
39
+ Edge cases go in `tests/edge/test_<area>.py` (one file per area) with a one-line docstring per test; the
40
+ first docstring line becomes the case text in [docs/EDGE_CASES.md](docs/EDGE_CASES.md) and
41
+ [docs/TESTING.md](docs/TESTING.md). Fix the code to make a case pass, never the assertion.
42
+
43
+ Live tests (`tests/test_live.py` and `tests/live/`) run only when you opt in:
44
+ `AGENTDREAM_LIVE=1` (logged-in `claude` CLI), `AGENTDREAM_OLLAMA_MODEL=...`, and/or `ANTHROPIC_API_KEY`.
45
+ They are never part of CI. What has actually been run live vs mocked is recorded in
46
+ [docs/TESTING.md](docs/TESTING.md).
47
+
48
+ ## Layout
49
+
50
+ See the module map in [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md#module-map). In short:
51
+
52
+ ```
53
+ src/agentdream/
54
+ models.py MemoryEntry, Message, Transcript, Evidence, Operation, apply_operations
55
+ text.py normalisation, stemming, claim extraction, value slots (memoised)
56
+ blocking.py exact candidate generation (prefix filtering, inverted indexes)
57
+ chunking.py token-budgeted chunks for LLM map-reduce
58
+ adapters/ markdown, json/jsonl, sqlite, stancelog (lazy) + registry
59
+ loaders.py transcript formats + auto-detection
60
+ redact.py secret redaction (patterns + entropy)
61
+ context.py DreamConfig, DreamContext
62
+ engine/ deterministic heuristics; LLM prompts, planning, validation, reduce, fallback
63
+ backends/ deterministic, anthropic, openai(-compatible), claude-cli + registry
64
+ pipeline.py phases (load, redact, limits, consolidate, verify, insights, write)
65
+ report.py report.md / report.json / diff
66
+ jobs.py DreamJob (status, persistence, cancel)
67
+ review.py accept (partial), discard
68
+ scheduler.py idle / interval / every-N-sessions triggers
69
+ claude_hook.py Claude Code hook + settings.json installer
70
+ config.py config files, env vars, precedence (_toml.py: TOML loading)
71
+ mcp_server.py stdio MCP server
72
+ cli.py `agentdream` command
73
+ ```
74
+
75
+ ## Extending
76
+
77
+ - **Adapter:** subclass `agentdream.adapters.MemoryAdapter` (`detect`, `load`, `write(entries, dest)`) and
78
+ `register_adapter("name", Cls)`, or expose it via the `agentdream.adapters` entry-point group.
79
+ - **Backend:** subclass `agentdream.LLMBackend` (`complete(system, prompt, json_schema=None) -> str`) and
80
+ `register_backend`, or use the `agentdream.backends` entry-point group.
81
+ - **Transcript format:** `agentdream.register_loader("name", parse_fn)`. `parse_fn(path, text)` returns
82
+ `list[Message]` with `line_no` set.
83
+ - **Phase:** `Pipeline.default().replace("insights", my_fn)` / `.insert_after("verify", "lint", fn)`.
84
+
85
+ ## Pull requests
86
+
87
+ - Keep PRs focused; include tests; run `python -m pytest -q`, `ruff check` and `mypy` locally (CI runs
88
+ Python 3.10–3.13 on Linux, plus a best-effort macOS job, and the lint job).
89
+ - Describe behaviour changes in the README if they are user-visible.
90
+ - Be kind in reviews.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 systemagents-ai
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.