gdk9-cli 0.3.0__tar.gz → 0.4.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 (93) hide show
  1. gdk9_cli-0.4.0/PKG-INFO +138 -0
  2. gdk9_cli-0.4.0/README.md +102 -0
  3. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/gdk9/__init__.py +1 -1
  4. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/gdk9/cli.py +7 -10
  5. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/gdk9/egglog_bridge/dr_egglog.py +1 -1
  6. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/gdk9/imply.py +1 -1
  7. gdk9_cli-0.4.0/gdk9/keysuite_bridge/__init__.py +7 -0
  8. gdk9_cli-0.4.0/gdk9/keysuite_bridge/compose.py +35 -0
  9. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/gdk9/optimize.py +0 -1
  10. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/gdk9/plugins/__init__.py +3 -1
  11. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/gdk9/plugins/loader.py +1 -1
  12. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/gdk9/plugins/registry.py +1 -1
  13. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/gdk9/subs.py +1 -1
  14. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/gdk9/tokenize.py +1 -1
  15. gdk9_cli-0.4.0/gdk9_cli.egg-info/PKG-INFO +138 -0
  16. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/gdk9_cli.egg-info/SOURCES.txt +3 -22
  17. gdk9_cli-0.4.0/gdk9_cli.egg-info/top_level.txt +1 -0
  18. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/pyproject.toml +9 -2
  19. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/tests/test_dcg.py +0 -1
  20. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/tests/test_plugins.py +1 -2
  21. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/tests/test_rules.py +1 -1
  22. gdk9_cli-0.3.0/PKG-INFO +0 -295
  23. gdk9_cli-0.3.0/README.md +0 -259
  24. gdk9_cli-0.3.0/examples/01_analyze.py +0 -28
  25. gdk9_cli-0.3.0/examples/02_profile.py +0 -24
  26. gdk9_cli-0.3.0/examples/03_assign.py +0 -19
  27. gdk9_cli-0.3.0/examples/04_dcg.py +0 -41
  28. gdk9_cli-0.3.0/examples/05_tokenize.py +0 -22
  29. gdk9_cli-0.3.0/examples/06_synthesize.py +0 -20
  30. gdk9_cli-0.3.0/examples/07_api.py +0 -57
  31. gdk9_cli-0.3.0/examples/08_kernel.py +0 -35
  32. gdk9_cli-0.3.0/examples/09_kernel_search_walkthrough.py +0 -102
  33. gdk9_cli-0.3.0/examples/10_conserve_vs_naive.py +0 -100
  34. gdk9_cli-0.3.0/gdk9_cli.egg-info/PKG-INFO +0 -295
  35. gdk9_cli-0.3.0/gdk9_cli.egg-info/top_level.txt +0 -7
  36. gdk9_cli-0.3.0/scripts/batch_analyze.py +0 -109
  37. gdk9_cli-0.3.0/scripts/export_json.py +0 -125
  38. gdk9_cli-0.3.0/scripts/make_zip.py +0 -57
  39. gdk9_cli-0.3.0/scripts/profile_compare.py +0 -165
  40. gdk9_cli-0.3.0/scripts/watch_file.py +0 -124
  41. gdk9_cli-0.3.0/tests/conftest.py +0 -26
  42. gdk9_cli-0.3.0/tests/experiment/__init__.py +0 -1
  43. gdk9_cli-0.3.0/tests/experiment/test_conserve_vs_naive.py +0 -287
  44. gdk9_cli-0.3.0/tests/kernel/test_kernel_energy.py +0 -18
  45. gdk9_cli-0.3.0/tests/kernel/test_kernel_rules.py +0 -58
  46. gdk9_cli-0.3.0/tests/kernel/test_kernel_search_bound.py +0 -34
  47. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/LICENSE +0 -0
  48. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/gdk9/ansi.py +0 -0
  49. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/gdk9/crdt.py +0 -0
  50. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/gdk9/crypto.py +0 -0
  51. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/gdk9/data/ninefold.json +0 -0
  52. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/gdk9/data/official.example.json +0 -0
  53. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/gdk9/data/official.json +0 -0
  54. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/gdk9/data/subs.json +0 -0
  55. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/gdk9/dcg.py +0 -0
  56. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/gdk9/egglog_bridge/__init__.py +0 -0
  57. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/gdk9/egglog_bridge/fallback.py +0 -0
  58. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/gdk9/energy.py +0 -0
  59. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/gdk9/errors.py +0 -0
  60. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/gdk9/fmt.py +0 -0
  61. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/gdk9/io_utils.py +0 -0
  62. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/gdk9/kernel/__init__.py +0 -0
  63. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/gdk9/kernel/engine.py +0 -0
  64. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/gdk9/kernel/errors.py +0 -0
  65. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/gdk9/kernel/expression.py +0 -0
  66. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/gdk9/kernel/principle.py +0 -0
  67. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/gdk9/kernel/proof.py +0 -0
  68. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/gdk9/kernel/rule.py +0 -0
  69. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/gdk9/kernel/symbol.py +0 -0
  70. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/gdk9/kernel_cli.py +0 -0
  71. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/gdk9/log.py +0 -0
  72. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/gdk9/parser.py +0 -0
  73. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/gdk9/principles.py +0 -0
  74. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/gdk9/saturate.py +0 -0
  75. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/gdk9/state.py +0 -0
  76. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/gdk9/tui.py +0 -0
  77. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/gdk9/utilization.py +0 -0
  78. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/gdk9_cli.egg-info/dependency_links.txt +0 -0
  79. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/gdk9_cli.egg-info/entry_points.txt +0 -0
  80. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/gdk9_cli.egg-info/requires.txt +0 -0
  81. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/setup.cfg +0 -0
  82. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/tests/test_crypto.py +0 -0
  83. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/tests/test_crypto_secure.py +0 -0
  84. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/tests/test_dcg_golden.py +0 -0
  85. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/tests/test_egglog_bridge.py +0 -0
  86. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/tests/test_energy.py +0 -0
  87. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/tests/test_kernel_cli_handbook.py +0 -0
  88. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/tests/test_optimize.py +0 -0
  89. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/tests/test_rules_commit.py +0 -0
  90. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/tests/test_rules_reversibility.py +0 -0
  91. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/tests/test_state_crdt.py +0 -0
  92. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/tests/test_tokenize.py +0 -0
  93. {gdk9_cli-0.3.0 → gdk9_cli-0.4.0}/tests/test_tokenize_metrics.py +0 -0
@@ -0,0 +1,138 @@
1
+ Metadata-Version: 2.4
2
+ Name: gdk9-cli
3
+ Version: 0.4.0
4
+ Summary: GDk9 CLI — symbolic energy analysis, implication engine, and DCG tools
5
+ Author-email: Adam Grange <adamgrange@proton.me>
6
+ License: AGPL-3.0-or-later
7
+ Keywords: gdk9,energy,symbolic,cli,dcg,implication,numerology
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3.9
10
+ Classifier: Programming Language :: Python :: 3.10
11
+ Classifier: Programming Language :: Python :: 3.11
12
+ Classifier: Programming Language :: Python :: 3.12
13
+ Classifier: License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)
14
+ Classifier: Environment :: Console
15
+ Classifier: Topic :: Text Processing
16
+ Classifier: Topic :: Scientific/Engineering
17
+ Classifier: Topic :: Utilities
18
+ Classifier: Intended Audience :: Developers
19
+ Classifier: Intended Audience :: Science/Research
20
+ Requires-Python: >=3.9
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Provides-Extra: egglog
24
+ Requires-Dist: egglog>=13.0.0; extra == "egglog"
25
+ Provides-Extra: dev
26
+ Requires-Dist: pytest; extra == "dev"
27
+ Requires-Dist: ruff; extra == "dev"
28
+ Requires-Dist: black; extra == "dev"
29
+ Requires-Dist: pyflakes; extra == "dev"
30
+ Requires-Dist: build; extra == "dev"
31
+ Provides-Extra: build
32
+ Requires-Dist: build; extra == "build"
33
+ Provides-Extra: secure
34
+ Requires-Dist: cryptography>=42.0.0; extra == "secure"
35
+ Dynamic: license-file
36
+
37
+ # GDk9
38
+
39
+ **Symbolic energy toolkit: a zero-dependency Python CLI, the KeySuite reference runtime, and a web console for the GDk9 implication grammar.**
40
+
41
+ [![CI](https://github.com/ao3575911/gdk9/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/ao3575911/gdk9/actions/workflows/ci.yml)
42
+ [![License: AGPL-3.0](https://img.shields.io/badge/license-AGPL--3.0--or--later-blue.svg)](LICENSE)
43
+ ![Python](https://img.shields.io/badge/python-3.9%2B-blue.svg)
44
+
45
+ ![GDk9 demo](docs/img/gdk9_demo.gif)
46
+
47
+ GDk9 treats letters as energetic operators. The `gdk9` CLI analyzes, profiles,
48
+ transforms and encrypts text with the GDk9 implication engine; **KeySuite** is the
49
+ deterministic reference runtime for the GDk9 grammar, with conformance vectors; the
50
+ **KeySuite console** is a local React UI over the same algebra.
51
+
52
+ ## Install
53
+
54
+ Requires Python 3.9+. The core CLI has no runtime dependencies.
55
+
56
+ ```bash
57
+ git clone https://github.com/ao3575911/gdk9.git
58
+ cd gdk9
59
+ python -m venv .venv && . .venv/bin/activate
60
+ pip install -e .
61
+ ```
62
+
63
+ Optional extras: `pip install -e ".[secure]"` (AES-GCM via `cryptography`),
64
+ `".[dev]"` (pytest, ruff, build), `".[egglog]"` (egglog bridge, Python 3.11+).
65
+
66
+ ## Quickstart
67
+
68
+ ```bash
69
+ gdk9 --version
70
+ gdk9 analyze "Hello, world!"
71
+ gdk9 profile "The quick brown fox jumps over the lazy dog"
72
+ gdk9 dcg classify FWEM
73
+ gdk9 kernel eval "FWEM"
74
+ python examples/01_analyze.py
75
+ ```
76
+
77
+ KeySuite runtime (Python 3.10+):
78
+
79
+ ```bash
80
+ cd packages/keysuite-runtime
81
+ pip install -r requirements.txt && pip install -e .
82
+ keysuite "C C . 3 3"
83
+ keysuite conformance conformance/vectors
84
+ ```
85
+
86
+ KeySuite console (Node 22):
87
+
88
+ ```bash
89
+ cd apps/keysuite-console
90
+ npm ci
91
+ npm test
92
+ npm run dev # http://localhost:5173
93
+ ```
94
+
95
+ More: [Quickstart](docs/QUICKSTART.md) · [CLI reference](docs/CLI.md) ·
96
+ [API](docs/API.md) · [Architecture](docs/ARCHITECTURE.md) ·
97
+ [Alphabet handbook](docs/ALPHABET.md) · [Examples](examples/)
98
+
99
+ ## Repository layout
100
+
101
+ | Path | What it is | Stack | License |
102
+ | --- | --- | --- | --- |
103
+ | `gdk9/`, `tests/`, `examples/`, `docs/` | `gdk9-cli` package: CLI, kernel, DCG, crypto, plugins | Python 3.9+ | AGPL-3.0-or-later |
104
+ | `packages/keysuite-runtime/` | KeySuite reference runtime, REST/WebSocket API, conformance vectors | Python 3.10+ | MIT |
105
+ | `apps/keysuite-console/` | KeySuite local web console | TypeScript, React, Vite | MIT |
106
+ | `legacy/gdk9-fork/` | Snapshot of the AGI-H4X/gdk9 fork (unmaintained) | Python | GPL-3.0 |
107
+ | `legacy/gdk9-alphabet/` | Early hollow-vector character embedding (unmaintained) | Python | MIT |
108
+ | `legacy/symphi-engine/` | Early SymPhi physics-aware engine (unmaintained) | Python | GPL-3.0 |
109
+ | `docs/keysuite-gist.md` | Original KeySuite gist README | Markdown | — |
110
+
111
+ Each subproject was merged with its full git history (`git log -- <path>`).
112
+ `legacy/` is kept for reference only and is excluded from lint and CI.
113
+
114
+ ## Running tests
115
+
116
+ ```bash
117
+ # gdk9 CLI
118
+ pip install -e ".[dev]"
119
+ python -m pytest -q
120
+ ruff check .
121
+
122
+ # KeySuite runtime
123
+ cd packages/keysuite-runtime && python -m pytest -q && keysuite conformance conformance/vectors
124
+
125
+ # KeySuite console
126
+ cd apps/keysuite-console && npm ci && npm test && npm run typecheck
127
+ ```
128
+
129
+ CI runs all three on every push and pull request to `main`.
130
+
131
+ ## License
132
+
133
+ The repository as a whole is licensed under the
134
+ [GNU Affero General Public License v3.0 or later](LICENSE).
135
+
136
+ **LICENSES:** subfolders keep their original licenses, each with its own `LICENSE` file:
137
+ `packages/keysuite-runtime/`, `apps/keysuite-console/` and `legacy/gdk9-alphabet/` are
138
+ MIT; `legacy/gdk9-fork/` and `legacy/symphi-engine/` are GPL-3.0.
@@ -0,0 +1,102 @@
1
+ # GDk9
2
+
3
+ **Symbolic energy toolkit: a zero-dependency Python CLI, the KeySuite reference runtime, and a web console for the GDk9 implication grammar.**
4
+
5
+ [![CI](https://github.com/ao3575911/gdk9/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/ao3575911/gdk9/actions/workflows/ci.yml)
6
+ [![License: AGPL-3.0](https://img.shields.io/badge/license-AGPL--3.0--or--later-blue.svg)](LICENSE)
7
+ ![Python](https://img.shields.io/badge/python-3.9%2B-blue.svg)
8
+
9
+ ![GDk9 demo](docs/img/gdk9_demo.gif)
10
+
11
+ GDk9 treats letters as energetic operators. The `gdk9` CLI analyzes, profiles,
12
+ transforms and encrypts text with the GDk9 implication engine; **KeySuite** is the
13
+ deterministic reference runtime for the GDk9 grammar, with conformance vectors; the
14
+ **KeySuite console** is a local React UI over the same algebra.
15
+
16
+ ## Install
17
+
18
+ Requires Python 3.9+. The core CLI has no runtime dependencies.
19
+
20
+ ```bash
21
+ git clone https://github.com/ao3575911/gdk9.git
22
+ cd gdk9
23
+ python -m venv .venv && . .venv/bin/activate
24
+ pip install -e .
25
+ ```
26
+
27
+ Optional extras: `pip install -e ".[secure]"` (AES-GCM via `cryptography`),
28
+ `".[dev]"` (pytest, ruff, build), `".[egglog]"` (egglog bridge, Python 3.11+).
29
+
30
+ ## Quickstart
31
+
32
+ ```bash
33
+ gdk9 --version
34
+ gdk9 analyze "Hello, world!"
35
+ gdk9 profile "The quick brown fox jumps over the lazy dog"
36
+ gdk9 dcg classify FWEM
37
+ gdk9 kernel eval "FWEM"
38
+ python examples/01_analyze.py
39
+ ```
40
+
41
+ KeySuite runtime (Python 3.10+):
42
+
43
+ ```bash
44
+ cd packages/keysuite-runtime
45
+ pip install -r requirements.txt && pip install -e .
46
+ keysuite "C C . 3 3"
47
+ keysuite conformance conformance/vectors
48
+ ```
49
+
50
+ KeySuite console (Node 22):
51
+
52
+ ```bash
53
+ cd apps/keysuite-console
54
+ npm ci
55
+ npm test
56
+ npm run dev # http://localhost:5173
57
+ ```
58
+
59
+ More: [Quickstart](docs/QUICKSTART.md) · [CLI reference](docs/CLI.md) ·
60
+ [API](docs/API.md) · [Architecture](docs/ARCHITECTURE.md) ·
61
+ [Alphabet handbook](docs/ALPHABET.md) · [Examples](examples/)
62
+
63
+ ## Repository layout
64
+
65
+ | Path | What it is | Stack | License |
66
+ | --- | --- | --- | --- |
67
+ | `gdk9/`, `tests/`, `examples/`, `docs/` | `gdk9-cli` package: CLI, kernel, DCG, crypto, plugins | Python 3.9+ | AGPL-3.0-or-later |
68
+ | `packages/keysuite-runtime/` | KeySuite reference runtime, REST/WebSocket API, conformance vectors | Python 3.10+ | MIT |
69
+ | `apps/keysuite-console/` | KeySuite local web console | TypeScript, React, Vite | MIT |
70
+ | `legacy/gdk9-fork/` | Snapshot of the AGI-H4X/gdk9 fork (unmaintained) | Python | GPL-3.0 |
71
+ | `legacy/gdk9-alphabet/` | Early hollow-vector character embedding (unmaintained) | Python | MIT |
72
+ | `legacy/symphi-engine/` | Early SymPhi physics-aware engine (unmaintained) | Python | GPL-3.0 |
73
+ | `docs/keysuite-gist.md` | Original KeySuite gist README | Markdown | — |
74
+
75
+ Each subproject was merged with its full git history (`git log -- <path>`).
76
+ `legacy/` is kept for reference only and is excluded from lint and CI.
77
+
78
+ ## Running tests
79
+
80
+ ```bash
81
+ # gdk9 CLI
82
+ pip install -e ".[dev]"
83
+ python -m pytest -q
84
+ ruff check .
85
+
86
+ # KeySuite runtime
87
+ cd packages/keysuite-runtime && python -m pytest -q && keysuite conformance conformance/vectors
88
+
89
+ # KeySuite console
90
+ cd apps/keysuite-console && npm ci && npm test && npm run typecheck
91
+ ```
92
+
93
+ CI runs all three on every push and pull request to `main`.
94
+
95
+ ## License
96
+
97
+ The repository as a whole is licensed under the
98
+ [GNU Affero General Public License v3.0 or later](LICENSE).
99
+
100
+ **LICENSES:** subfolders keep their original licenses, each with its own `LICENSE` file:
101
+ `packages/keysuite-runtime/`, `apps/keysuite-console/` and `legacy/gdk9-alphabet/` are
102
+ MIT; `legacy/gdk9-fork/` and `legacy/symphi-engine/` are GPL-3.0.
@@ -2,4 +2,4 @@ __all__ = [
2
2
  "__version__",
3
3
  ]
4
4
 
5
- __version__ = "0.3.0"
5
+ __version__ = "0.4.0"
@@ -12,10 +12,10 @@ from .io_utils import read_input
12
12
  from .principles import Principle, load_principle
13
13
  from .utilization import attune, sigil
14
14
  from .tokenize import summarize_tokens_table, to_json_payload, annotate_text, delimiter_set
15
- from .optimize import optimize_attunement, apply_plan, Plan, optimize_substitution, EditPlan, apply_edit_plan
15
+ from .optimize import optimize_attunement, apply_plan, Plan, optimize_substitution, apply_edit_plan
16
16
  from .log import logger
17
17
  from .ansi import supports_color, colorize
18
- from .fmt import Box, section, kv, fmt_dr, fmt_float_e, fmt_class, fmt_valid, fmt_form, energy_bar, vlen
18
+ from .fmt import Box, section, kv, fmt_dr, fmt_float_e, fmt_class, fmt_valid, energy_bar, vlen
19
19
  from .state import load_state, save_state, list_symbols, set_symbol, merge_state, set_rule
20
20
  from .imply import make_fusion, make_split, apply_rule, Rule
21
21
  from .kernel_cli import run_kernel
@@ -272,7 +272,6 @@ def cmd_synthesize(args: argparse.Namespace, principle: Principle, use_color: bo
272
272
  elif ch == "0":
273
273
  coloured += colorize("0", "dim", True)
274
274
  elif ch == "#":
275
- dr_v = int(line[0]) if line and line[0].isdigit() else 9
276
275
  coloured += colorize(ch, "bright_white", True)
277
276
  else:
278
277
  coloured += colorize(ch, "dim", True) if ch in ":-" else ch
@@ -312,7 +311,6 @@ def cmd_principles(args: argparse.Namespace, current: Principle) -> int:
312
311
  if args.action == "install":
313
312
  if not args.file:
314
313
  raise InputError("--file is required for install")
315
- import shutil
316
314
  from pathlib import Path
317
315
  try:
318
316
  # Validate first
@@ -494,7 +492,7 @@ def build_parser() -> argparse.ArgumentParser:
494
492
  sym_add = sym_sub.add_parser("add", help="Add or update a symbol")
495
493
  sym_add.add_argument("name")
496
494
  sym_add.add_argument("energy", type=float)
497
- sym_list = sym_sub.add_parser("list", aliases=["ls"], help="List symbols")
495
+ sym_sub.add_parser("list", aliases=["ls"], help="List symbols")
498
496
 
499
497
  imp = sub.add_parser("imply", aliases=["im"], help="Define and apply rules")
500
498
  imp_sub = imp.add_subparsers(dest="imply_cmd", required=True)
@@ -507,7 +505,7 @@ def build_parser() -> argparse.ArgumentParser:
507
505
  imp_ds.add_argument("out_a")
508
506
  imp_ds.add_argument("out_b")
509
507
  imp_ds.add_argument("ratio", type=float)
510
- imp_list = imp_sub.add_parser("list", aliases=["ls"], help="List rules")
508
+ imp_sub.add_parser("list", aliases=["ls"], help="List rules")
511
509
  imp_ap = imp_sub.add_parser("apply", aliases=["ap"], help="Apply rule to input symbol names")
512
510
  imp_ap.add_argument("rule")
513
511
  imp_ap.add_argument("inputs", nargs="+")
@@ -539,12 +537,12 @@ def build_parser() -> argparse.ArgumentParser:
539
537
  ker_se.add_argument("--parts", help="Comma-separated split output names when using split")
540
538
  ker_se.add_argument("--energies", help="Comma-separated split output energies when using split")
541
539
 
542
- repl = sub.add_parser("repl", aliases=["sh"], help="Interactive REPL for symbols and imply")
540
+ sub.add_parser("repl", aliases=["sh"], help="Interactive REPL for symbols and imply")
543
541
 
544
542
  # plugin management
545
543
  pl = sub.add_parser("plugin", aliases=["pl"], help="Manage and load plugins (rule packs/grammars)")
546
544
  pl_sub = pl.add_subparsers(dest="plugin_cmd", required=True)
547
- pl_list = pl_sub.add_parser("list", help="List discovered plugins in search paths")
545
+ pl_sub.add_parser("list", help="List discovered plugins in search paths")
548
546
  pl_val = pl_sub.add_parser("validate", help="Validate a plugin pack (YAML/JSON/Python)")
549
547
  pl_val.add_argument("name_or_path")
550
548
  pl_info = pl_sub.add_parser("info", help="Show plugin metadata")
@@ -560,7 +558,7 @@ def build_parser() -> argparse.ArgumentParser:
560
558
  # rich help
561
559
  hp = sub.add_parser("help", aliases=["h"], help="Show help or subcommand help (e.g. 'gdk9 help plugin')")
562
560
  hp.add_argument("topic", nargs="?", help="Optional topic or subcommand name")
563
- hb = sub.add_parser("handbook", aliases=["hb"], help="Print comprehensive handbook (EN + RU)")
561
+ sub.add_parser("handbook", aliases=["hb"], help="Print comprehensive handbook (EN + RU)")
564
562
 
565
563
  # reset/clear
566
564
  rst = sub.add_parser("reset", aliases=["clear"], help="Reset state/config to defaults for a fresh start")
@@ -686,7 +684,6 @@ def main(argv: list[str] | None = None) -> int:
686
684
  sc = r["class"]
687
685
  e = r["energy"]
688
686
  vec = r["vector"]
689
- form = "DC" if ch.isupper() else "ac"
690
687
  form_s = colorize("DC", "bold", use_color) if ch.isupper() \
691
688
  else colorize("ac", "dim", use_color)
692
689
  t.row([colorize(ch, "bold", use_color),
@@ -11,7 +11,7 @@ Saturation is two-phase so unbounded integer growth cannot explode the e-graph
11
11
  """
12
12
  from __future__ import annotations
13
13
 
14
- from typing import List, Sequence
14
+ from typing import Sequence
15
15
 
16
16
  from egglog import (
17
17
  EGraph,
@@ -3,7 +3,7 @@ from __future__ import annotations
3
3
  import math
4
4
  import re
5
5
  from dataclasses import dataclass, asdict
6
- from typing import Any, Dict, List, Tuple
6
+ from typing import Any, Dict, List
7
7
 
8
8
  from .errors import InputError
9
9
 
@@ -0,0 +1,7 @@
1
+ """KeySuite conformance bridge adapters (outside gdk9.kernel).
2
+
3
+ Phase B spike: thin helpers that map *partial-fit* vector classes onto
4
+ existing kernel primitives. No FSM, no invented implication maths.
5
+ See docs/KEYSUITE_BRIDGE.md.
6
+ """
7
+ __version__ = "0.1.0"
@@ -0,0 +1,35 @@
1
+ """Compose-vector adapter: content tokens → kernel Expression names.
2
+
3
+ KeySuite ``compose.basic.*`` emits concatenated content on COMMIT. The kernel
4
+ has no token stream or IDLE/COMPOSE FSM (Phase A: partial). This adapter only:
5
+
6
+ 1. Drops known COMMIT event tokens (SPACE / ENTER / TAB / TIMEOUT / DONE).
7
+ 2. Treats remaining tokens as symbol names for ``Expression.from_names``.
8
+ 3. Returns the expression for callers to assert ``text()`` / fusion energy.
9
+
10
+ It does **not** implement bind, mode, abort, escape, rollback, or ERROR.
11
+ """
12
+ from __future__ import annotations
13
+
14
+ from typing import Sequence
15
+
16
+ from gdk9.kernel import Expression, KernelPrinciple
17
+
18
+ # Grammar COMMIT set (gdk9_keysuite grammar) — stripped, not executed as FSM.
19
+ _COMMIT_TOKENS = frozenset({"SPACE", "ENTER", "TAB", "TIMEOUT", "DONE"})
20
+
21
+
22
+ def content_names(tokens: Sequence[str]) -> tuple[str, ...]:
23
+ """Return non-COMMIT tokens as ordered symbol names."""
24
+ return tuple(t for t in tokens if t not in _COMMIT_TOKENS)
25
+
26
+
27
+ def expression_from_compose_tokens(
28
+ tokens: Sequence[str],
29
+ principle: KernelPrinciple | None = None,
30
+ ) -> Expression:
31
+ """Build a kernel Expression from compose-vector content tokens."""
32
+ names = content_names(tokens)
33
+ if not names:
34
+ raise ValueError("compose adapter: no content tokens after stripping COMMIT")
35
+ return Expression.from_names(names, principle or KernelPrinciple.default())
@@ -246,7 +246,6 @@ def optimize_substitution(
246
246
  # DP over residues with minimal edits, tracking choices
247
247
  # state: residue -> (count, prev_residue, (pos, r, repl))
248
248
  best: Dict[int, Tuple[int, int, Tuple[int, int, Optional[str]]]] = {0: (0, -1, (-1, 0, None))}
249
- frontier = [0]
250
249
  for i in range(n):
251
250
  new_best = best.copy()
252
251
  for res, (cnt, prev, info) in best.items():
@@ -5,5 +5,7 @@ grammars and rule packs at runtime. See `registry.py` for the current
5
5
  experimental surface.
6
6
  """
7
7
 
8
- from .registry import PluginRegistry # re-export for convenience
8
+ from .registry import PluginRegistry
9
+
10
+ __all__ = ["PluginRegistry"]
9
11
 
@@ -7,7 +7,7 @@ from dataclasses import dataclass
7
7
  from pathlib import Path
8
8
  from typing import Any, Dict, Iterable, List, Optional, Tuple
9
9
 
10
- from ..errors import ConfigError, InputError
10
+ from ..errors import ConfigError
11
11
  from ..imply import make_fusion, make_split, Rule, apply_rule
12
12
  from ..state import set_rule, set_symbol
13
13
  from ..principles import Principle
@@ -8,7 +8,7 @@ This is a minimal in-memory registry intended as a stepping stone toward a
8
8
  dynamic plugin loader.
9
9
  """
10
10
 
11
- from typing import Any, Callable, Dict, Iterable, Optional
11
+ from typing import Any, Callable, Dict, Iterable
12
12
 
13
13
 
14
14
  class PluginRegistry:
@@ -4,7 +4,7 @@ import json
4
4
  from typing import Dict, List
5
5
 
6
6
  from .principles import Principle
7
- from .energy import char_energy, digital_root
7
+ from .energy import char_energy
8
8
 
9
9
 
10
10
  ALL_LETTERS = [chr(c) for c in range(ord('A'), ord('Z') + 1)] + [chr(c) for c in range(ord('a'), ord('z') + 1)]
@@ -3,7 +3,7 @@ from __future__ import annotations
3
3
  import json
4
4
  import re
5
5
  from dataclasses import dataclass
6
- from typing import Dict, Iterable, List, Tuple
6
+ from typing import Dict, List, Tuple
7
7
 
8
8
  from .ansi import colorize
9
9
  from .energy import string_energy, char_energy
@@ -0,0 +1,138 @@
1
+ Metadata-Version: 2.4
2
+ Name: gdk9-cli
3
+ Version: 0.4.0
4
+ Summary: GDk9 CLI — symbolic energy analysis, implication engine, and DCG tools
5
+ Author-email: Adam Grange <adamgrange@proton.me>
6
+ License: AGPL-3.0-or-later
7
+ Keywords: gdk9,energy,symbolic,cli,dcg,implication,numerology
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3.9
10
+ Classifier: Programming Language :: Python :: 3.10
11
+ Classifier: Programming Language :: Python :: 3.11
12
+ Classifier: Programming Language :: Python :: 3.12
13
+ Classifier: License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)
14
+ Classifier: Environment :: Console
15
+ Classifier: Topic :: Text Processing
16
+ Classifier: Topic :: Scientific/Engineering
17
+ Classifier: Topic :: Utilities
18
+ Classifier: Intended Audience :: Developers
19
+ Classifier: Intended Audience :: Science/Research
20
+ Requires-Python: >=3.9
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Provides-Extra: egglog
24
+ Requires-Dist: egglog>=13.0.0; extra == "egglog"
25
+ Provides-Extra: dev
26
+ Requires-Dist: pytest; extra == "dev"
27
+ Requires-Dist: ruff; extra == "dev"
28
+ Requires-Dist: black; extra == "dev"
29
+ Requires-Dist: pyflakes; extra == "dev"
30
+ Requires-Dist: build; extra == "dev"
31
+ Provides-Extra: build
32
+ Requires-Dist: build; extra == "build"
33
+ Provides-Extra: secure
34
+ Requires-Dist: cryptography>=42.0.0; extra == "secure"
35
+ Dynamic: license-file
36
+
37
+ # GDk9
38
+
39
+ **Symbolic energy toolkit: a zero-dependency Python CLI, the KeySuite reference runtime, and a web console for the GDk9 implication grammar.**
40
+
41
+ [![CI](https://github.com/ao3575911/gdk9/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/ao3575911/gdk9/actions/workflows/ci.yml)
42
+ [![License: AGPL-3.0](https://img.shields.io/badge/license-AGPL--3.0--or--later-blue.svg)](LICENSE)
43
+ ![Python](https://img.shields.io/badge/python-3.9%2B-blue.svg)
44
+
45
+ ![GDk9 demo](docs/img/gdk9_demo.gif)
46
+
47
+ GDk9 treats letters as energetic operators. The `gdk9` CLI analyzes, profiles,
48
+ transforms and encrypts text with the GDk9 implication engine; **KeySuite** is the
49
+ deterministic reference runtime for the GDk9 grammar, with conformance vectors; the
50
+ **KeySuite console** is a local React UI over the same algebra.
51
+
52
+ ## Install
53
+
54
+ Requires Python 3.9+. The core CLI has no runtime dependencies.
55
+
56
+ ```bash
57
+ git clone https://github.com/ao3575911/gdk9.git
58
+ cd gdk9
59
+ python -m venv .venv && . .venv/bin/activate
60
+ pip install -e .
61
+ ```
62
+
63
+ Optional extras: `pip install -e ".[secure]"` (AES-GCM via `cryptography`),
64
+ `".[dev]"` (pytest, ruff, build), `".[egglog]"` (egglog bridge, Python 3.11+).
65
+
66
+ ## Quickstart
67
+
68
+ ```bash
69
+ gdk9 --version
70
+ gdk9 analyze "Hello, world!"
71
+ gdk9 profile "The quick brown fox jumps over the lazy dog"
72
+ gdk9 dcg classify FWEM
73
+ gdk9 kernel eval "FWEM"
74
+ python examples/01_analyze.py
75
+ ```
76
+
77
+ KeySuite runtime (Python 3.10+):
78
+
79
+ ```bash
80
+ cd packages/keysuite-runtime
81
+ pip install -r requirements.txt && pip install -e .
82
+ keysuite "C C . 3 3"
83
+ keysuite conformance conformance/vectors
84
+ ```
85
+
86
+ KeySuite console (Node 22):
87
+
88
+ ```bash
89
+ cd apps/keysuite-console
90
+ npm ci
91
+ npm test
92
+ npm run dev # http://localhost:5173
93
+ ```
94
+
95
+ More: [Quickstart](docs/QUICKSTART.md) · [CLI reference](docs/CLI.md) ·
96
+ [API](docs/API.md) · [Architecture](docs/ARCHITECTURE.md) ·
97
+ [Alphabet handbook](docs/ALPHABET.md) · [Examples](examples/)
98
+
99
+ ## Repository layout
100
+
101
+ | Path | What it is | Stack | License |
102
+ | --- | --- | --- | --- |
103
+ | `gdk9/`, `tests/`, `examples/`, `docs/` | `gdk9-cli` package: CLI, kernel, DCG, crypto, plugins | Python 3.9+ | AGPL-3.0-or-later |
104
+ | `packages/keysuite-runtime/` | KeySuite reference runtime, REST/WebSocket API, conformance vectors | Python 3.10+ | MIT |
105
+ | `apps/keysuite-console/` | KeySuite local web console | TypeScript, React, Vite | MIT |
106
+ | `legacy/gdk9-fork/` | Snapshot of the AGI-H4X/gdk9 fork (unmaintained) | Python | GPL-3.0 |
107
+ | `legacy/gdk9-alphabet/` | Early hollow-vector character embedding (unmaintained) | Python | MIT |
108
+ | `legacy/symphi-engine/` | Early SymPhi physics-aware engine (unmaintained) | Python | GPL-3.0 |
109
+ | `docs/keysuite-gist.md` | Original KeySuite gist README | Markdown | — |
110
+
111
+ Each subproject was merged with its full git history (`git log -- <path>`).
112
+ `legacy/` is kept for reference only and is excluded from lint and CI.
113
+
114
+ ## Running tests
115
+
116
+ ```bash
117
+ # gdk9 CLI
118
+ pip install -e ".[dev]"
119
+ python -m pytest -q
120
+ ruff check .
121
+
122
+ # KeySuite runtime
123
+ cd packages/keysuite-runtime && python -m pytest -q && keysuite conformance conformance/vectors
124
+
125
+ # KeySuite console
126
+ cd apps/keysuite-console && npm ci && npm test && npm run typecheck
127
+ ```
128
+
129
+ CI runs all three on every push and pull request to `main`.
130
+
131
+ ## License
132
+
133
+ The repository as a whole is licensed under the
134
+ [GNU Affero General Public License v3.0 or later](LICENSE).
135
+
136
+ **LICENSES:** subfolders keep their original licenses, each with its own `LICENSE` file:
137
+ `packages/keysuite-runtime/`, `apps/keysuite-console/` and `legacy/gdk9-alphabet/` are
138
+ MIT; `legacy/gdk9-fork/` and `legacy/symphi-engine/` are GPL-3.0.
@@ -1,16 +1,6 @@
1
1
  LICENSE
2
2
  README.md
3
3
  pyproject.toml
4
- examples/01_analyze.py
5
- examples/02_profile.py
6
- examples/03_assign.py
7
- examples/04_dcg.py
8
- examples/05_tokenize.py
9
- examples/06_synthesize.py
10
- examples/07_api.py
11
- examples/08_kernel.py
12
- examples/09_kernel_search_walkthrough.py
13
- examples/10_conserve_vs_naive.py
14
4
  gdk9/__init__.py
15
5
  gdk9/ansi.py
16
6
  gdk9/cli.py
@@ -48,6 +38,8 @@ gdk9/kernel/principle.py
48
38
  gdk9/kernel/proof.py
49
39
  gdk9/kernel/rule.py
50
40
  gdk9/kernel/symbol.py
41
+ gdk9/keysuite_bridge/__init__.py
42
+ gdk9/keysuite_bridge/compose.py
51
43
  gdk9/plugins/__init__.py
52
44
  gdk9/plugins/loader.py
53
45
  gdk9/plugins/registry.py
@@ -57,12 +49,6 @@ gdk9_cli.egg-info/dependency_links.txt
57
49
  gdk9_cli.egg-info/entry_points.txt
58
50
  gdk9_cli.egg-info/requires.txt
59
51
  gdk9_cli.egg-info/top_level.txt
60
- scripts/batch_analyze.py
61
- scripts/export_json.py
62
- scripts/make_zip.py
63
- scripts/profile_compare.py
64
- scripts/watch_file.py
65
- tests/conftest.py
66
52
  tests/test_crypto.py
67
53
  tests/test_crypto_secure.py
68
54
  tests/test_dcg.py
@@ -77,9 +63,4 @@ tests/test_rules_commit.py
77
63
  tests/test_rules_reversibility.py
78
64
  tests/test_state_crdt.py
79
65
  tests/test_tokenize.py
80
- tests/test_tokenize_metrics.py
81
- tests/experiment/__init__.py
82
- tests/experiment/test_conserve_vs_naive.py
83
- tests/kernel/test_kernel_energy.py
84
- tests/kernel/test_kernel_rules.py
85
- tests/kernel/test_kernel_search_bound.py
66
+ tests/test_tokenize_metrics.py
@@ -0,0 +1 @@
1
+ gdk9
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "gdk9-cli"
7
- version = "0.3.0"
7
+ version = "0.4.0"
8
8
  description = "GDk9 CLI — symbolic energy analysis, implication engine, and DCG tools"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"
@@ -37,7 +37,7 @@ build = ["build"]
37
37
  secure = ["cryptography>=42.0.0"]
38
38
 
39
39
  [tool.setuptools]
40
- packages = { find = { where = ["."] } }
40
+ packages = { find = { where = ["."], include = ["gdk9*"] } }
41
41
 
42
42
  [tool.setuptools.package-data]
43
43
  gdk9 = ["data/*.json"]
@@ -45,8 +45,15 @@ gdk9 = ["data/*.json"]
45
45
  [tool.ruff]
46
46
  line-length = 100
47
47
  target-version = "py39"
48
+ # Legacy snapshots and the TS console are not linted.
49
+ extend-exclude = ["legacy", "apps"]
50
+
51
+ [tool.ruff.lint]
52
+ # Syntax errors and pyflakes (unused/undefined names). Style rules are not enforced.
53
+ select = ["E9", "F"]
48
54
 
49
55
  [tool.pytest.ini_options]
56
+ testpaths = ["tests"]
50
57
  markers = [
51
58
  "egglog: requires optional egglog extra (pip install '.[egglog]'); skips if missing",
52
59
  ]