mneme-cli 0.5.2__tar.gz → 0.5.3__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 (50) hide show
  1. {mneme_cli-0.5.2 → mneme_cli-0.5.3}/AGENTS.md +254 -1
  2. {mneme_cli-0.5.2 → mneme_cli-0.5.3}/CHANGELOG.md +20 -0
  3. {mneme_cli-0.5.2 → mneme_cli-0.5.3}/PKG-INFO +1 -1
  4. {mneme_cli-0.5.2 → mneme_cli-0.5.3}/mneme/__init__.py +1 -1
  5. {mneme_cli-0.5.2 → mneme_cli-0.5.3}/CLAUDE.md +0 -0
  6. {mneme_cli-0.5.2 → mneme_cli-0.5.3}/CODER.md +0 -0
  7. {mneme_cli-0.5.2 → mneme_cli-0.5.3}/EXAMPLES.md +0 -0
  8. {mneme_cli-0.5.2 → mneme_cli-0.5.3}/FEATURES.md +0 -0
  9. {mneme_cli-0.5.2 → mneme_cli-0.5.3}/LICENSE +0 -0
  10. {mneme_cli-0.5.2 → mneme_cli-0.5.3}/MANIFEST.in +0 -0
  11. {mneme_cli-0.5.2 → mneme_cli-0.5.3}/README.md +0 -0
  12. {mneme_cli-0.5.2 → mneme_cli-0.5.3}/mneme/__main__.py +0 -0
  13. {mneme_cli-0.5.2 → mneme_cli-0.5.3}/mneme/config.py +0 -0
  14. {mneme_cli-0.5.2 → mneme_cli-0.5.3}/mneme/core.py +0 -0
  15. {mneme_cli-0.5.2 → mneme_cli-0.5.3}/mneme/profiles/eu-mdr.md +0 -0
  16. {mneme_cli-0.5.2 → mneme_cli-0.5.3}/mneme/profiles/iso-13485.md +0 -0
  17. {mneme_cli-0.5.2 → mneme_cli-0.5.3}/mneme/profiles/mappings/dds.json +0 -0
  18. {mneme_cli-0.5.2 → mneme_cli-0.5.3}/mneme/profiles/mappings/requirements.json +0 -0
  19. {mneme_cli-0.5.2 → mneme_cli-0.5.3}/mneme/profiles/mappings/risk-register.json +0 -0
  20. {mneme_cli-0.5.2 → mneme_cli-0.5.3}/mneme/profiles/mappings/test-cases.json +0 -0
  21. {mneme_cli-0.5.2 → mneme_cli-0.5.3}/mneme/profiles/mappings/user-needs.json +0 -0
  22. {mneme_cli-0.5.2 → mneme_cli-0.5.3}/mneme/search.py +0 -0
  23. {mneme_cli-0.5.2 → mneme_cli-0.5.3}/mneme/server.py +0 -0
  24. {mneme_cli-0.5.2 → mneme_cli-0.5.3}/mneme/templates/workspace/.gitignore +0 -0
  25. {mneme_cli-0.5.2 → mneme_cli-0.5.3}/mneme/templates/workspace/AGENTS.md +0 -0
  26. {mneme_cli-0.5.2 → mneme_cli-0.5.3}/mneme/templates/workspace/README.md +0 -0
  27. {mneme_cli-0.5.2 → mneme_cli-0.5.3}/mneme/templates/workspace/inbox/.gitkeep +0 -0
  28. {mneme_cli-0.5.2 → mneme_cli-0.5.3}/mneme/templates/workspace/index.md +0 -0
  29. {mneme_cli-0.5.2 → mneme_cli-0.5.3}/mneme/templates/workspace/log.md +0 -0
  30. {mneme_cli-0.5.2 → mneme_cli-0.5.3}/mneme/templates/workspace/profiles/README.md +0 -0
  31. {mneme_cli-0.5.2 → mneme_cli-0.5.3}/mneme/templates/workspace/profiles/mappings/.gitkeep +0 -0
  32. {mneme_cli-0.5.2 → mneme_cli-0.5.3}/mneme/templates/workspace/schema/entities.json +0 -0
  33. {mneme_cli-0.5.2 → mneme_cli-0.5.3}/mneme/templates/workspace/schema/graph.json +0 -0
  34. {mneme_cli-0.5.2 → mneme_cli-0.5.3}/mneme/templates/workspace/schema/tags.json +0 -0
  35. {mneme_cli-0.5.2 → mneme_cli-0.5.3}/mneme/templates/workspace/sources/.gitkeep +0 -0
  36. {mneme_cli-0.5.2 → mneme_cli-0.5.3}/mneme/templates/workspace/wiki/_templates/page.md +0 -0
  37. {mneme_cli-0.5.2 → mneme_cli-0.5.3}/mneme/ui.html +0 -0
  38. {mneme_cli-0.5.2 → mneme_cli-0.5.3}/mneme_cli.egg-info/SOURCES.txt +0 -0
  39. {mneme_cli-0.5.2 → mneme_cli-0.5.3}/pyproject.toml +0 -0
  40. {mneme_cli-0.5.2 → mneme_cli-0.5.3}/setup.cfg +0 -0
  41. {mneme_cli-0.5.2 → mneme_cli-0.5.3}/tests/__init__.py +0 -0
  42. {mneme_cli-0.5.2 → mneme_cli-0.5.3}/tests/test_agent_loop.py +0 -0
  43. {mneme_cli-0.5.2 → mneme_cli-0.5.3}/tests/test_bug_regressions.py +0 -0
  44. {mneme_cli-0.5.2 → mneme_cli-0.5.3}/tests/test_core.py +0 -0
  45. {mneme_cli-0.5.2 → mneme_cli-0.5.3}/tests/test_ingest_csv.py +0 -0
  46. {mneme_cli-0.5.2 → mneme_cli-0.5.3}/tests/test_profile.py +0 -0
  47. {mneme_cli-0.5.2 → mneme_cli-0.5.3}/tests/test_schema_search.py +0 -0
  48. {mneme_cli-0.5.2 → mneme_cli-0.5.3}/tests/test_search.py +0 -0
  49. {mneme_cli-0.5.2 → mneme_cli-0.5.3}/tests/test_tornado_lint.py +0 -0
  50. {mneme_cli-0.5.2 → mneme_cli-0.5.3}/tests/test_trace.py +0 -0
@@ -705,7 +705,260 @@ Hard rules:
705
705
  - Never rewrite a DDS page's body to embed the code link. The link
706
706
  lives in `schema/traceability.json` only. Wiki pages stay prose.
707
707
 
708
- ### 6.7 Pre-submission readiness check before sending to a notified body
708
+ ### 6.7 Ingest a code repo into the wiki as searchable module summaries
709
+
710
+ The user has handed you a code repo. Your job is to produce one wiki page
711
+ per logical module so future agents can answer "how does this codebase do
712
+ X?" through `mneme search` instead of re-reading the source.
713
+
714
+ This is the foundation for any later code-aware work (style-matched
715
+ extension, refactor planning, gap analysis). It does not modify the repo —
716
+ read-only ingestion.
717
+
718
+ ```
719
+ 1. Walk <REPO_PATH>. Skip: .git, node_modules, .venv, dist, build,
720
+ __pycache__, anything in .gitignore.
721
+
722
+ 2. Group files into logical modules. Heuristics:
723
+ - A directory containing __init__.py / mod.rs / index.ts / mod.go
724
+ is one module.
725
+ - A standalone script with no siblings is one module.
726
+ - Tests (tests/ or *_test.* alongside) are part of the module they
727
+ test, not separate modules.
728
+
729
+ 3. For each module, write a summary file at
730
+ /tmp/mneme-summaries/<module-path>.md
731
+ with this exact frontmatter and section structure:
732
+
733
+ ---
734
+ title: <Module Name>
735
+ type: code-summary
736
+ client: <CLIENT_SLUG>
737
+ sources:
738
+ - <repo-relative path of every file in the module>
739
+ tags:
740
+ - code
741
+ - <language>
742
+ - <one-or-two-domain-tags>
743
+ ---
744
+
745
+ ## Purpose
746
+ One paragraph in plain English. No code.
747
+
748
+ ## Public API
749
+ List of exported functions / classes / types, one line each.
750
+ Format: `name(args) -> return_type` then a sentence.
751
+
752
+ ## Key data structures
753
+ Non-trivial types or schemas this module owns. Skip if none.
754
+
755
+ ## Dependencies
756
+ - Internal: which other modules in this repo it imports
757
+ - External: which libraries (with pinned version if any)
758
+
759
+ ## Tests
760
+ Path to test file(s) + one sentence on coverage shape.
761
+
762
+ ## Conventions observed
763
+ 3-5 bullets: error style, async/sync, naming, comment density, etc.
764
+
765
+ 4. For files too large to read in one pass:
766
+ a. Read the first 200 lines.
767
+ b. Read the last 100 lines.
768
+ c. If the file has a clear table-of-contents (a __all__, an exports
769
+ block, a class index near the top), use it to guide which middle
770
+ sections to read in additional 200-line chunks.
771
+ d. State in the summary's Purpose section that this was a partial
772
+ read, and tag the page `partial-read` so a future pass can
773
+ revisit.
774
+
775
+ 5. Ingest the summaries in one pass:
776
+ mneme ingest-dir /tmp/mneme-summaries <CLIENT_SLUG> --recursive --flat
777
+
778
+ Use --flat: the summaries already encode their path in the slug, and
779
+ they don't live under sources/<CLIENT_SLUG>/ so subpath auto-detection
780
+ won't help.
781
+
782
+ 6. Smoke-test:
783
+ mneme stats
784
+ mneme search "<a real concept from the repo>" --client <CLIENT_SLUG>
785
+ mneme tags list
786
+ ```
787
+
788
+ Stop conditions: every module in the repo (modulo the skip list) has a
789
+ wiki summary, and a search for a known concept returns the right module.
790
+
791
+ Hard rules:
792
+ - Do not generate summaries for files you did not actually read. Partial
793
+ reads must be tagged `partial-read` in the page's frontmatter.
794
+ - Do not speculate. If a module's purpose is unclear from the code, write
795
+ "unclear, needs human review" and tag the page `needs-review`.
796
+ - Do not modify the repo. Read-only.
797
+ - Keep summaries under 300 lines. They are pointers, not replacements.
798
+ - One module = one wiki page. Do not split a module across pages, and
799
+ do not merge unrelated modules into one page.
800
+
801
+ Report when done: total modules summarized, count tagged `partial-read`,
802
+ count tagged `needs-review`, directories skipped and why, and the three
803
+ search queries you used to verify the ingest.
804
+
805
+ ### 6.8 Augment a wiki page with knowledge from ingested code summaries
806
+
807
+ Pre-condition: 6.7 has run, so the repo is in the wiki as `code-summary`
808
+ pages. You now have a target wiki page (sparse, half-finished, or
809
+ explicitly marked TBD) and you want to enrich it with sections that
810
+ draw on the code knowledge — in the page's existing voice, with every
811
+ claim cited.
812
+
813
+ This is selective augment, not regeneration. Existing prose is sacred.
814
+
815
+ ```
816
+ 1. Read the target page in full at <WORKSPACE>/wiki/<client>/<page>.md.
817
+ Note: existing tone, sentence length, citation density, heading depth,
818
+ table-of-contents shape. These define the local style you must match.
819
+
820
+ 2. Decide what to add. Two paths:
821
+ a. Human-driven: the user told you "add a Performance Characteristics
822
+ section drawing latency data from the codebase." Skip to step 3.
823
+ b. Agent-driven: gap analysis. Compare the target's actual sections
824
+ against (i) the active profile's expected sections for this
825
+ doc-type (run `mneme profile show`), and (ii) topics covered by
826
+ code-summary pages that the target does not cite. Propose 1-5
827
+ candidate sections to the human and wait for confirmation. Do not
828
+ add sections without confirmation.
829
+
830
+ 3. For each agreed section, gather evidence:
831
+ mneme search "<topic keywords>" --client <client> -k 20
832
+ Prefer hits with the `code` tag for implementation details. Prefer
833
+ regulatory wiki pages for context and definitions. Read the top hits
834
+ in full before writing.
835
+
836
+ 4. Draft the section. Hard requirements:
837
+ - Match the target's local style. Local consistency wins over the
838
+ active profile's global rules within a single page.
839
+ - Every non-trivial claim cites its source as
840
+ `(wiki: <client>/<page>)` or `(source: <repo-relative-path>)`.
841
+ - When evidence is insufficient for a claim, do not invent it.
842
+ Insert `[TO ADD REF]` and continue.
843
+
844
+ 5. Insert at the structurally correct location. Read the target's TOC.
845
+ The new section's heading depth and ordering must follow the
846
+ document's own logic, not your intuition.
847
+
848
+ 6. Update the target's frontmatter:
849
+ - Append every newly cited source to the `sources:` list.
850
+ - Bump `updated:` to today.
851
+ - If the page was previously marked draft / TBD and is now complete,
852
+ update `confidence:` accordingly.
853
+
854
+ 7. Re-ingest the target so search picks up the new content. Two options:
855
+ a. If the page has a corresponding source file in sources/<client>/,
856
+ mirror your wiki edits back to it and run:
857
+ mneme resync sources/<client>/<path-to-source> <client>
858
+ b. Otherwise, edit the wiki page directly and run:
859
+ mneme reindex
860
+ ```
861
+
862
+ Stop conditions: every agreed section is either (a) written with full
863
+ citations, or (b) explicitly flagged as evidence-insufficient and
864
+ reported back to the human. The page passes
865
+ `mneme validate writing-style <client>/<page>` against the active
866
+ profile.
867
+
868
+ Hard rules:
869
+ - Do NOT rewrite existing prose. Augment only — add new sections, do not
870
+ edit current ones unless explicitly asked.
871
+ - Do NOT fabricate citations. Every `(wiki: ...)` and `(source: ...)`
872
+ reference must resolve to an actual page or file.
873
+ - Do NOT exceed the human-confirmed scope. If gap analysis surfaced 5
874
+ candidate sections and the human approved 2, write only those 2.
875
+ - Do NOT touch the page's frontmatter `created:` or `client:` fields.
876
+
877
+ Report when done: sections added (with line counts), sources cited
878
+ (deduplicated list), any sections you were asked to write but skipped
879
+ because evidence was insufficient (with a one-line explanation per skip),
880
+ and the result of the post-edit `mneme validate writing-style` run.
881
+
882
+ ### 6.9 Validate a claim against the literature wiki
883
+
884
+ You are about to write or have already written a factual claim in a
885
+ deliverable (DVR, CER, technical documentation, etc.). Before the
886
+ claim ships to a notified body, it must be backed by an authoritative
887
+ source — or explicitly carry `[TO ADD REF]` so the gap is visible.
888
+
889
+ Pre-condition: the relevant literature has been ingested into the wiki
890
+ (typically under `research-questions/` or similar) and tagged with
891
+ `literature` plus an authority marker (`authority` / `non-authority`).
892
+ If those tags don't exist, run a one-time `mneme tags bulk-suggest` /
893
+ `bulk-apply` pass to add them — see Step 3 in the README.
894
+
895
+ ```
896
+ 1. Identify the claim. Reduce it to its load-bearing assertion.
897
+ "Parkinsonian tremor manifests primarily in the 4-6 Hz band" is a
898
+ claim. "Tremor is a problem" is not — too vague to validate.
899
+
900
+ 2. Search the literature for evidence. Be specific in the query:
901
+ mneme search "<claim keywords>" --client <client> -k 30
902
+ When `mneme search --tag` is available (planned), prefer:
903
+ mneme search "<claim keywords>" --client <client> --tag authority -k 20
904
+
905
+ 3. Read the top hits in full. Sort the relevant ones into three buckets:
906
+ a. AUTHORITY supports the claim (peer-reviewed, recent, on-topic)
907
+ b. NON-AUTHORITY supports the claim (preprints, blog posts, secondary)
908
+ c. Nothing relevant, or hits contradict the claim
909
+
910
+ 4. Decide based on the bucket:
911
+
912
+ a. AUTHORITY support
913
+ -> Write the claim with the citation:
914
+ "...4-6 Hz band (wiki: <client>/research-questions/.../<page>)."
915
+ -> Append the cited page to the deliverable's frontmatter
916
+ `sources:` list if not already present.
917
+
918
+ b. NON-AUTHORITY support only
919
+ -> Either soften the claim ("Preliminary reports suggest..."),
920
+ OR keep the strong form with [TO ADD REF] and find an
921
+ authority source separately.
922
+ -> Do NOT cite a non-authority source as if it were authoritative.
923
+
924
+ c. No support / contradicting evidence
925
+ -> Three options, in order of preference:
926
+ i. Drop the claim. The deliverable doesn't need it.
927
+ ii. Find a new authority source. Drop the PDF into
928
+ sources/<client>/<literature-path>/, summarize and ingest
929
+ it (run a single-page version of 6.7), then return to step 2.
930
+ iii. Keep the claim but mark it [TO ADD REF] AND open a
931
+ tracked TODO so the gap doesn't ship by accident.
932
+
933
+ 5. After resolving the claim (or marking it), run:
934
+ mneme validate writing-style <client>/<deliverable-page>
935
+ The review packet flags every remaining [TO ADD REF] and every
936
+ uncited factual claim. Address them or hand the page back to the
937
+ human reviewer with the gaps surfaced.
938
+ ```
939
+
940
+ Stop conditions: the claim is either (a) cited with an authority
941
+ source, (b) softened to match the strength of the available evidence,
942
+ (c) dropped, or (d) explicitly marked `[TO ADD REF]` AND tracked for
943
+ follow-up. Never (e) cited with fabricated or non-authoritative
944
+ evidence dressed as authoritative.
945
+
946
+ Hard rules:
947
+ - Do NOT cite a wiki page you did not read. Read every page you cite.
948
+ - Do NOT cite a non-authority source as `(wiki: ...)` without making
949
+ its non-authority status visible in the surrounding prose.
950
+ - Do NOT silently weaken or rewrite the claim to dodge the citation
951
+ requirement. If the evidence is weak, say so.
952
+ - Do NOT bulk-clear `[TO ADD REF]` markers without going through this
953
+ procedure for each one. Each marker is a discrete claim that needs
954
+ individual evidence.
955
+
956
+ Report when done: the original claim, the final form of the claim
957
+ (verbatim if changed), the citation added (or the [TO ADD REF] marker
958
+ left in place), the wiki pages read, and a one-line note on whether
959
+ this gap should be tracked for human follow-up.
960
+
961
+ ### 6.10 Pre-submission readiness check before sending to a notified body
709
962
 
710
963
  ```
711
964
  1. mneme profile show # confirm active profile
@@ -48,6 +48,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
48
48
  linking DDS to codebase and tests" gives the exact procedure, stop
49
49
  conditions, and hard rules (no fabricated paths, trace targets are
50
50
  opaque strings, never embed code links in page bodies).
51
+ ## [0.5.3] - 2026-04-15
52
+
53
+ ### Documentation
54
+
55
+ - **AGENTS.md**: new task template 6.7 "Ingest a code repo into the
56
+ wiki as searchable module summaries" — the foundation for any
57
+ code-aware agent work. One wiki page per logical module, chunked
58
+ reading for large files, explicit tagging for partial/unclear pages,
59
+ and `mneme ingest-dir --flat` for the bulk write.
60
+ - **AGENTS.md**: new task template 6.8 "Augment a wiki page with
61
+ knowledge from ingested code summaries" — selective enrichment of a
62
+ target page using evidence drawn from the code summaries produced by
63
+ 6.7. Existing prose is sacred; agent only adds new sections, in the
64
+ page's local style, with every claim cited.
65
+ - **AGENTS.md**: new task template 6.9 "Validate a claim against the
66
+ literature wiki" — the discipline an agent applies before any
67
+ factual claim ships to a notified body. Three buckets (authority /
68
+ non-authority / no support), four resolutions (cite / soften / drop /
69
+ mark `[TO ADD REF]`), zero tolerance for non-authority dressed as
70
+ authoritative.
51
71
 
52
72
  ## [0.5.0] - 2026-04-13
53
73
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mneme-cli
3
- Version: 0.5.2
3
+ Version: 0.5.3
4
4
  Summary: mneme - CLI tool that turns documents into a searchable second brain. Ingest once, query forever.
5
5
  Author-email: Tolis Moustaklis <apostolos.moustaklis@gmail.com>
6
6
  License-Expression: MIT
@@ -5,4 +5,4 @@ Public API:
5
5
  from mneme.core import ingest_source_to_both, dual_search, ...
6
6
  """
7
7
 
8
- __version__ = "0.5.2"
8
+ __version__ = "0.5.3"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes