chronem 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 (126) hide show
  1. chronem-0.1.0/.cursor/rules/chronem-core.mdc +24 -0
  2. chronem-0.1.0/.github/actions/validate-distribution/action.yml +41 -0
  3. chronem-0.1.0/.github/pull_request_template.md +34 -0
  4. chronem-0.1.0/.github/workflows/ci.yml +109 -0
  5. chronem-0.1.0/.github/workflows/release-dry-run.yml +56 -0
  6. chronem-0.1.0/.github/workflows/release.yml +87 -0
  7. chronem-0.1.0/.gitignore +220 -0
  8. chronem-0.1.0/AGENTS.md +132 -0
  9. chronem-0.1.0/CHANGELOG.md +45 -0
  10. chronem-0.1.0/CONTRIBUTING.md +85 -0
  11. chronem-0.1.0/LICENSE +201 -0
  12. chronem-0.1.0/PKG-INFO +240 -0
  13. chronem-0.1.0/README.md +200 -0
  14. chronem-0.1.0/SECURITY.md +26 -0
  15. chronem-0.1.0/alembic.ini +39 -0
  16. chronem-0.1.0/docs/architecture.md +392 -0
  17. chronem-0.1.0/docs/decisions/README.md +131 -0
  18. chronem-0.1.0/docs/development-workflow.md +78 -0
  19. chronem-0.1.0/docs/evaluation.md +96 -0
  20. chronem-0.1.0/docs/open-source-growth.md +81 -0
  21. chronem-0.1.0/docs/open-source-plan.md +407 -0
  22. chronem-0.1.0/docs/product-requirements.md +167 -0
  23. chronem-0.1.0/docs/project-status.md +359 -0
  24. chronem-0.1.0/docs/releasing.md +131 -0
  25. chronem-0.1.0/docs/roadmap.md +133 -0
  26. chronem-0.1.0/docs/sprint-1-spec.md +71 -0
  27. chronem-0.1.0/examples/deterministic_lifecycle.py +72 -0
  28. chronem-0.1.0/examples/postgres_full_engine.py +205 -0
  29. chronem-0.1.0/pyproject.toml +101 -0
  30. chronem-0.1.0/scripts/run_deterministic_evaluation.py +571 -0
  31. chronem-0.1.0/scripts/smoke_installed_wheel.py +79 -0
  32. chronem-0.1.0/scripts/smoke_installed_wheel_postgres.py +61 -0
  33. chronem-0.1.0/scripts/validate_distribution.py +193 -0
  34. chronem-0.1.0/scripts/validate_release_tag.py +48 -0
  35. chronem-0.1.0/src/chronem/__init__.py +111 -0
  36. chronem-0.1.0/src/chronem/answers/__init__.py +18 -0
  37. chronem-0.1.0/src/chronem/answers/models.py +92 -0
  38. chronem-0.1.0/src/chronem/answers/service.py +160 -0
  39. chronem-0.1.0/src/chronem/entities/__init__.py +6 -0
  40. chronem-0.1.0/src/chronem/entities/normalization.py +15 -0
  41. chronem-0.1.0/src/chronem/entities/resolver.py +57 -0
  42. chronem-0.1.0/src/chronem/evaluation/__init__.py +40 -0
  43. chronem-0.1.0/src/chronem/evaluation/data/__init__.py +1 -0
  44. chronem-0.1.0/src/chronem/evaluation/data/recall_planning.json +14 -0
  45. chronem-0.1.0/src/chronem/evaluation/entities.py +174 -0
  46. chronem-0.1.0/src/chronem/evaluation/grounding.py +305 -0
  47. chronem-0.1.0/src/chronem/evaluation/lifecycle.py +221 -0
  48. chronem-0.1.0/src/chronem/evaluation/metrics.py +51 -0
  49. chronem-0.1.0/src/chronem/evaluation/models.py +221 -0
  50. chronem-0.1.0/src/chronem/evaluation/planning.py +56 -0
  51. chronem-0.1.0/src/chronem/evaluation/runner.py +44 -0
  52. chronem-0.1.0/src/chronem/evaluation/structured_recall.py +49 -0
  53. chronem-0.1.0/src/chronem/ingestion/__init__.py +18 -0
  54. chronem-0.1.0/src/chronem/ingestion/models.py +66 -0
  55. chronem-0.1.0/src/chronem/ingestion/service.py +336 -0
  56. chronem-0.1.0/src/chronem/interfaces/__init__.py +35 -0
  57. chronem-0.1.0/src/chronem/interfaces/answers.py +23 -0
  58. chronem-0.1.0/src/chronem/interfaces/clock.py +13 -0
  59. chronem-0.1.0/src/chronem/interfaces/entities.py +64 -0
  60. chronem-0.1.0/src/chronem/interfaces/extraction.py +19 -0
  61. chronem-0.1.0/src/chronem/interfaces/queries.py +97 -0
  62. chronem-0.1.0/src/chronem/interfaces/recall.py +22 -0
  63. chronem-0.1.0/src/chronem/interfaces/repositories.py +109 -0
  64. chronem-0.1.0/src/chronem/lifecycle/engine.py +260 -0
  65. chronem-0.1.0/src/chronem/models/_shared.py +63 -0
  66. chronem-0.1.0/src/chronem/models/candidate.py +92 -0
  67. chronem-0.1.0/src/chronem/models/capture.py +52 -0
  68. chronem-0.1.0/src/chronem/models/entity.py +61 -0
  69. chronem-0.1.0/src/chronem/models/memory.py +154 -0
  70. chronem-0.1.0/src/chronem/models/types.py +47 -0
  71. chronem-0.1.0/src/chronem/persistence/__init__.py +1 -0
  72. chronem-0.1.0/src/chronem/persistence/postgres/__init__.py +22 -0
  73. chronem-0.1.0/src/chronem/persistence/postgres/mapping.py +99 -0
  74. chronem-0.1.0/src/chronem/persistence/postgres/migration.py +31 -0
  75. chronem-0.1.0/src/chronem/persistence/postgres/migrations/__init__.py +1 -0
  76. chronem-0.1.0/src/chronem/persistence/postgres/migrations/__main__.py +22 -0
  77. chronem-0.1.0/src/chronem/persistence/postgres/migrations/env.py +61 -0
  78. chronem-0.1.0/src/chronem/persistence/postgres/migrations/script.py.mako +25 -0
  79. chronem-0.1.0/src/chronem/persistence/postgres/migrations/versions/20261008_0001_initial_postgres.py +143 -0
  80. chronem-0.1.0/src/chronem/persistence/postgres/migrations/versions/20261009_0002_structured_recall_index.py +27 -0
  81. chronem-0.1.0/src/chronem/persistence/postgres/migrations/versions/__init__.py +1 -0
  82. chronem-0.1.0/src/chronem/persistence/postgres/repositories.py +334 -0
  83. chronem-0.1.0/src/chronem/persistence/postgres/session.py +14 -0
  84. chronem-0.1.0/src/chronem/persistence/postgres/tables.py +145 -0
  85. chronem-0.1.0/src/chronem/providers/__init__.py +1 -0
  86. chronem-0.1.0/src/chronem/providers/openai/__init__.py +35 -0
  87. chronem-0.1.0/src/chronem/providers/openai/answer_prompt.py +56 -0
  88. chronem-0.1.0/src/chronem/providers/openai/answer_schemas.py +30 -0
  89. chronem-0.1.0/src/chronem/providers/openai/answer_synthesizer.py +82 -0
  90. chronem-0.1.0/src/chronem/providers/openai/extractor.py +64 -0
  91. chronem-0.1.0/src/chronem/providers/openai/prompt.py +45 -0
  92. chronem-0.1.0/src/chronem/providers/openai/recall_planner.py +78 -0
  93. chronem-0.1.0/src/chronem/providers/openai/recall_prompt.py +53 -0
  94. chronem-0.1.0/src/chronem/providers/openai/recall_schemas.py +88 -0
  95. chronem-0.1.0/src/chronem/providers/openai/schemas.py +154 -0
  96. chronem-0.1.0/src/chronem/py.typed +1 -0
  97. chronem-0.1.0/src/chronem/recall/__init__.py +34 -0
  98. chronem-0.1.0/src/chronem/recall/models.py +154 -0
  99. chronem-0.1.0/src/chronem/recall/orchestration.py +119 -0
  100. chronem-0.1.0/src/chronem/recall/service.py +168 -0
  101. chronem-0.1.0/tests/__init__.py +1 -0
  102. chronem-0.1.0/tests/data/extraction_evaluation.json +76 -0
  103. chronem-0.1.0/tests/integration/__init__.py +1 -0
  104. chronem-0.1.0/tests/integration/test_ingestion_postgres.py +1533 -0
  105. chronem-0.1.0/tests/integration/test_postgres_example.py +46 -0
  106. chronem-0.1.0/tests/integration/test_postgres_repositories.py +552 -0
  107. chronem-0.1.0/tests/scenarios/__init__.py +6 -0
  108. chronem-0.1.0/tests/scenarios/canonical.py +455 -0
  109. chronem-0.1.0/tests/scenarios/models.py +76 -0
  110. chronem-0.1.0/tests/scenarios/test_canonical_scenarios.py +178 -0
  111. chronem-0.1.0/tests/test_capture.py +85 -0
  112. chronem-0.1.0/tests/test_entity_resolution.py +279 -0
  113. chronem-0.1.0/tests/test_evaluation.py +286 -0
  114. chronem-0.1.0/tests/test_examples.py +48 -0
  115. chronem-0.1.0/tests/test_ingestion.py +667 -0
  116. chronem-0.1.0/tests/test_interfaces.py +196 -0
  117. chronem-0.1.0/tests/test_lifecycle.py +521 -0
  118. chronem-0.1.0/tests/test_models.py +464 -0
  119. chronem-0.1.0/tests/test_openai_answer_synthesizer.py +258 -0
  120. chronem-0.1.0/tests/test_openai_extractor.py +600 -0
  121. chronem-0.1.0/tests/test_openai_recall_planner.py +434 -0
  122. chronem-0.1.0/tests/test_recall.py +517 -0
  123. chronem-0.1.0/tests/test_recall_answers.py +422 -0
  124. chronem-0.1.0/tests/test_recall_orchestration.py +429 -0
  125. chronem-0.1.0/tests/test_release_foundations.py +70 -0
  126. chronem-0.1.0/tests/test_repositories.py +441 -0
@@ -0,0 +1,24 @@
1
+ ---
2
+ description: Cursor entrypoint for the shared Chronem agent instructions.
3
+ globs:
4
+ alwaysApply: true
5
+ ---
6
+
7
+ # Chronem Cursor Rule
8
+
9
+ The canonical cross-agent instructions live in @AGENTS.md.
10
+
11
+ Before making non-trivial changes, read:
12
+ - @AGENTS.md
13
+ - the linked GitHub Issue in full
14
+ - @docs/architecture.md
15
+ - @docs/decisions/README.md
16
+ - @docs/product-requirements.md
17
+ - @docs/roadmap.md
18
+ - @docs/project-status.md
19
+ - @docs/development-workflow.md
20
+
21
+ Follow the source-of-truth order in @AGENTS.md. Do not duplicate architecture
22
+ or product rules in this Cursor-only file. Put durable changes in the shared
23
+ repository documentation so Cursor, Codex, and future agents receive the same
24
+ context.
@@ -0,0 +1,41 @@
1
+ name: Validate Python distribution
2
+ description: Build, inspect, install, and smoke-test Chronem's wheel and sdist
3
+
4
+ runs:
5
+ using: composite
6
+ steps:
7
+ - name: Install packaging tools
8
+ shell: bash
9
+ run: python -m pip install "build>=1.2,<2" "twine>=6,<7"
10
+
11
+ - name: Build wheel and sdist
12
+ shell: bash
13
+ run: python -m build
14
+
15
+ - name: Validate package metadata
16
+ shell: bash
17
+ run: python -m twine check --strict dist/*
18
+
19
+ - name: Validate artifact names and contents
20
+ shell: bash
21
+ run: python scripts/validate_distribution.py dist
22
+
23
+ - name: Smoke-test the installed wheel in a fresh environment
24
+ shell: bash
25
+ run: |
26
+ smoke_dir="$(mktemp -d "$RUNNER_TEMP/chronem-wheel-smoke.XXXXXX")"
27
+ python -m venv "$smoke_dir"
28
+ "$smoke_dir/bin/python" -m pip install --upgrade pip
29
+ wheels=(dist/*.whl)
30
+ "$smoke_dir/bin/python" -m pip install "${wheels[0]}[postgres]"
31
+ cp scripts/smoke_installed_wheel.py "$smoke_dir/"
32
+ cp scripts/smoke_installed_wheel_postgres.py "$smoke_dir/"
33
+ cp examples/deterministic_lifecycle.py "$smoke_dir/"
34
+ (
35
+ cd "$RUNNER_TEMP"
36
+ "$smoke_dir/bin/python" "$smoke_dir/smoke_installed_wheel.py"
37
+ "$smoke_dir/bin/python" "$smoke_dir/deterministic_lifecycle.py"
38
+ "$smoke_dir/bin/python" "$smoke_dir/smoke_installed_wheel_postgres.py" \
39
+ --database-url "$CHRONEM_DISTRIBUTION_DATABASE_URL" \
40
+ --source-root "$GITHUB_WORKSPACE"
41
+ )
@@ -0,0 +1,34 @@
1
+ ## Linked issue
2
+
3
+ Closes #
4
+
5
+ ## Summary
6
+
7
+
8
+ ## Scope
9
+
10
+ **In scope:**
11
+
12
+ **Out of scope:**
13
+
14
+ ## Architecture / ADR impact
15
+
16
+ None, or describe the accepted decision added/changed.
17
+
18
+ ## Validation
19
+
20
+ List tests and results.
21
+
22
+ ## Security / privacy impact
23
+
24
+ None, or describe user-isolation, data-handling, or privacy effects.
25
+
26
+ ## Risks / follow-ups
27
+
28
+
29
+ ## Checklist
30
+
31
+ - [ ] I read `AGENTS.md`, the linked Issue, and relevant shared documentation.
32
+ - [ ] I stayed within the Issue scope and documented any approved changes.
33
+ - [ ] Required quality gates pass.
34
+ - [ ] I did not add secrets or real personal data.
@@ -0,0 +1,109 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: ["main"]
6
+ pull_request:
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ distribution:
13
+ name: Distribution package
14
+ runs-on: ubuntu-latest
15
+ services:
16
+ postgres:
17
+ image: public.ecr.aws/docker/library/postgres:16
18
+ env:
19
+ POSTGRES_DB: chronem_distribution
20
+ POSTGRES_USER: chronem
21
+ POSTGRES_PASSWORD: chronem_distribution_password
22
+ ports:
23
+ - 5432:5432
24
+ options: >-
25
+ --health-cmd "pg_isready -U chronem -d chronem_distribution"
26
+ --health-interval 5s
27
+ --health-timeout 5s
28
+ --health-retries 10
29
+ env:
30
+ CHRONEM_DISTRIBUTION_DATABASE_URL: postgresql+psycopg://chronem:chronem_distribution_password@127.0.0.1:5432/chronem_distribution
31
+ steps:
32
+ - name: Check out repository
33
+ uses: actions/checkout@v7
34
+
35
+ - name: Set up Python 3.12
36
+ uses: actions/setup-python@v7
37
+ with:
38
+ python-version: "3.12"
39
+ cache: pip
40
+
41
+ - name: Build and validate distributions
42
+ uses: ./.github/actions/validate-distribution
43
+
44
+ - name: Upload validated distributions
45
+ uses: actions/upload-artifact@v7
46
+ with:
47
+ name: python-distributions-${{ github.sha }}
48
+ path: dist/
49
+ if-no-files-found: error
50
+ retention-days: 7
51
+
52
+ quality:
53
+ name: Quality gates (Python ${{ matrix.python-version }})
54
+ runs-on: ubuntu-latest
55
+ strategy:
56
+ fail-fast: true
57
+ matrix:
58
+ python-version: ["3.11", "3.12"]
59
+
60
+ services:
61
+ postgres:
62
+ image: public.ecr.aws/docker/library/postgres:16
63
+ env:
64
+ POSTGRES_DB: chronem_test
65
+ POSTGRES_USER: chronem
66
+ POSTGRES_PASSWORD: chronem_test_password
67
+ ports:
68
+ - 5432:5432
69
+ options: >-
70
+ --health-cmd "pg_isready -U chronem -d chronem_test"
71
+ --health-interval 5s
72
+ --health-timeout 5s
73
+ --health-retries 10
74
+
75
+ env:
76
+ CHRONEM_TEST_DATABASE_URL: postgresql+psycopg://chronem:chronem_test_password@127.0.0.1:5432/chronem_test
77
+
78
+ steps:
79
+ - name: Check out repository
80
+ uses: actions/checkout@v7
81
+
82
+ - name: Set up Python ${{ matrix.python-version }}
83
+ uses: actions/setup-python@v7
84
+ with:
85
+ python-version: ${{ matrix.python-version }}
86
+ cache: pip
87
+
88
+ - name: Install package and development dependencies
89
+ run: |
90
+ python -m pip install --upgrade pip
91
+ python -m pip install -e ".[dev]"
92
+
93
+ - name: Lint
94
+ run: ruff check .
95
+
96
+ - name: Type check
97
+ run: mypy src
98
+
99
+ - name: Unit tests with coverage
100
+ run: pytest -m "not postgres" --cov=chronem --cov-report=term-missing
101
+
102
+ - name: PostgreSQL integration tests
103
+ run: pytest -m postgres --cov=chronem --cov-append --cov-report=term-missing
104
+
105
+ - name: Deterministic contract evaluation
106
+ run: python scripts/run_deterministic_evaluation.py
107
+
108
+ - name: Enforce lifecycle coverage
109
+ run: coverage report --include="*/chronem/lifecycle/*" --fail-under=90
@@ -0,0 +1,56 @@
1
+ name: Release dry run
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ ref:
7
+ description: Commit, branch, or tag to validate
8
+ required: true
9
+ default: main
10
+ type: string
11
+
12
+ permissions:
13
+ contents: read
14
+
15
+ jobs:
16
+ validate:
17
+ name: Build and validate release artifacts
18
+ runs-on: ubuntu-latest
19
+ services:
20
+ postgres:
21
+ image: public.ecr.aws/docker/library/postgres:16
22
+ env:
23
+ POSTGRES_DB: chronem_distribution
24
+ POSTGRES_USER: chronem
25
+ POSTGRES_PASSWORD: chronem_distribution_password
26
+ ports:
27
+ - 5432:5432
28
+ options: >-
29
+ --health-cmd "pg_isready -U chronem -d chronem_distribution"
30
+ --health-interval 5s
31
+ --health-timeout 5s
32
+ --health-retries 10
33
+ env:
34
+ CHRONEM_DISTRIBUTION_DATABASE_URL: postgresql+psycopg://chronem:chronem_distribution_password@127.0.0.1:5432/chronem_distribution
35
+ steps:
36
+ - name: Check out requested ref
37
+ uses: actions/checkout@v7
38
+ with:
39
+ ref: ${{ inputs.ref }}
40
+
41
+ - name: Set up Python 3.12
42
+ uses: actions/setup-python@v7
43
+ with:
44
+ python-version: "3.12"
45
+ cache: pip
46
+
47
+ - name: Build and validate distributions
48
+ uses: ./.github/actions/validate-distribution
49
+
50
+ - name: Upload dry-run artifacts
51
+ uses: actions/upload-artifact@v7
52
+ with:
53
+ name: release-dry-run-${{ github.sha }}
54
+ path: dist/
55
+ if-no-files-found: error
56
+ retention-days: 14
@@ -0,0 +1,87 @@
1
+ name: Release Python distribution
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ tag:
7
+ description: Existing version tag to build, such as v0.1.0
8
+ required: true
9
+ type: string
10
+ publish:
11
+ description: Publish validated artifacts to PyPI
12
+ required: true
13
+ default: false
14
+ type: boolean
15
+
16
+ permissions:
17
+ contents: read
18
+
19
+ jobs:
20
+ build:
21
+ name: Build tagged release artifacts
22
+ runs-on: ubuntu-latest
23
+ services:
24
+ postgres:
25
+ image: public.ecr.aws/docker/library/postgres:16
26
+ env:
27
+ POSTGRES_DB: chronem_distribution
28
+ POSTGRES_USER: chronem
29
+ POSTGRES_PASSWORD: chronem_distribution_password
30
+ ports:
31
+ - 5432:5432
32
+ options: >-
33
+ --health-cmd "pg_isready -U chronem -d chronem_distribution"
34
+ --health-interval 5s
35
+ --health-timeout 5s
36
+ --health-retries 10
37
+ env:
38
+ CHRONEM_DISTRIBUTION_DATABASE_URL: postgresql+psycopg://chronem:chronem_distribution_password@127.0.0.1:5432/chronem_distribution
39
+ steps:
40
+ - name: Check out release tag
41
+ uses: actions/checkout@v7
42
+ with:
43
+ ref: ${{ inputs.tag }}
44
+ fetch-depth: 0
45
+
46
+ - name: Set up Python 3.12
47
+ uses: actions/setup-python@v7
48
+ with:
49
+ python-version: "3.12"
50
+ cache: pip
51
+
52
+ - name: Validate tag, version, and changelog
53
+ env:
54
+ RELEASE_TAG: ${{ inputs.tag }}
55
+ run: python scripts/validate_release_tag.py "$RELEASE_TAG"
56
+
57
+ - name: Build and validate distributions
58
+ uses: ./.github/actions/validate-distribution
59
+
60
+ - name: Upload validated release artifacts
61
+ uses: actions/upload-artifact@v7
62
+ with:
63
+ name: python-release-${{ inputs.tag }}
64
+ path: dist/
65
+ if-no-files-found: error
66
+ retention-days: 30
67
+
68
+ publish:
69
+ name: Publish to PyPI with trusted publishing
70
+ if: ${{ inputs.publish }}
71
+ needs: build
72
+ runs-on: ubuntu-latest
73
+ environment:
74
+ name: pypi
75
+ url: https://pypi.org/project/chronem/
76
+ permissions:
77
+ contents: read
78
+ id-token: write
79
+ steps:
80
+ - name: Download validated release artifacts
81
+ uses: actions/download-artifact@v8
82
+ with:
83
+ name: python-release-${{ inputs.tag }}
84
+ path: dist/
85
+
86
+ - name: Publish distributions
87
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,220 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ *.lcov
51
+ .hypothesis/
52
+ .pytest_cache/
53
+ cover/
54
+
55
+ # Translations
56
+ *.mo
57
+ *.pot
58
+
59
+ # Django stuff:
60
+ *.log
61
+ local_settings.py
62
+ db.sqlite3
63
+ db.sqlite3-journal
64
+
65
+ # Flask stuff:
66
+ instance/
67
+ .webassets-cache
68
+
69
+ # Scrapy stuff:
70
+ .scrapy
71
+
72
+ # Sphinx documentation
73
+ docs/_build/
74
+
75
+ # PyBuilder
76
+ .pybuilder/
77
+ target/
78
+
79
+ # Jupyter Notebook
80
+ .ipynb_checkpoints
81
+
82
+ # IPython
83
+ profile_default/
84
+ ipython_config.py
85
+
86
+ # pyenv
87
+ # For a library or package, you might want to ignore these files since the code is
88
+ # intended to run in multiple environments; otherwise, check them in:
89
+ # .python-version
90
+
91
+ # pipenv
92
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
93
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
94
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
95
+ # install all needed dependencies.
96
+ # Pipfile.lock
97
+
98
+ # uv
99
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
100
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
101
+ # commonly ignored for libraries.
102
+ # uv.lock
103
+
104
+ # poetry
105
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
106
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
107
+ # commonly ignored for libraries.
108
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
109
+ # poetry.lock
110
+ # poetry.toml
111
+
112
+ # pdm
113
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
114
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
115
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
116
+ # pdm.lock
117
+ # pdm.toml
118
+ .pdm-python
119
+ .pdm-build/
120
+
121
+ # pixi
122
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
123
+ # pixi.lock
124
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
125
+ # in the .venv directory. It is recommended not to include this directory in version control.
126
+ .pixi/*
127
+ !.pixi/config.toml
128
+
129
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
130
+ __pypackages__/
131
+
132
+ # Celery stuff
133
+ celerybeat-schedule*
134
+ celerybeat.pid
135
+
136
+ # Redis
137
+ *.rdb
138
+ *.aof
139
+ *.pid
140
+
141
+ # RabbitMQ
142
+ mnesia/
143
+ rabbitmq/
144
+ rabbitmq-data/
145
+
146
+ # ActiveMQ
147
+ activemq-data/
148
+
149
+ # SageMath parsed files
150
+ *.sage.py
151
+
152
+ # Environments
153
+ .env
154
+ .envrc
155
+ .venv
156
+ env/
157
+ venv/
158
+ ENV/
159
+ env.bak/
160
+ venv.bak/
161
+
162
+ # Spyder project settings
163
+ .spyderproject
164
+ .spyproject
165
+
166
+ # Rope project settings
167
+ .ropeproject
168
+
169
+ # mkdocs/Zensical documentation
170
+ /site
171
+
172
+ # mypy
173
+ .mypy_cache/
174
+ .dmypy.json
175
+ dmypy.json
176
+
177
+ # Pyre type checker
178
+ .pyre/
179
+
180
+ # pytype static type analyzer
181
+ .pytype/
182
+
183
+ # Cython debug symbols
184
+ cython_debug/
185
+
186
+ # PyCharm
187
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
188
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
189
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
190
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
191
+ # .idea/
192
+
193
+ # Abstra
194
+ # Abstra is an AI-powered process automation framework.
195
+ # Ignore directories containing user credentials, local state, and settings.
196
+ # Learn more at https://abstra.io/docs
197
+ .abstra/
198
+
199
+ # Visual Studio Code
200
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore that
201
+ # can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
202
+ # and can be added to the global gitignore or merged into this file. However, if you prefer, you
203
+ # could uncomment the following to ignore the entire vscode folder
204
+ # .vscode/
205
+ # Temporary file for partial code execution
206
+ tempCodeRunnerFile.py
207
+
208
+ # Ruff stuff:
209
+ .ruff_cache/
210
+
211
+ # PyPI configuration file
212
+ .pypirc
213
+
214
+ # Marimo
215
+ marimo/_static/
216
+ marimo/_lsp/
217
+ __marimo__/
218
+
219
+ # Streamlit
220
+ .streamlit/secrets.toml
@@ -0,0 +1,132 @@
1
+ # Shared Agent Instructions
2
+
3
+ This is the canonical engineering entrypoint for every AI agent working in
4
+ Chronem, including Codex and Cursor. Tool-specific files may point here, but must
5
+ not maintain a separate copy of project semantics.
6
+
7
+ Chronem is the current project name. Issue #38 records the naming decision, and
8
+ Issue #39 performs the clean pre-v0.1.0 rename with no legacy import package.
9
+
10
+ ## Read before implementation
11
+
12
+ Use this source-of-truth order:
13
+
14
+ 1. The linked GitHub Issue: task scope and acceptance criteria.
15
+ 2. This file: shared engineering and workflow rules.
16
+ 3. [Open-source plan](docs/open-source-plan.md): strategic North Star, current
17
+ growth phase, direction changes, and adoption/release priorities.
18
+ 4. [Architecture](docs/architecture.md): current boundaries and invariants.
19
+ 5. [Accepted decisions](docs/decisions/README.md): durable decisions that must
20
+ not be silently revisited.
21
+ 6. [Product requirements](docs/product-requirements.md): established product
22
+ requirements and MVP boundaries.
23
+ 7. [Roadmap](docs/roadmap.md): technical/project phase ordering and intended
24
+ outcomes.
25
+ 8. [Project status](docs/project-status.md): current implementation and review
26
+ state.
27
+ 9. Tool-specific entrypoints such as `.cursor/rules/*.mdc`.
28
+
29
+ Also read the current sprint specification when the Issue or project status
30
+ links one. If these sources conflict, stop and surface the contradiction to the
31
+ maintainer/architect. Do not guess or silently change architecture.
32
+
33
+ ## Scope and workflow
34
+
35
+ - Treat the GitHub Issue as the task-specific source of truth, within accepted
36
+ architecture and product decisions.
37
+ - Implement only the Issue. Do not add adjacent features, infrastructure, or
38
+ dependencies without explicit authorization.
39
+ - Never do feature work directly on `main`; use a focused branch and PR.
40
+ - Follow the review and repair lifecycle in
41
+ [Development workflow](docs/development-workflow.md).
42
+ - An implementation agent must not mark its own work reviewed or approved.
43
+
44
+ ## Architecture boundaries
45
+
46
+ Chronem is a reusable temporal personal-memory engine, not a generic notes app or
47
+ a thin RAG wrapper. The consumer product is a separate layer.
48
+
49
+ The hard boundary is:
50
+
51
+ > Probabilistic systems interpret language. Deterministic code controls memory
52
+ > lifecycle and persistence decisions.
53
+
54
+ Extractors may propose candidate memories. They must not directly persist,
55
+ delete, supersede, complete, cancel, expire, or otherwise bypass deterministic
56
+ domain rules. The five top-level memory kinds are `FACT`, `PREFERENCE`,
57
+ `CURRENT_STATE`, `EVENT`, and `INTENT`.
58
+
59
+ Do not change lifecycle semantics, add a memory kind, or cross an accepted
60
+ boundary without explicit Issue scope and an update or addition under
61
+ `docs/decisions/`. See [Architecture](docs/architecture.md) for the complete
62
+ invariants.
63
+
64
+ ## Correctness, security, and privacy
65
+
66
+ Use this priority order when tradeoffs conflict:
67
+
68
+ 1. user data correctness and safety;
69
+ 2. deterministic memory semantics;
70
+ 3. preservation of history and provenance;
71
+ 4. testability;
72
+ 5. simple public API;
73
+ 6. performance;
74
+ 7. implementation convenience.
75
+
76
+ User isolation is a domain invariant, not only a higher-layer concern. Any
77
+ operation that receives another user's memory must fail closed rather than
78
+ silently filter it. Never commit secrets, credentials, local environment files,
79
+ or real personal user data.
80
+
81
+ Prefer no answer to an unsupported personal claim. Preserve capture provenance,
82
+ semantic time, and historical records unless explicit deletion requirements say
83
+ otherwise.
84
+
85
+ ## Code and test conventions
86
+
87
+ - Python 3.11 or newer; maintain Python 3.11 and 3.12 CI compatibility.
88
+ - Pydantic v2 and full annotations on public interfaces.
89
+ - Keep the domain independent of web frameworks, model providers, databases,
90
+ vector stores, and network calls.
91
+ - Prefer small pure functions, explicit transitions, and no hidden side effects.
92
+ - Use timezone-aware datetimes, preferably UTC internally.
93
+ - Do not use mutable default arguments, broad exception swallowing, or
94
+ unexplained type ignores.
95
+ - Add behavior tests for behavior changes; favor sequence tests for lifecycle
96
+ behavior.
97
+ - Do not weaken lint, typing, or coverage settings to make a change pass.
98
+
99
+ Before declaring implementation complete, run:
100
+
101
+ ```bash
102
+ ruff check .
103
+ mypy src
104
+ pytest --cov=chronem --cov-report=term-missing
105
+ coverage report --include="*/chronem/lifecycle/*" --fail-under=90
106
+ ```
107
+
108
+ Fix failures rather than bypassing a gate. CI exposes the stable checks
109
+ `Quality gates (Python 3.11)` and `Quality gates (Python 3.12)`.
110
+
111
+ ## Documentation responsibilities
112
+
113
+ Keep durable context in the repository, not only in chat:
114
+
115
+ - update `docs/architecture.md` when the current architecture changes;
116
+ - add or update an ADR when an accepted architecture decision changes;
117
+ - update `docs/product-requirements.md` only with maintainer-approved product
118
+ requirement changes;
119
+ - update `docs/open-source-plan.md` when the open-source strategy, growth
120
+ phase, milestone interpretation, or major direction changes;
121
+ - update `docs/roadmap.md` when phase sequencing or outcomes change;
122
+ - update `docs/project-status.md` when implementation or review state changes;
123
+ - update tests and user/developer documentation affected by the change.
124
+
125
+ Unknown future choices must be marked `TBD` instead of guessed. Preserve useful
126
+ history when moving documentation and repair every affected reference.
127
+
128
+ ## Dependency policy
129
+
130
+ Keep the core lightweight. Before adding a dependency, identify the concrete
131
+ problem, confirm the standard library/current dependencies do not solve it, and
132
+ avoid coupling domain semantics to infrastructure.