Metadata-Version: 2.4
Name: coreason_archive
Version: 0.4.0
Summary: persistence layer for Cognitive State across the CoReason ecosystem
License: # The Prosperity Public License 3.0.0
         
         Contributor: CoReason, Inc.
         
         Source Code: https://github.com/CoReason-AI/coreason_archive
         
         ## Purpose
         
         This license allows you to use and share this software for noncommercial purposes for free and to try this software for commercial purposes for thirty days.
         
         ## Agreement
         
         In order to receive this license, you have to agree to its rules.  Those rules are both obligations under that agreement and conditions to your license.  Don't do anything with this software that triggers a rule you can't or won't follow.
         
         ## Notices
         
         Make sure everyone who gets a copy of any part of this software from you, with or without changes, also gets the text of this license and the contributor and source code lines above.
         
         ## Commercial Trial
         
         Limit your use of this software for commercial purposes to a thirty-day trial period.  If you use this software for work, your company gets one trial period for all personnel, not one trial per person.
         
         ## Contributions Back
         
         Developing feedback, changes, or additions that you contribute back to the contributor on the terms of a standardized public software license such as [the Blue Oak Model License 1.0.0](https://blueoakcouncil.org/license/1.0.0), [the Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0.html), [the MIT license](https://spdx.org/licenses/MIT.html), or [the two-clause BSD license](https://spdx.org/licenses/BSD-2-Clause.html) doesn't count as use for a commercial purpose.
         
         ## Personal Uses
         
         Personal use for research, experiment, and testing for the benefit of public knowledge, personal study, private entertainment, hobby projects, amateur pursuits, or religious observance, without any anticipated commercial application, doesn't count as use for a commercial purpose.
         
         ## Noncommercial Organizations
         
         Use by any charitable organization, educational institution, public research organization, public safety or health organization, environmental protection organization, or government institution doesn't count as use for a commercial purpose regardless of the source of funding or obligations resulting from the funding.
         
         ## Defense
         
         Don't make any legal claim against anyone accusing this software, with or without changes, alone or with other technology, of infringing any patent.
         
         ## Copyright
         
         The contributor licenses you to do everything with this software that would otherwise infringe their copyright in it.
         
         ## Patent
         
         The contributor licenses you to do everything with this software that would otherwise infringe any patents they can license or become able to license.
         
         ## Reliability
         
         The contributor can't revoke this license.
         
         ## Excuse
         
         You're excused for unknowingly breaking [Notices](#notices) if you take all practical steps to comply within thirty days of learning you broke the rule.
         
         ## No Liability
         
         ***As far as the law allows, this software comes as is, without any warranty or condition, and the contributor won't be liable to anyone for any damages related to this software or this license, under any kind of legal claim.***
License-File: LICENSE
License-File: NOTICE
Author: Gowtham A Rao
Author-email: gowtham.rao@coreason.ai
Requires-Python: >=3.11
Classifier: License :: Other/Proprietary License
Classifier: Programming Language :: Python :: 3.12
Classifier: Operating System :: OS Independent
Requires-Dist: loguru (>=0.7.2,<0.8.0)
Requires-Dist: networkx (>=3.4,<4.0)
Requires-Dist: numpy (>=1.26.0)
Requires-Dist: pydantic (>=2.7.0,<3.0.0)
Project-URL: Documentation, https://github.com/CoReason-AI/coreason-archive
Project-URL: Homepage, https://github.com/CoReason-AI/coreason-archive
Project-URL: Repository, https://github.com/CoReason-AI/coreason-archive
Description-Content-Type: text/markdown

# coreason-archive

**Persistence layer for "Cognitive State" across the CoReason ecosystem.**

[![CI/CD](https://github.com/CoReason-AI/coreason-archive/actions/workflows/ci-cd.yml/badge.svg)](https://github.com/CoReason-AI/coreason-archive/actions/workflows/ci-cd.yml)
[![Docker](https://github.com/CoReason-AI/coreason-archive/actions/workflows/docker.yml/badge.svg)](https://github.com/CoReason-AI/coreason-archive/actions/workflows/docker.yml)
[![codecov](https://codecov.io/gh/CoReason-AI/coreason-archive/graph/badge.svg)](https://codecov.io/gh/CoReason-AI/coreason-archive)
![Python](https://img.shields.io/badge/python-3.12+-blue.svg)
![License](https://img.shields.io/badge/license-Prosperity--3.0-green)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)
[![Poetry](https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json)](https://python-poetry.org/)
[![Pydantic v2](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/pydantic/pydantic/main/docs/badge/v2.json)](https://pydantic.dev)

## Executive Summary

coreason-archive is the persistence layer for "Cognitive State" across the CoReason ecosystem. It addresses the critical failure mode of modern AI: **"Digital Amnesia."**

Standard RAG (Retrieval Augmented Generation) only looks at static documents (coreason-mcp). coreason-archive looks at **Dynamic Experience**. It stores the *reasoning traces*, *decisions*, and *user preferences* generated during runtime.

Version 3.0 upgrades the architecture from a simple Vector Cache to a **Hybrid Neuro-Symbolic Memory System**. It combines **Vector Search** (for semantic similarity) with a **Knowledge Graph** (for structural relationships) and a **Temporal Engine** (for time-decay). This ensures that an agent doesn't just recall "similar text" but understands "who, when, and why" a decision was made, respecting strict enterprise boundaries.

## Functional Philosophy

The agent must implement the **Scope-Link-Rank-Retrieve Loop**:

1.  **Hybrid Memory Structure (Neuro-Symbolic):**
    *   **Semantic (Vector):** "Find thoughts similar to 'Dosing Protocol'."
    *   **Structural (Graph):** "Find all thoughts linked to 'Project Apollo' and 'Dr. Smith'."
    *   **SOTA Best Practice:** Using vectors for fuzzy matching and graphs for explicit entity tracking prevents "Context Collapse" in complex workflows.
2.  **Federated Scoping (The Hierarchy of Truth):**
    *   Memory is not a flat bucket. It is a hierarchy: User > Project > Department > Global.
    *   A "User Preference" (e.g., "Don't use tables") overrides a "Global Default."
3.  **Active Epistemic Decay:**
    *   Knowledge has a half-life. A cached thought about "Q3 Strategy" is worthless in Q4.
    *   We implement **Time-Aware Retrieval** where older memories have lower retrieval scores unless explicitly pinned.
4.  **Memory Portability (The Digital Twin):**
    *   When a user moves departments, their *personal* cognitive state follows them, but their *former team's* secrets are left behind.

## Getting Started

### Prerequisites

- Python 3.12+
- Poetry

### Installation

1.  Clone the repository:
    ```sh
    git clone https://github.com/example/example.git
    cd my_python_project
    ```
2.  Install dependencies:
    ```sh
    poetry install
    ```

### Usage

-   Run the linter:
    ```sh
    poetry run pre-commit run --all-files
    ```
-   Run the tests:
    ```sh
    poetry run pytest
    ```

For detailed documentation, please refer to the `docs/` folder or the [MkDocs site](docs/index.md).

