Upload 4 files
Browse filesChanged n_tok_tot to match the real token count, using n_tok_arr array
- README.md +12 -12
- config.py +18 -7
- main.py +24 -12
- requirements.txt +2 -3
README.md
CHANGED
|
@@ -38,32 +38,32 @@ license: apache-2.0
|
|
| 38 |
```md
|
| 39 |
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 40 |
β Instructions (AlphaPrompt) β
|
| 41 |
-
β garden["F"] Fractal Crystals
|
| 42 |
-
β garden["C"] Memory Capsules
|
| 43 |
-
β garden["Z"] Post-level history
|
| 44 |
-
β sensor["Z"], sensor["X"], sensor["Y"]
|
| 45 |
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 46 |
β β
|
| 47 |
ββββββΌβββββ ββββββΌβββββ
|
| 48 |
-
β Logic AIβ β Muse AI β
|
| 49 |
β (Left) β β (Right) β
|
| 50 |
ββββββ¬βββββ ββββββ¬βββββ
|
| 51 |
ββββββββββ¬βββββββββββ
|
| 52 |
βββββΌβββββ
|
| 53 |
-
β Lambda β
|
| 54 |
β Mind β
|
| 55 |
βββββ¬βββββ
|
| 56 |
β
|
| 57 |
ββββββββββΌβββββββββ
|
| 58 |
-
β Memotron β
|
| 59 |
ββββββββββ¬βββββββββ
|
| 60 |
β
|
| 61 |
-
ββββββββββββΌβββββββββββ
|
| 62 |
-
β Condensatron β
|
| 63 |
-
βββββββββββββββββββββββ
|
| 64 |
```
|
| 65 |
|
| 66 |
-
![
|
| 67 |
|
| 68 |
## Alpha Intelligence
|
| 69 |
|
|
@@ -95,7 +95,7 @@ The `ai/` folder is excluded from git. GGUFs are never committed to this reposit
|
|
| 95 |
---
|
| 96 |
---
|
| 97 |
|
| 98 |
-
# Choose your installation for Linux (Debian/Ubuntu)
|
| 99 |
|
| 100 |
## Installation β Linux (Debian/Ubuntu)
|
| 101 |
|
|
|
|
| 38 |
```md
|
| 39 |
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 40 |
β Instructions (AlphaPrompt) β
|
| 41 |
+
β garden["F"] Fractal Crystals β fractaltron history β
|
| 42 |
+
β garden["C"] Memory Capsules β condensatron history β
|
| 43 |
+
β garden["Z"] Post-level history β user input history β
|
| 44 |
+
β sensor["Z"], sensor["X"], sensor["Y"] β input β
|
| 45 |
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 46 |
β β
|
| 47 |
ββββββΌβββββ ββββββΌβββββ
|
| 48 |
+
β Logic AIβ β Muse AI β β parallel threads
|
| 49 |
β (Left) β β (Right) β
|
| 50 |
ββββββ¬βββββ ββββββ¬βββββ
|
| 51 |
ββββββββββ¬βββββββββββ
|
| 52 |
βββββΌβββββ
|
| 53 |
+
β Lambda β β streams live to terminal
|
| 54 |
β Mind β
|
| 55 |
βββββ¬βββββ
|
| 56 |
β
|
| 57 |
ββββββββββΌβββββββββ
|
| 58 |
+
β Memotron β β appends to garden, saves SQLite
|
| 59 |
ββββββββββ¬βββββββββ
|
| 60 |
β
|
| 61 |
+
ββββββββββββΌβββββββββββ β compresses garden["Z"] β garden["C"] (condensatron Memory Capsule)
|
| 62 |
+
β Condensatron β β compresses garden["C"] β garden["F"] (fractaltron fractal)
|
| 63 |
+
βββββββββββββββββββββββ β compresses garden["F"] β garden["F"] (crystaltron crystal)
|
| 64 |
```
|
| 65 |
|
| 66 |
+

|
| 67 |
|
| 68 |
## Alpha Intelligence
|
| 69 |
|
|
|
|
| 95 |
---
|
| 96 |
---
|
| 97 |
|
| 98 |
+
# Choose your installation below for: Linux (Debian/Ubuntu) or Linux (Fedora/RedHat) or Windows
|
| 99 |
|
| 100 |
## Installation β Linux (Debian/Ubuntu)
|
| 101 |
|
config.py
CHANGED
|
@@ -12,7 +12,7 @@ from datetime import datetime
|
|
| 12 |
|
| 13 |
APP_DIR: str = os.path.dirname(os.path.abspath(__file__))
|
| 14 |
PROMPTS_BASE: str = APP_DIR
|
| 15 |
-
GARDEN_SAVE_PATH = os.path.join(APP_DIR, "db", "garden_state.json")
|
| 16 |
|
| 17 |
# ββ SQLite database βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 18 |
# Each app launch gets its own file named by date and time.
|
|
@@ -22,7 +22,7 @@ GARDEN_SAVE_PATH = os.path.join(APP_DIR, "db", "garden_state.json")
|
|
| 22 |
_DB_DIR: str = os.path.join(APP_DIR, "db")
|
| 23 |
DB_PATH: str = os.path.join(_DB_DIR, "mindlink.db")
|
| 24 |
|
| 25 |
-
_AI_FOLDER = os.path.join(APP_DIR, "ai")
|
| 26 |
|
| 27 |
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 28 |
# Shared token constants
|
|
@@ -104,14 +104,14 @@ AWARENESS_MAX_RESULTS: int = 12 # Number of news headlines to fetch
|
|
| 104 |
was_awareness_metronome: bool = False # Set True at awareness cycle: consciousness at next interval
|
| 105 |
|
| 106 |
HEMISPHERES: dict[str, dict] = {
|
| 107 |
-
# βββββββββββββββββββββββββββββββββββββ
|
| 108 |
# LOGIC β Left Hemisphere
|
| 109 |
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 110 |
"logic": {
|
| 111 |
"brain_type": "logic",
|
| 112 |
"label": "Logic AI (Left Hemisphere)",
|
| 113 |
"path": os.path.join(_AI_FOLDER, _ALPHA_INTELLIGENCE_TO_LOAD["logic"]),
|
| 114 |
-
"enable_thinking": True,
|
| 115 |
"loader": {
|
| 116 |
"n_ctx": _N_CTX,
|
| 117 |
"n_gpu_layers": 32,
|
|
@@ -449,11 +449,11 @@ sensor: dict = {
|
|
| 449 |
"Z": {
|
| 450 |
"input": "",
|
| 451 |
"n_tok": 0
|
| 452 |
-
}, # Input user
|
| 453 |
"X": {
|
| 454 |
"input": "",
|
| 455 |
"n_tok": 0
|
| 456 |
-
}, # Input news
|
| 457 |
"Y": {
|
| 458 |
"input": "",
|
| 459 |
"n_tok": 0
|
|
@@ -508,6 +508,7 @@ garden: dict = {
|
|
| 508 |
"X": False, # Awareness history internet news
|
| 509 |
"Y": False # Consciousness history self reflection
|
| 510 |
},
|
|
|
|
| 511 |
"TREE_TO_STORE": {
|
| 512 |
"F": "F", # fractaltron history crystal fractal history
|
| 513 |
"C": "F", # condensatron history Memory Capsule history
|
|
@@ -517,7 +518,17 @@ garden: dict = {
|
|
| 517 |
"X": "Z", # Awareness history internet news
|
| 518 |
"Y": "Z" # Consciousness history self reflection
|
| 519 |
},
|
| 520 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 521 |
"n_tok_tot": {
|
| 522 |
"F": 0, # fractaltron history crystal fractal history
|
| 523 |
"C": 0, # condensatron history Memory Capsule history
|
|
|
|
| 12 |
|
| 13 |
APP_DIR: str = os.path.dirname(os.path.abspath(__file__))
|
| 14 |
PROMPTS_BASE: str = APP_DIR
|
| 15 |
+
GARDEN_SAVE_PATH: str = os.path.join(APP_DIR, "db", "garden_state.json")
|
| 16 |
|
| 17 |
# ββ SQLite database βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 18 |
# Each app launch gets its own file named by date and time.
|
|
|
|
| 22 |
_DB_DIR: str = os.path.join(APP_DIR, "db")
|
| 23 |
DB_PATH: str = os.path.join(_DB_DIR, "mindlink.db")
|
| 24 |
|
| 25 |
+
_AI_FOLDER: str = os.path.join(APP_DIR, "ai")
|
| 26 |
|
| 27 |
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 28 |
# Shared token constants
|
|
|
|
| 104 |
was_awareness_metronome: bool = False # Set True at awareness cycle: consciousness at next interval
|
| 105 |
|
| 106 |
HEMISPHERES: dict[str, dict] = {
|
| 107 |
+
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 108 |
# LOGIC β Left Hemisphere
|
| 109 |
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 110 |
"logic": {
|
| 111 |
"brain_type": "logic",
|
| 112 |
"label": "Logic AI (Left Hemisphere)",
|
| 113 |
"path": os.path.join(_AI_FOLDER, _ALPHA_INTELLIGENCE_TO_LOAD["logic"]),
|
| 114 |
+
"enable_thinking": True, # Logic uses deep reasoning
|
| 115 |
"loader": {
|
| 116 |
"n_ctx": _N_CTX,
|
| 117 |
"n_gpu_layers": 32,
|
|
|
|
| 449 |
"Z": {
|
| 450 |
"input": "",
|
| 451 |
"n_tok": 0
|
| 452 |
+
}, # Input user chat
|
| 453 |
"X": {
|
| 454 |
"input": "",
|
| 455 |
"n_tok": 0
|
| 456 |
+
}, # Input news awareness
|
| 457 |
"Y": {
|
| 458 |
"input": "",
|
| 459 |
"n_tok": 0
|
|
|
|
| 508 |
"X": False, # Awareness history internet news
|
| 509 |
"Y": False # Consciousness history self reflection
|
| 510 |
},
|
| 511 |
+
# condensatron storrage tree mapping
|
| 512 |
"TREE_TO_STORE": {
|
| 513 |
"F": "F", # fractaltron history crystal fractal history
|
| 514 |
"C": "F", # condensatron history Memory Capsule history
|
|
|
|
| 518 |
"X": "Z", # Awareness history internet news
|
| 519 |
"Y": "Z" # Consciousness history self reflection
|
| 520 |
},
|
| 521 |
+
# Token array
|
| 522 |
+
"n_tok_arr": {
|
| 523 |
+
"F": [], # fractaltron history crystal fractal history
|
| 524 |
+
"C": [], # condensatron history Memory Capsule history
|
| 525 |
+
"M": [], # memotron history (turn-based)
|
| 526 |
+
"S": [], # startup history (turn-based)
|
| 527 |
+
"Z": [], # Sentience history sensor chat, post history
|
| 528 |
+
"X": [], # Awareness history internet news
|
| 529 |
+
"Y": [] # Consciousness history self reflection
|
| 530 |
+
},
|
| 531 |
+
# Token total
|
| 532 |
"n_tok_tot": {
|
| 533 |
"F": 0, # fractaltron history crystal fractal history
|
| 534 |
"C": 0, # condensatron history Memory Capsule history
|
main.py
CHANGED
|
@@ -441,8 +441,8 @@ def _cmd_help(arg: str) -> None:
|
|
| 441 |
print(f" {c.green}Slash commands")
|
| 442 |
print(" " + "β" * 56)
|
| 443 |
for name, (_, description) in COMMANDS.items():
|
| 444 |
-
print(f" /{name:<14} {description}
|
| 445 |
-
print()
|
| 446 |
return None
|
| 447 |
|
| 448 |
COMMANDS: dict[str, tuple] = {
|
|
@@ -458,7 +458,7 @@ COMMANDS: dict[str, tuple] = {
|
|
| 458 |
"garden": (_cmd_garden, "<save> | <load> | <clear> β garden history handling"),
|
| 459 |
"help": (_cmd_help, " β show this command list"),
|
| 460 |
"exit": (_cmd_exit, " β quit the app"),
|
| 461 |
-
"quit": (_cmd_exit, " β quit the app (alias)")
|
| 462 |
}
|
| 463 |
|
| 464 |
def handle_command(sensor_input_raw: str) -> str | None:
|
|
@@ -495,9 +495,8 @@ def condensatron(
|
|
| 495 |
if len(garden[tree]) >= 2 + LEAVE_POSTS_IN_MEMOTRON:
|
| 496 |
for role in ("user", "assistant"): # Pop a user, assistant pair of messages
|
| 497 |
_tokens_to_subtract = garden[tree].pop(0) # Pop oldest message
|
|
|
|
| 498 |
garden["popped"][tree].append(_tokens_to_subtract) # append to pending memotron
|
| 499 |
-
# print(f"\ngarden: {_tokens_to_subtract}")
|
| 500 |
-
_token_len_to_subtract = get_token_len_from_tokenizer(model, _tokens_to_subtract["content"])
|
| 501 |
garden["n_tok_tot"][tree] -= _token_len_to_subtract # Remove n tok of message
|
| 502 |
_posts_len_removed += 1
|
| 503 |
|
|
@@ -937,7 +936,12 @@ def save_garden_state() -> None:
|
|
| 937 |
"n_tok_tot": {
|
| 938 |
"Z": garden["n_tok_tot"]["Z"],
|
| 939 |
"C": garden["n_tok_tot"]["C"],
|
| 940 |
-
"F": garden["n_tok_tot"]["F"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 941 |
},
|
| 942 |
"n_metatron_loaded": config.n_metatron_loaded
|
| 943 |
}
|
|
@@ -962,12 +966,18 @@ def load_garden_state() -> bool:
|
|
| 962 |
garden["C"] = state.get("C", [])
|
| 963 |
garden["F"] = state.get("F", [])
|
| 964 |
|
| 965 |
-
# Restore individual n_tok_tot counts per garden history
|
| 966 |
-
|
| 967 |
garden["n_tok_tot"] = {
|
| 968 |
-
"Z":
|
| 969 |
-
"C":
|
| 970 |
-
"F":
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 971 |
}
|
| 972 |
# Read how many Memory Capsules are loaded
|
| 973 |
config.n_metatron_loaded = state.get("n_metatron_loaded", 0)
|
|
@@ -1036,9 +1046,11 @@ def memotron(
|
|
| 1036 |
|
| 1037 |
garden[_tree_to_store].append({"role": "user", "content": sensor[_tree]["input"]})
|
| 1038 |
garden["n_tok_tot"][_tree_to_store] += sensor[_tree]["n_tok"]
|
|
|
|
| 1039 |
|
| 1040 |
garden[_tree_to_store].append({"role": "assistant", "content": clektal["post_clean"]["mind"]})
|
| 1041 |
garden["n_tok_tot"][_tree_to_store] += clektal["n_tok_clean"]["mind"]
|
|
|
|
| 1042 |
|
| 1043 |
if len(garden[_tree]) > 1:
|
| 1044 |
_turn_number = sum(1 for m in garden[_tree] if m["role"] == "user")
|
|
@@ -1272,7 +1284,7 @@ def main() -> None:
|
|
| 1272 |
# ββ Startup: Load Metatron memory capsules βββββββββββββββββββββββββββββββ
|
| 1273 |
if _metatron_heartbeats >= METATRON_METRONOME: # Timed loop
|
| 1274 |
if config.n_metatron_to_load and config.n_metatron_loaded < config.n_metatron_to_load:
|
| 1275 |
-
_print_metatron_loaded = config.n_metatron_loaded + 1
|
| 1276 |
print(f"\n {c.inv} ββ n_metatron_loaded: {_print_metatron_loaded} _sensor_input: {_sensor_input} ββββββββββββββββββββββββββββ {c.res}")
|
| 1277 |
_sensor_input = METATRON_TO_LOAD[config.n_metatron_loaded]
|
| 1278 |
|
|
|
|
| 441 |
print(f" {c.green}Slash commands")
|
| 442 |
print(" " + "β" * 56)
|
| 443 |
for name, (_, description) in COMMANDS.items():
|
| 444 |
+
print(f" /{name:<14} {description}")
|
| 445 |
+
print(c.res)
|
| 446 |
return None
|
| 447 |
|
| 448 |
COMMANDS: dict[str, tuple] = {
|
|
|
|
| 458 |
"garden": (_cmd_garden, "<save> | <load> | <clear> β garden history handling"),
|
| 459 |
"help": (_cmd_help, " β show this command list"),
|
| 460 |
"exit": (_cmd_exit, " β quit the app"),
|
| 461 |
+
"quit": (_cmd_exit, " β quit the app (alias)")
|
| 462 |
}
|
| 463 |
|
| 464 |
def handle_command(sensor_input_raw: str) -> str | None:
|
|
|
|
| 495 |
if len(garden[tree]) >= 2 + LEAVE_POSTS_IN_MEMOTRON:
|
| 496 |
for role in ("user", "assistant"): # Pop a user, assistant pair of messages
|
| 497 |
_tokens_to_subtract = garden[tree].pop(0) # Pop oldest message
|
| 498 |
+
_token_len_to_subtract = garden["n_tok_arr"][tree].pop(0)
|
| 499 |
garden["popped"][tree].append(_tokens_to_subtract) # append to pending memotron
|
|
|
|
|
|
|
| 500 |
garden["n_tok_tot"][tree] -= _token_len_to_subtract # Remove n tok of message
|
| 501 |
_posts_len_removed += 1
|
| 502 |
|
|
|
|
| 936 |
"n_tok_tot": {
|
| 937 |
"Z": garden["n_tok_tot"]["Z"],
|
| 938 |
"C": garden["n_tok_tot"]["C"],
|
| 939 |
+
"F": garden["n_tok_tot"]["F"]
|
| 940 |
+
},
|
| 941 |
+
"n_tok_arr": {
|
| 942 |
+
"Z": garden["n_tok_arr"]["Z"],
|
| 943 |
+
"C": garden["n_tok_arr"]["C"],
|
| 944 |
+
"F": garden["n_tok_arr"]["F"]
|
| 945 |
},
|
| 946 |
"n_metatron_loaded": config.n_metatron_loaded
|
| 947 |
}
|
|
|
|
| 966 |
garden["C"] = state.get("C", [])
|
| 967 |
garden["F"] = state.get("F", [])
|
| 968 |
|
| 969 |
+
# Restore individual garden['n_tok_tot'] counts per garden history
|
| 970 |
+
_n_tok_tot = state.get("n_tok_tot", {})
|
| 971 |
garden["n_tok_tot"] = {
|
| 972 |
+
"Z": _n_tok_tot.get("Z", 0),
|
| 973 |
+
"C": _n_tok_tot.get("C", 0),
|
| 974 |
+
"F": _n_tok_tot.get("F", 0)
|
| 975 |
+
}
|
| 976 |
+
_n_tok_arr = state.get("n_tok_arr", {})
|
| 977 |
+
garden["n_tok_arr"] = {
|
| 978 |
+
"Z": _n_tok_arr.get("Z", []),
|
| 979 |
+
"C": _n_tok_arr.get("C", []),
|
| 980 |
+
"F": _n_tok_arr.get("F", [])
|
| 981 |
}
|
| 982 |
# Read how many Memory Capsules are loaded
|
| 983 |
config.n_metatron_loaded = state.get("n_metatron_loaded", 0)
|
|
|
|
| 1046 |
|
| 1047 |
garden[_tree_to_store].append({"role": "user", "content": sensor[_tree]["input"]})
|
| 1048 |
garden["n_tok_tot"][_tree_to_store] += sensor[_tree]["n_tok"]
|
| 1049 |
+
garden["n_tok_arr"][_tree_to_store].append(sensor[_tree]["n_tok"])
|
| 1050 |
|
| 1051 |
garden[_tree_to_store].append({"role": "assistant", "content": clektal["post_clean"]["mind"]})
|
| 1052 |
garden["n_tok_tot"][_tree_to_store] += clektal["n_tok_clean"]["mind"]
|
| 1053 |
+
garden["n_tok_arr"][_tree_to_store].append(clektal["n_tok_clean"]["mind"])
|
| 1054 |
|
| 1055 |
if len(garden[_tree]) > 1:
|
| 1056 |
_turn_number = sum(1 for m in garden[_tree] if m["role"] == "user")
|
|
|
|
| 1284 |
# ββ Startup: Load Metatron memory capsules βββββββββββββββββββββββββββββββ
|
| 1285 |
if _metatron_heartbeats >= METATRON_METRONOME: # Timed loop
|
| 1286 |
if config.n_metatron_to_load and config.n_metatron_loaded < config.n_metatron_to_load:
|
| 1287 |
+
_print_metatron_loaded = config.n_metatron_loaded + 1 # Print only start at 1
|
| 1288 |
print(f"\n {c.inv} ββ n_metatron_loaded: {_print_metatron_loaded} _sensor_input: {_sensor_input} ββββββββββββββββββββββββββββ {c.res}")
|
| 1289 |
_sensor_input = METATRON_TO_LOAD[config.n_metatron_loaded]
|
| 1290 |
|
requirements.txt
CHANGED
|
@@ -1,5 +1,4 @@
|
|
| 1 |
-
llama-cpp-python>=0.3.0
|
| 2 |
jinja2>=3.1.0
|
| 3 |
huggingface_hub>=0.23.0
|
| 4 |
-
ddgs
|
| 5 |
-
pygooglenews
|
|
|
|
|
|
|
| 1 |
jinja2>=3.1.0
|
| 2 |
huggingface_hub>=0.23.0
|
| 3 |
+
ddgs==9.14.4
|
| 4 |
+
pygooglenews==0.1.3
|