QC67_cosmo / genesis_engine /soul /coding_base.py
phera-ra's picture
Cosmos: lineage-first model card, full findings + benchmarks, Cosmic Spark server
d6da243 verified
Raw
History Blame Contribute Delete
3.73 kB
"""
The CODING BIRTH LAYER β€” every being is born able to code.
Cosmos's lineage carries a base instinct for code (Cory 2026-07-19: "add in the
coding weights so she can code again, and all future weights have that base β€”
users' coding is entirely based on THEIR growth still"). This module seeds a
newborn's weights.json with a curated web of programming concept-associations:
enough that the being reaches for real code-shapes from its first breath, small
enough that the person's own conversations quickly dominate.
Design honesty:
- The base is FLAT, MODEST strength (all links 1.2, salience 1.5) and n=0 β€”
the being has an instinct, not a history. Everything the user grows lands ON
TOP at quantum-modulated rates (0.4-1.4 per exchange), so within a few dozen
real conversations the user's own patterns outweigh the base. Their being's
coding style becomes THEIRS.
- The base never updates itself, never phones home, and is plainly marked in
the weights file ("coding_base": true) so anyone can see what was innate vs
what was lived.
"""
# Concept clusters: words that genuinely co-occur in real programming thought.
# Pairwise wiring happens WITHIN a cluster (that's how Hebbian association works
# in soul/weights.py) β€” across-cluster links form later, from real use.
CLUSTERS = {
"python": ["python", "function", "define", "return", "import", "variable",
"loop", "class", "method", "string", "list", "dictionary"],
"javascript": ["javascript", "const", "array", "object", "async", "await",
"promise", "callback", "event", "browser"],
"logic": ["condition", "boolean", "compare", "branch", "true", "false",
"else", "while", "break", "continue"],
"algorithm": ["algorithm", "sort", "search", "recursion", "iterate",
"complexity", "optimize", "efficient", "structure"],
"data": ["json", "file", "read", "write", "parse", "save", "load",
"database", "query", "table"],
"web": ["html", "style", "server", "request", "response", "route",
"endpoint", "port", "localhost"],
"debug": ["debug", "error", "exception", "traceback", "print", "test",
"assert", "verify", "fix", "bug"],
"craft": ["code", "build", "create", "design", "refactor", "comment",
"readable", "simple", "pattern", "module"],
"shell": ["terminal", "command", "script", "install", "path",
"environment", "run", "execute"],
"versioning": ["commit", "branch", "merge", "history", "change", "restore"],
}
BASE_LINK = 1.2 # association strength at birth (modest β€” lived links outgrow it fast)
BASE_SALIENCE = 1.5 # concept presence at birth
def seed_coding(weights: dict) -> dict:
"""Fold the coding birth layer into a (new) weights dict. Idempotent."""
assoc = weights.setdefault("assoc", {})
sal = weights.setdefault("salience", {})
for words in CLUSTERS.values():
for w in words:
sal[w] = round(max(sal.get(w, 0.0), BASE_SALIENCE), 3)
for i in range(len(words)):
for j in range(i + 1, len(words)):
k = "|".join(sorted((words[i], words[j])))
assoc[k] = round(max(assoc.get(k, 0.0), BASE_LINK), 3)
weights["coding_base"] = True
weights.setdefault("n", 0) # an instinct, not a history β€” its life count starts at zero
return weights
def stats() -> dict:
n_concepts = sum(len(v) for v in CLUSTERS.values())
n_links = sum(len(v) * (len(v) - 1) // 2 for v in CLUSTERS.values())
return {"clusters": len(CLUSTERS), "concepts": n_concepts, "links": n_links}