continuum-context-hub 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.
@@ -0,0 +1,41 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .Python
7
+ build/
8
+ develop-eggs/
9
+ dist/
10
+ downloads/
11
+ eggs/
12
+ .eggs/
13
+ lib/
14
+ lib64/
15
+ parts/
16
+ sdist/
17
+ var/
18
+ wheels/
19
+ share/python-wheels/
20
+ *.egg-info/
21
+ .installed.cfg
22
+ *.egg
23
+ MANIFEST
24
+
25
+ # Virtual Environments
26
+ venv/
27
+ env/
28
+ ENV/
29
+ .env
30
+ .venv
31
+ build_env/
32
+
33
+ # Build artifacts
34
+ dist/
35
+ build/
36
+
37
+ # Node
38
+ node_modules/
39
+ npm-debug.log
40
+ yarn-error.log
41
+ .DS_Store
@@ -0,0 +1,48 @@
1
+ # Contributing to Continuum
2
+
3
+ First off, thanks for taking the time to contribute! ❤️
4
+
5
+ All types of contributions are encouraged and valued. See the [Table of Contents](#table-of-contents) for different ways to help and details about how this project handles them. Please make sure to read the relevant section before making your contribution. It will make it a lot easier for us maintainers and smooth out the experience for all involved. The community looks forward to your contributions.
6
+
7
+ ## Table of Contents
8
+
9
+ - [I Have a Question](#i-have-a-question)
10
+ - [I Want To Contribute](#i-want-to-contribute)
11
+ - [Reporting Bugs](#reporting-bugs)
12
+ - [Suggesting Enhancements](#suggesting-enhancements)
13
+ - [Your First Code Contribution](#your-first-code-contribution)
14
+ - [Improving The Documentation](#improving-the-documentation)
15
+ - [Styleguides](#styleguides)
16
+ - [Commit Messages](#commit-messages)
17
+
18
+ ## I Have a Question
19
+
20
+ > If you want to ask a question, we assume that you have read the available [Documentation](https://docs.continuum.ai).
21
+
22
+ Before you ask a question, it is best to search for existing [Issues](https://github.com/continuum-ai/continuum/issues) that might help you. In case you've found a suitable issue and still need clarification, you can write your question in this issue. It is also advisable to search the internet for answers first.
23
+
24
+ ## I Want To Contribute
25
+
26
+ ### Reporting Bugs
27
+
28
+ This section guides you through submitting a bug report for Continuum. Following these guidelines helps maintainers and the community understand your report, reproduce the behavior, and find related reports.
29
+
30
+ ### Suggesting Enhancements
31
+
32
+ This section guides you through submitting an enhancement suggestion for Continuum, including completely new features and minor improvements to existing functionality. Following these guidelines helps maintainers and the community understand your suggestion and find related suggestions.
33
+
34
+ ### Your First Code Contribution
35
+
36
+ Unsure where to begin contributing to Continuum? You can start by looking through these `good-first-issue` and `help-wanted` issues:
37
+
38
+ - [Good first issues](https://github.com/continuum-ai/continuum/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22) - issues which should only require a few lines of code, and a test or two.
39
+ - [Help wanted issues](https://github.com/continuum-ai/continuum/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22) - issues which should be a bit more involved than beginner issues.
40
+
41
+ ## Styleguides
42
+
43
+ ### Commit Messages
44
+
45
+ - Use the present tense ("Add feature" not "Added feature")
46
+ - Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
47
+ - Limit the first line to 72 characters or less
48
+ - Reference issues and pull requests liberally after the first line
@@ -0,0 +1,176 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
@@ -0,0 +1,151 @@
1
+ Metadata-Version: 2.4
2
+ Name: continuum-context-hub
3
+ Version: 0.1.0
4
+ Summary: The Infinite Memory Layer for Personalized AI
5
+ Project-URL: Documentation, https://docs.continuum.ai
6
+ Project-URL: Issues, https://github.com/continuum-ai/continuum/issues
7
+ Project-URL: Source, https://github.com/continuum-ai/continuum
8
+ Author-email: Continuum AI <founders@continuum.ai>
9
+ License-Expression: Apache-2.0
10
+ License-File: LICENSE
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: Apache Software License
14
+ Classifier: Programming Language :: Python :: 3.8
15
+ Classifier: Programming Language :: Python :: 3.9
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Requires-Python: >=3.8
20
+ Requires-Dist: chromadb>=0.4.0
21
+ Requires-Dist: fastapi>=0.100.0
22
+ Requires-Dist: pydantic>=2.0.0
23
+ Requires-Dist: requests>=2.28.0
24
+ Requires-Dist: sentence-transformers>=2.2.0
25
+ Requires-Dist: sqlite-utils>=3.30
26
+ Requires-Dist: typer>=0.9.0
27
+ Requires-Dist: uvicorn>=0.20.0
28
+ Description-Content-Type: text/markdown
29
+
30
+ # Continuum
31
+
32
+ **Continuum** is an open-source framework designed to give AI agents persistent, evolving context. It allows systems to retain information across sessions, adapt to user behavior, and recall complex relationships without the overhead of manual context management.
33
+
34
+ [![PyPI](https://img.shields.io/pypi/v/continuum-ai?color=blue&label=pypi%20package)](https://pypi.org/project/continuum-ai/)
35
+ [![License](https://img.shields.io/badge/license-Apache--2.0-green)](LICENSE)
36
+ [![Documentation](https://img.shields.io/badge/docs-continuum.ai-orange)](https://docs.continuum.ai)
37
+
38
+ ---
39
+
40
+ ## Overview
41
+
42
+ **Continuum** is built on a simple philosophy: **Design by developers, for developers.**
43
+
44
+ In the modern AI coding era, you shouldn't be locked into a single tool. Whether you're prototyping in **Cursor**, refining in **Windsurf**, coding in **VS Code**, or pair-programming with **Antigravity**, your context should travel with you.
45
+
46
+ Continuum acts as the universal memory layer that unifies these experiences. It ensures that the architectural decision you made in one agent is remembered when you switch to another, giving you the confidence to move freely between the best tools for the job.
47
+
48
+ ## Key Advantages
49
+
50
+ ### 🔄 **Freedom to Switch Tools**
51
+ Use the best AI coding assistant for each task without losing context. Start in **Cursor**, refine in **Windsurf**, debug in **VS Code**, or collaborate with **Antigravity**—your progress travels with you.
52
+
53
+ ### 🤝 **True Agent Interoperability**
54
+ What one agent learns, the next one knows. No more:
55
+ - Re-explaining your architecture
56
+ - Repeating requirements
57
+ - Losing bug fix context
58
+ - Starting from scratch with each new session
59
+
60
+ ### 🧠 **Intelligent Context Management**
61
+ Unlike simple vector databases, Continuum:
62
+ - **Promotes** important architectural decisions to long-term memory
63
+ - **Fades** temporary debugging logs and noise naturally
64
+ - **Prevents** context pollution that degrades agent performance
65
+ - **Adapts** to your project's evolving needs
66
+
67
+ ### 🔒 **Privacy-First Architecture**
68
+ - Run locally or in your private cloud
69
+ - You own your data, not locked into vendor clouds
70
+ - Granular control over what gets stored and for how long
71
+
72
+ ### ⚡ **Developer Experience**
73
+ - **Simple Integration**: Just add to your agent's system prompt
74
+ - **Graceful Degradation**: Continues working even if hub is unreachable
75
+ - **Minimal Overhead**: Only checkpoint meaningful progress, not every keystroke
76
+ - **Pluggable Backends**: Use Chroma, Postgres, Redis, or your own storage
77
+
78
+ ## Installation
79
+
80
+ ### Python
81
+
82
+ ```bash
83
+ pip install continuum-ai
84
+ ```
85
+
86
+ ### TypeScript
87
+
88
+ ```bash
89
+ npm install continuum-ai
90
+ ```
91
+
92
+ ## Usage Example
93
+
94
+ Continuum is designed to be integrated into your AI agent's system prompt. Here's how to instruct your agent to use it:
95
+
96
+ ### Agent Instructions: Context Hub Integration
97
+
98
+ Include these instructions in your agent's system prompt:
99
+
100
+ ```markdown
101
+ You are an AI agent working in a persistent development environment. You have access to a **Centralized Context Hub** that stores the history and context of this project.
102
+
103
+ ## Your Goal
104
+ To ensure seamless continuity between sessions (e.g., if the user switches to a different model or IDE), you must **record your progress** and **retrieve past context**.
105
+
106
+ ## Tools Available
107
+ You have access to a Python library `continuum.client`.
108
+
109
+ from continuum.client import hub
110
+
111
+ ## Rules of Engagement
112
+
113
+ ### 1. When to Push Context (Checkpoints)
114
+ Do NOT push every single file edit or thought. This creates noise.
115
+ **DO push a checkpoint when:**
116
+ - You complete a sub-task (e.g., "Implemented the login API").
117
+ - You encounter a tricky bug and find a solution (e.g., "Fixed the CORS issue by updating main.py").
118
+ - You are about to stop or ask the user for input.
119
+
120
+ **How to push:**
121
+ hub.push_checkpoint(
122
+ summary="Completed the User Model",
123
+ details="Added User class with id, name, email fields. Updated database schema."
124
+ )
125
+
126
+ ### 2. When to Pull Context (Retrieval)
127
+ Before starting a complex task, check if there is relevant history.
128
+ **How to search:**
129
+ # Example: You are asked to fix a bug in Auth
130
+ results = hub.search_memory("auth login bug fix")
131
+ # Use 'results' to understand what was done previously
132
+
133
+ ### 3. Failure Handling
134
+ If the Context Hub is unreachable, **proceed with your task**. Do not crash. Log a warning and continue.
135
+ ```
136
+
137
+ ## Architecture
138
+
139
+ Continuum is built on a modular architecture supporting:
140
+ 1. **Ingestion Pipeline**: Text, Code, JSON.
141
+ 2. **Storage Layer**: Pluggable backends (Chroma, Postgres, Redis).
142
+ 3. **Retrieval Engine**: Hybrid search (Dense + Sparse).
143
+
144
+ ## Community & Support
145
+
146
+ * **Issues**: Report bugs or request features on [GitHub Issues](https://github.com/continuum-ai/continuum/issues).
147
+ * **Discussions**: Join the conversation on our [Community Forum](https://github.com/continuum-ai/continuum/discussions).
148
+
149
+ ## License
150
+
151
+ This project is licensed under the Apache 2.0 License - see the [LICENSE](LICENSE) file for details.
@@ -0,0 +1,122 @@
1
+ # Continuum
2
+
3
+ **Continuum** is an open-source framework designed to give AI agents persistent, evolving context. It allows systems to retain information across sessions, adapt to user behavior, and recall complex relationships without the overhead of manual context management.
4
+
5
+ [![PyPI](https://img.shields.io/pypi/v/continuum-ai?color=blue&label=pypi%20package)](https://pypi.org/project/continuum-ai/)
6
+ [![License](https://img.shields.io/badge/license-Apache--2.0-green)](LICENSE)
7
+ [![Documentation](https://img.shields.io/badge/docs-continuum.ai-orange)](https://docs.continuum.ai)
8
+
9
+ ---
10
+
11
+ ## Overview
12
+
13
+ **Continuum** is built on a simple philosophy: **Design by developers, for developers.**
14
+
15
+ In the modern AI coding era, you shouldn't be locked into a single tool. Whether you're prototyping in **Cursor**, refining in **Windsurf**, coding in **VS Code**, or pair-programming with **Antigravity**, your context should travel with you.
16
+
17
+ Continuum acts as the universal memory layer that unifies these experiences. It ensures that the architectural decision you made in one agent is remembered when you switch to another, giving you the confidence to move freely between the best tools for the job.
18
+
19
+ ## Key Advantages
20
+
21
+ ### 🔄 **Freedom to Switch Tools**
22
+ Use the best AI coding assistant for each task without losing context. Start in **Cursor**, refine in **Windsurf**, debug in **VS Code**, or collaborate with **Antigravity**—your progress travels with you.
23
+
24
+ ### 🤝 **True Agent Interoperability**
25
+ What one agent learns, the next one knows. No more:
26
+ - Re-explaining your architecture
27
+ - Repeating requirements
28
+ - Losing bug fix context
29
+ - Starting from scratch with each new session
30
+
31
+ ### 🧠 **Intelligent Context Management**
32
+ Unlike simple vector databases, Continuum:
33
+ - **Promotes** important architectural decisions to long-term memory
34
+ - **Fades** temporary debugging logs and noise naturally
35
+ - **Prevents** context pollution that degrades agent performance
36
+ - **Adapts** to your project's evolving needs
37
+
38
+ ### 🔒 **Privacy-First Architecture**
39
+ - Run locally or in your private cloud
40
+ - You own your data, not locked into vendor clouds
41
+ - Granular control over what gets stored and for how long
42
+
43
+ ### ⚡ **Developer Experience**
44
+ - **Simple Integration**: Just add to your agent's system prompt
45
+ - **Graceful Degradation**: Continues working even if hub is unreachable
46
+ - **Minimal Overhead**: Only checkpoint meaningful progress, not every keystroke
47
+ - **Pluggable Backends**: Use Chroma, Postgres, Redis, or your own storage
48
+
49
+ ## Installation
50
+
51
+ ### Python
52
+
53
+ ```bash
54
+ pip install continuum-ai
55
+ ```
56
+
57
+ ### TypeScript
58
+
59
+ ```bash
60
+ npm install continuum-ai
61
+ ```
62
+
63
+ ## Usage Example
64
+
65
+ Continuum is designed to be integrated into your AI agent's system prompt. Here's how to instruct your agent to use it:
66
+
67
+ ### Agent Instructions: Context Hub Integration
68
+
69
+ Include these instructions in your agent's system prompt:
70
+
71
+ ```markdown
72
+ You are an AI agent working in a persistent development environment. You have access to a **Centralized Context Hub** that stores the history and context of this project.
73
+
74
+ ## Your Goal
75
+ To ensure seamless continuity between sessions (e.g., if the user switches to a different model or IDE), you must **record your progress** and **retrieve past context**.
76
+
77
+ ## Tools Available
78
+ You have access to a Python library `continuum.client`.
79
+
80
+ from continuum.client import hub
81
+
82
+ ## Rules of Engagement
83
+
84
+ ### 1. When to Push Context (Checkpoints)
85
+ Do NOT push every single file edit or thought. This creates noise.
86
+ **DO push a checkpoint when:**
87
+ - You complete a sub-task (e.g., "Implemented the login API").
88
+ - You encounter a tricky bug and find a solution (e.g., "Fixed the CORS issue by updating main.py").
89
+ - You are about to stop or ask the user for input.
90
+
91
+ **How to push:**
92
+ hub.push_checkpoint(
93
+ summary="Completed the User Model",
94
+ details="Added User class with id, name, email fields. Updated database schema."
95
+ )
96
+
97
+ ### 2. When to Pull Context (Retrieval)
98
+ Before starting a complex task, check if there is relevant history.
99
+ **How to search:**
100
+ # Example: You are asked to fix a bug in Auth
101
+ results = hub.search_memory("auth login bug fix")
102
+ # Use 'results' to understand what was done previously
103
+
104
+ ### 3. Failure Handling
105
+ If the Context Hub is unreachable, **proceed with your task**. Do not crash. Log a warning and continue.
106
+ ```
107
+
108
+ ## Architecture
109
+
110
+ Continuum is built on a modular architecture supporting:
111
+ 1. **Ingestion Pipeline**: Text, Code, JSON.
112
+ 2. **Storage Layer**: Pluggable backends (Chroma, Postgres, Redis).
113
+ 3. **Retrieval Engine**: Hybrid search (Dense + Sparse).
114
+
115
+ ## Community & Support
116
+
117
+ * **Issues**: Report bugs or request features on [GitHub Issues](https://github.com/continuum-ai/continuum/issues).
118
+ * **Discussions**: Join the conversation on our [Community Forum](https://github.com/continuum-ai/continuum/discussions).
119
+
120
+ ## License
121
+
122
+ This project is licensed under the Apache 2.0 License - see the [LICENSE](LICENSE) file for details.
@@ -0,0 +1,3 @@
1
+ from .client import ContinuumClient as Memory
2
+
3
+ __all__ = ["Memory"]
File without changes
@@ -0,0 +1,89 @@
1
+ import typer
2
+ import requests
3
+ import sys
4
+ import json
5
+ from typing import Optional
6
+
7
+ app = typer.Typer()
8
+ SERVER_URL = "http://localhost:8000"
9
+
10
+ @app.command()
11
+ def start(name: str):
12
+ """Start a new context session."""
13
+ try:
14
+ response = requests.post(f"{SERVER_URL}/session/start", params={"name": name})
15
+ response.raise_for_status()
16
+ typer.echo(f"Session '{name}' started. ID: {response.json()['id']}")
17
+ except requests.exceptions.ConnectionError:
18
+ typer.echo("Error: Could not connect to Context Hub server. Is it running?")
19
+ except Exception as e:
20
+ typer.echo(f"Error: {e}")
21
+
22
+ @app.command()
23
+ def push(content: str, type: str = "instruction"):
24
+ """Push a piece of context to the hub."""
25
+ item = {
26
+ "type": type,
27
+ "content": content,
28
+ "metadata": {}
29
+ }
30
+ try:
31
+ response = requests.post(f"{SERVER_URL}/context/add", json=item)
32
+ response.raise_for_status()
33
+ typer.echo("Context added.")
34
+ except Exception as e:
35
+ typer.echo(f"Error: {e}")
36
+
37
+ @app.command()
38
+ def pull(limit: int = 10):
39
+ """Pull the latest context."""
40
+ try:
41
+ response = requests.get(f"{SERVER_URL}/context/latest", params={"limit": limit})
42
+ response.raise_for_status()
43
+ items = response.json()
44
+ for item in items:
45
+ typer.echo(f"[{item['type']}] {item['timestamp']}")
46
+ typer.echo(f"{item['content']}")
47
+ typer.echo("-" * 20)
48
+ except Exception as e:
49
+ typer.echo(f"Error: {e}")
50
+
51
+ @app.command()
52
+ def search(query: str, limit: int = 5):
53
+ """Search context using semantic search."""
54
+ try:
55
+ payload = {"query": query, "limit": limit}
56
+ response = requests.post(f"{SERVER_URL}/context/search", json=payload)
57
+ response.raise_for_status()
58
+ results = response.json()
59
+
60
+ if not results:
61
+ typer.echo("No matching context found.")
62
+ return
63
+
64
+ for item in results:
65
+ typer.echo(f"[Score: {item['distance']:.4f}]")
66
+ typer.echo(f"{item['content']}")
67
+ typer.echo("-" * 20)
68
+
69
+ except Exception as e:
70
+ typer.echo(f"Error: {e}")
71
+
72
+ @app.command()
73
+ def status():
74
+ """Check server status."""
75
+ try:
76
+ response = requests.get(f"{SERVER_URL}/")
77
+ typer.echo(f"Server Status: {response.json()}")
78
+
79
+ sess_resp = requests.get(f"{SERVER_URL}/session/current")
80
+ if sess_resp.status_code == 200:
81
+ typer.echo(f"Active Session: {sess_resp.json()['name']}")
82
+ else:
83
+ typer.echo("No active session.")
84
+
85
+ except Exception as e:
86
+ typer.echo(f"Error: {e}")
87
+
88
+ if __name__ == "__main__":
89
+ app()
@@ -0,0 +1,57 @@
1
+ import requests
2
+ import os
3
+ from typing import Optional, Dict, Any
4
+
5
+ class ContinuumClient:
6
+ def __init__(self, server_url: str = "http://localhost:8000"):
7
+ self.server_url = server_url
8
+ self.session_id = None
9
+
10
+ def connect(self):
11
+ """Check connection to the server."""
12
+ try:
13
+ response = requests.get(f"{self.server_url}/")
14
+ return response.status_code == 200
15
+ except requests.exceptions.ConnectionError:
16
+ return False
17
+
18
+ def push_checkpoint(self, summary: str, details: str = "", metadata: Dict[str, Any] = None):
19
+ """
20
+ Push a 'checkpoint' to Continuum.
21
+ Use this when you complete a meaningful task.
22
+ """
23
+ if metadata is None:
24
+ metadata = {}
25
+
26
+ metadata["source"] = "agent_sdk"
27
+ metadata["type"] = "checkpoint"
28
+
29
+ payload = {
30
+ "type": "checkpoint",
31
+ "content": f"{summary}\n\n{details}",
32
+ "metadata": metadata
33
+ }
34
+
35
+ try:
36
+ response = requests.post(f"{self.server_url}/context/add", json=payload)
37
+ response.raise_for_status()
38
+ return True
39
+ except Exception as e:
40
+ print(f"Warning: Failed to push checkpoint to Continuum: {e}")
41
+ return False
42
+
43
+ def search_memory(self, query: str, limit: int = 3):
44
+ """
45
+ Search for relevant past context to help with the current task.
46
+ """
47
+ payload = {"query": query, "limit": limit}
48
+ try:
49
+ response = requests.post(f"{self.server_url}/context/search", json=payload)
50
+ response.raise_for_status()
51
+ return response.json()
52
+ except Exception as e:
53
+ print(f"Warning: Failed to search Continuum: {e}")
54
+ return []
55
+
56
+ # Global instance for easy import
57
+ hub = ContinuumClient()
@@ -0,0 +1,61 @@
1
+ import sqlite3
2
+ import json
3
+ from datetime import datetime
4
+ from typing import List, Optional
5
+ from .models import Session, ContextItem
6
+
7
+ DB_PATH = "continuum.db"
8
+
9
+ def init_db():
10
+ conn = sqlite3.connect(DB_PATH)
11
+ c = conn.cursor()
12
+ c.execute('''CREATE TABLE IF NOT EXISTS sessions
13
+ (id TEXT PRIMARY KEY, name TEXT, created_at TEXT)''')
14
+ c.execute('''CREATE TABLE IF NOT EXISTS context_items
15
+ (id TEXT PRIMARY KEY, session_id TEXT, type TEXT, content TEXT,
16
+ metadata TEXT, timestamp TEXT,
17
+ FOREIGN KEY(session_id) REFERENCES sessions(id))''')
18
+ conn.commit()
19
+ conn.close()
20
+
21
+ def create_session(session: Session):
22
+ conn = sqlite3.connect(DB_PATH)
23
+ c = conn.cursor()
24
+ c.execute("INSERT INTO sessions VALUES (?, ?, ?)",
25
+ (session.id, session.name, session.created_at.isoformat()))
26
+ conn.commit()
27
+ conn.close()
28
+
29
+ def get_session(session_id: str) -> Optional[Session]:
30
+ conn = sqlite3.connect(DB_PATH)
31
+ c = conn.cursor()
32
+ c.execute("SELECT * FROM sessions WHERE id = ?", (session_id,))
33
+ row = c.fetchone()
34
+ if not row:
35
+ return None
36
+
37
+ session = Session(id=row[0], name=row[1], created_at=datetime.fromisoformat(row[2]))
38
+
39
+ # Load items
40
+ c.execute("SELECT * FROM context_items WHERE session_id = ? ORDER BY timestamp", (session_id,))
41
+ items = []
42
+ for item_row in c.fetchall():
43
+ items.append(ContextItem(
44
+ id=item_row[0],
45
+ type=item_row[2],
46
+ content=item_row[3],
47
+ metadata=json.loads(item_row[4]),
48
+ timestamp=datetime.fromisoformat(item_row[5])
49
+ ))
50
+ session.items = items
51
+ conn.close()
52
+ return session
53
+
54
+ def add_context_item(session_id: str, item: ContextItem):
55
+ conn = sqlite3.connect(DB_PATH)
56
+ c = conn.cursor()
57
+ c.execute("INSERT INTO context_items VALUES (?, ?, ?, ?, ?, ?)",
58
+ (item.id, session_id, item.type, item.content,
59
+ json.dumps(item.metadata), item.timestamp.isoformat()))
60
+ conn.commit()
61
+ conn.close()
@@ -0,0 +1,76 @@
1
+ from fastapi import FastAPI, HTTPException
2
+ from typing import List, Optional
3
+ from .models import Session, ContextItem, SearchQuery
4
+ from . import database
5
+ from .memory import memory_store
6
+ import uuid
7
+
8
+ app = FastAPI(title="Continuum", description="Centralized Context Layer for AI Coding")
9
+
10
+ # Initialize DB
11
+ database.init_db()
12
+
13
+ # Simple in-memory tracker for "active" session ID for this server instance
14
+ # In a real multi-user scenario, this would be per-user or token-based
15
+ current_session_id: Optional[str] = None
16
+
17
+ @app.get("/")
18
+ def read_root():
19
+ return {"status": "running", "service": "Continuum", "features": ["vector-search"]}
20
+
21
+ @app.post("/session/start")
22
+ def start_session(name: str):
23
+ global current_session_id
24
+ session = Session(id=str(uuid.uuid4()), name=name)
25
+ database.create_session(session)
26
+ current_session_id = session.id
27
+ return session
28
+
29
+ @app.get("/session/current")
30
+ def get_current_session():
31
+ if not current_session_id:
32
+ raise HTTPException(status_code=404, detail="No active session")
33
+
34
+ session = database.get_session(current_session_id)
35
+ if session:
36
+ return session
37
+ raise HTTPException(status_code=404, detail="Session not found")
38
+
39
+ @app.post("/context/add")
40
+ def add_context(item: ContextItem):
41
+ if not current_session_id:
42
+ raise HTTPException(status_code=400, detail="No active session. Start one first.")
43
+
44
+ # Verify session exists
45
+ if database.get_session(current_session_id):
46
+ # 1. Add to SQLite
47
+ database.add_context_item(current_session_id, item)
48
+
49
+ # 2. Add to Vector Store (Memory)
50
+ # We include session_id in metadata so we can filter by it later if needed
51
+ metadata = item.metadata.copy()
52
+ metadata["session_id"] = current_session_id
53
+ metadata["type"] = item.type
54
+ metadata["timestamp"] = item.timestamp.isoformat()
55
+
56
+ memory_store.add(id=item.id, text=item.content, metadata=metadata)
57
+
58
+ return {"status": "added", "item_id": item.id}
59
+
60
+ raise HTTPException(status_code=404, detail="Session not found")
61
+
62
+ @app.post("/context/search")
63
+ def search_context(query: SearchQuery):
64
+ results = memory_store.search(query.query, query.limit, query.filters)
65
+ return results
66
+
67
+ @app.get("/context/latest")
68
+ def get_latest_context(limit: int = 10):
69
+ if not current_session_id:
70
+ raise HTTPException(status_code=404, detail="No active session")
71
+
72
+ session = database.get_session(current_session_id)
73
+ if session:
74
+ return session.items[-limit:]
75
+
76
+ raise HTTPException(status_code=404, detail="Session not found")
@@ -0,0 +1,54 @@
1
+ import chromadb
2
+ from chromadb.config import Settings
3
+ from sentence_transformers import SentenceTransformer
4
+ from typing import List, Dict, Any
5
+ import os
6
+
7
+ class Memory:
8
+ def __init__(self, persist_directory: str = "chroma_db"):
9
+ self.client = chromadb.Client(Settings(
10
+ persist_directory=persist_directory,
11
+ is_persistent=True
12
+ ))
13
+ self.collection = self.client.get_or_create_collection(name="continuum")
14
+ # Load a lightweight model for local embeddings
15
+ self.model = SentenceTransformer('all-MiniLM-L6-v2')
16
+
17
+ def add(self, id: str, text: str, metadata: Dict[str, Any]):
18
+ """Add a text item to the vector store."""
19
+ embedding = self.model.encode(text).tolist()
20
+ self.collection.add(
21
+ documents=[text],
22
+ embeddings=[embedding],
23
+ metadatas=[metadata],
24
+ ids=[id]
25
+ )
26
+
27
+ def search(self, query: str, limit: int = 5, filters: Dict[str, Any] = None) -> List[Dict[str, Any]]:
28
+ """Search for relevant context items."""
29
+ query_embedding = self.model.encode(query).tolist()
30
+
31
+ # ChromaDB expects None for no filters, not {}
32
+ where_clause = filters if filters else None
33
+
34
+ results = self.collection.query(
35
+ query_embeddings=[query_embedding],
36
+ n_results=limit,
37
+ where=where_clause
38
+ )
39
+
40
+ # Format results
41
+ formatted_results = []
42
+ if results['ids']:
43
+ for i in range(len(results['ids'][0])):
44
+ formatted_results.append({
45
+ "id": results['ids'][0][i],
46
+ "content": results['documents'][0][i],
47
+ "metadata": results['metadatas'][0][i],
48
+ "distance": results['distances'][0][i] if results['distances'] else None
49
+ })
50
+
51
+ return formatted_results
52
+
53
+ # Singleton instance
54
+ memory_store = Memory()
@@ -0,0 +1,27 @@
1
+ from pydantic import BaseModel
2
+ from typing import List, Optional, Dict, Any
3
+ from datetime import datetime
4
+ import uuid
5
+
6
+ class ContextItem(BaseModel):
7
+ id: str = ""
8
+ type: str # "file", "diff", "instruction", "error"
9
+ content: str
10
+ metadata: Dict[str, Any] = {}
11
+ timestamp: datetime = datetime.now()
12
+
13
+ def __init__(self, **data):
14
+ super().__init__(**data)
15
+ if not self.id:
16
+ self.id = str(uuid.uuid4())
17
+
18
+ class Session(BaseModel):
19
+ id: str
20
+ name: str
21
+ created_at: datetime = datetime.now()
22
+ items: List[ContextItem] = []
23
+
24
+ class SearchQuery(BaseModel):
25
+ query: str
26
+ limit: int = 5
27
+ filters: Dict[str, Any] = {}
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "continuum-ai",
3
+ "version": "0.1.0",
4
+ "description": "The Infinite Memory Layer for Personalized AI",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "scripts": {
8
+ "build": "tsc",
9
+ "test": "jest"
10
+ },
11
+ "keywords": [
12
+ "ai",
13
+ "memory",
14
+ "llm",
15
+ "agent"
16
+ ],
17
+ "author": "Continuum AI",
18
+ "license": "Apache-2.0",
19
+ "devDependencies": {
20
+ "typescript": "^5.0.0",
21
+ "@types/node": "^20.0.0"
22
+ }
23
+ }
@@ -0,0 +1,42 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "continuum-context-hub"
7
+ version = "0.1.0"
8
+ description = "The Infinite Memory Layer for Personalized AI"
9
+ readme = "README.md"
10
+ requires-python = ">=3.8"
11
+ license = "Apache-2.0"
12
+ authors = [
13
+ { name = "Continuum AI", email = "founders@continuum.ai" },
14
+ ]
15
+ classifiers = [
16
+ "Development Status :: 4 - Beta",
17
+ "Intended Audience :: Developers",
18
+ "License :: OSI Approved :: Apache Software License",
19
+ "Programming Language :: Python :: 3.8",
20
+ "Programming Language :: Python :: 3.9",
21
+ "Programming Language :: Python :: 3.10",
22
+ "Programming Language :: Python :: 3.11",
23
+ "Programming Language :: Python :: 3.12",
24
+ ]
25
+ dependencies = [
26
+ "requests>=2.28.0",
27
+ "fastapi>=0.100.0",
28
+ "uvicorn>=0.20.0",
29
+ "pydantic>=2.0.0",
30
+ "typer>=0.9.0",
31
+ "sqlite-utils>=3.30",
32
+ "chromadb>=0.4.0",
33
+ "sentence-transformers>=2.2.0",
34
+ ]
35
+
36
+ [project.urls]
37
+ Documentation = "https://docs.continuum.ai"
38
+ Issues = "https://github.com/continuum-ai/continuum/issues"
39
+ Source = "https://github.com/continuum-ai/continuum"
40
+
41
+ [tool.hatch.build.targets.wheel]
42
+ packages = ["continuum"]
@@ -0,0 +1,8 @@
1
+ fastapi
2
+ uvicorn
3
+ pydantic
4
+ typer
5
+ requests
6
+ sqlite-utils
7
+ chromadb
8
+ sentence-transformers
@@ -0,0 +1,14 @@
1
+ export class Memory {
2
+ constructor(config?: any) {
3
+ console.log("Continuum Memory initialized");
4
+ }
5
+
6
+ async add(content: string, metadata?: any): Promise<void> {
7
+ console.log("Adding memory:", content);
8
+ }
9
+
10
+ async search(query: string, options?: any): Promise<any[]> {
11
+ console.log("Searching memory for:", query);
12
+ return [];
13
+ }
14
+ }