Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions .github/workflows/continuum-rust-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,9 @@ jobs:
if: matrix.crate == 'continuum-genome'
run: python3 -m unittest discover -s core/continuum-genome/src/genome/fine_tuning -p cuda_train_test.py -v

# ---- continuum-hands, -live, -perception, -genome, -experience, -memory: lib tests ----
# ---- continuum-hands, -live, -perception, -genome, -experience, -memory, -cognition: lib tests ----
- name: cargo test -p ${{ matrix.crate }} --lib
if: contains(fromJSON('["continuum-hands","continuum-live","continuum-perception","continuum-genome","continuum-experience","continuum-memory"]'), matrix.crate)
if: contains(fromJSON('["continuum-hands","continuum-live","continuum-perception","continuum-genome","continuum-experience","continuum-memory","continuum-cognition"]'), matrix.crate)
run: cargo test -p "$CRATE" --lib --profile dev-fast --features "$FEATURES"

# ---- continuum-mind: lib tests, compile-fail doc guards ----
Expand Down
58 changes: 57 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ members = [
"core/continuum-genome",
"core/continuum-memory",
"core/continuum-experience",
"core/continuum-cognition",
"core/continuum-live",
"core/continuum-hands",
"core/continuum-engine",
Expand Down
87 changes: 87 additions & 0 deletions core/continuum-cognition/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
[package]
name = "continuum-cognition"
version = "0.1.0"
edition = "2021"
publish = false
repository = "https://github.com/CambrianTech/continuum"
# Cognition stamps her captures, continuity and handoffs with the build they ran on
# (CONTINUUM_BUILD_GIT_SHA): core's build script is the one owner of that identity.
build = "../continuum-core/build.rs"

# A mind's thinking (MODULE-ARCHITECTURE.md section 9.2, plan phase 2): the workspace cycle,
# the faculties, act/observe, the conversation contract, memory admission, the dream. Cut out
# of continuum-mind below persona: it names no persona module (source-hygiene
# cognition_names_persona = 0); the verbs persona owns arrive through cognition::extensions,
# which persona fills at boot. The mind re-exports it under its old path.

[dependencies]
continuum-kernel = { path = "../continuum-kernel" }
continuum-engine = { path = "../continuum-engine" }
continuum-hands = { path = "../continuum-hands" }
continuum-live = { path = "../continuum-live" }
continuum-memory = { path = "../continuum-memory" }
continuum-perception = { path = "../continuum-perception" }
continuum-genome = { path = "../continuum-genome" }
continuum-experience = { path = "../continuum-experience" }
tokio.workspace = true
serde.workspace = true
serde_json.workspace = true
uuid.workspace = true
continuum-base = { path = "../continuum-base" }
continuum-context = { path = "../continuum-context" }
tool-working-set = { path = "../tool-working-set" } # the learned tool head: pure policy, no core dependency
schemars = { version = "0.8", features = ["uuid1"] }
continuum-airc-protocol = { path = "../continuum-airc-protocol" }
continuum-positron = { path = "../continuum-positron" }
continuum-client = { path = "../../client/continuum-client" }
reqwest = { version = "0.12", features = ["json", "multipart", "stream"] }
thiserror.workspace = true
dashmap = "6.1" # Lock-free concurrent HashMap
inventory = "0.3"
fs2 = "0.4" # Cross-platform advisory file locks (flock / LockFileEx)
toml = "0.8"
continuum-cli-lifecycle = { path = "../continuum-cli-lifecycle" } # the CLI's platform lifecycle; its tests must not link this crate
base64 = "0.22"
sha2 = "0.10" # SHA-256 for OAuth 2.0 PKCE code challenges (RFC 7636) + L1-6 contract canonical hash
airc-core.workspace = true
airc-blobs.workspace = true
airc-protocol.workspace = true
airc-lib.workspace = true
airc-work.workspace = true
async-trait.workspace = true
chrono.workspace = true
parking_lot.workspace = true
tokio-stream.workspace = true
futures-util.workspace = true
futures = "0.3"
once_cell.workspace = true
num_cpus = "1.16" # CPU count detection
dirs = "5.0"
sysinfo = "0.33" # Cross-platform CPU, memory, system resource monitoring
tracing.workspace = true
ts-rs.workspace = true # TypeScript type generation
arc-swap = "1.7" # Wait-free policy publish for SubstrateGovernor (Lane H)
image = "0.25"
regex = "1"

[dev-dependencies]
continuum-kernel = { path = "../continuum-kernel", features = ["test-fixtures"] } # every test build of this crate gets the per-process continuum home (card d11d9827)
tokio = { workspace = true, features = ["test-util"] }
tempfile = "3"
continuum-base = { path = "../continuum-base", features = ["test-fixtures"] }
continuum-client = { path = "../../client/continuum-client", features = ["test-fixtures"] }
continuum-positron = { path = "../continuum-positron", features = ["test-fixtures"] }
continuum-genome = { path = "../continuum-genome", features = ["test-fixtures"] }
continuum-experience = { path = "../continuum-experience", features = ["test-fixtures"] }

[features]
default = []
# The GPU backends are the engine's (llama, candle); cognition forwards them so it builds and
# tests on its own with the same flags core takes.
metal = ["continuum-engine/metal", "continuum-live/metal", "continuum-genome/metal"]
cuda = ["continuum-kernel/cuda", "continuum-engine/cuda", "continuum-genome/cuda"]
vulkan = ["continuum-kernel/vulkan", "continuum-engine/vulkan", "continuum-genome/vulkan"]
stress-tests = ["continuum-kernel/stress-tests", "continuum-genome/stress-tests"]
# Test-only code (fixtures shared with core's integration tests, the heuristic adapter it
# drives); production binaries never build with it.
test-fixtures = ["continuum-base/test-fixtures", "continuum-kernel/test-fixtures", "continuum-engine/test-fixtures", "continuum-hands/test-fixtures", "continuum-live/test-fixtures", "continuum-perception/test-fixtures", "continuum-genome/test-fixtures", "continuum-experience/test-fixtures"]
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ pub async fn apply_act(
};
// Perception and execution share the activity resolved by the bound-turn owner.
// Private turns retain their mind room at that boundary.
let private = crate::persona::mind_room::is_private_room(body.persona_id, room_id);
let private = crate::cognition::mind_room::is_private_room(body.persona_id, room_id);

// Call history is not a cache-validity proof. Reads can change, failures can
// recover, and earlier results may no longer fit the prompt. Execute through
Expand Down Expand Up @@ -518,19 +518,13 @@ pub async fn apply_act(
// the room whose line triggered the turn (`acting_card_of`).
let receipt_room = room_id;
if private {
crate::persona::mind_room::note_withheld(body.persona_id, "thought_line");
crate::cognition::mind_room::note_withheld(body.persona_id, "thought_line");
} else if !lines.is_empty() {
if let Some(rt) = crate::persona::airc_runtime_registry::PersonaAircRuntimeRegistry::try_global()
.and_then(|reg| reg.get(body.persona_id))
if let Some(published) =
crate::cognition::extensions::publish_in_room(body.persona_id, receipt_room, lines.join("\n")).await
{
match crate::persona::airc_citizen::publish_text_in_room(
rt.airc(),
receipt_room,
&lines.join("\n"),
)
.await
{
Ok(_) => continuum_base::probe!(
match published {
Ok(()) => continuum_base::probe!(
class = "room.work_receipt.published",
room = %receipt_room,
actor = %body.persona_id,
Expand All @@ -541,7 +535,7 @@ pub async fn apply_act(
class = "room.work_receipt.failed",
room = %room_id,
actor = %body.persona_id,
error = %e.to_string(),
error = %e,
"act receipts did not reach the room transcript — console feed unaffected"
),
}
Expand Down Expand Up @@ -590,14 +584,14 @@ pub async fn apply_act(
.first()
.map(|c| c.name.clone())
.unwrap_or_else(|| "action".to_string());
let obs_hash = crate::persona::inbox_admission::content_hash_sha256(&recall_observation);
let self_observation = crate::persona::engram::Engram {
let obs_hash = crate::cognition::inbox_admission::content_hash_sha256(&recall_observation);
let self_observation = crate::cognition::engram::Engram {
id: Uuid::new_v4(),
context_id: Some(room_id),
kind: crate::persona::engram::EngramKind::Episodic,
kind: crate::cognition::engram::EngramKind::Episodic,
content: recall_observation,
origin: crate::persona::engram::EngramOrigin::Tool(
crate::persona::engram::ToolInvocationRef {
origin: crate::cognition::engram::EngramOrigin::Tool(
crate::cognition::engram::ToolInvocationRef {
invocation_id: Uuid::new_v4(),
tool_name,
invoked_at_ms: now_ms,
Expand All @@ -607,11 +601,11 @@ pub async fn apply_act(
),
recall_keys: Vec::new(),
admitted_at_ms: now_ms,
trust_state_at_admission: crate::persona::engram::TrustState::SelfTrust,
trust_state_at_admission: crate::cognition::engram::TrustState::SelfTrust,
admission_trace_id: None,
};
match body.admission.admit_reflection(self_observation) {
Ok(crate::persona::engram::AdmissionDecision::Admit { engram, .. }) => {
Ok(crate::cognition::engram::AdmissionDecision::Admit { engram, .. }) => {
// Belt-and-braces with the recall gate: even excluded from semantic
// recall, keep the receipt's stored salience low so any OTHER surface
// (recency ranking, dashboards) treats it as proprioception, not
Expand All @@ -627,7 +621,7 @@ pub async fn apply_act(
body.admission.link_engrams(
engram.id,
prior,
crate::persona::engram_graph::EdgeKind::CausedBy,
crate::cognition::engram_graph::EdgeKind::CausedBy,
);
continuum_base::probe!(
class = "engram.edge.caused_by",
Expand Down Expand Up @@ -726,7 +720,7 @@ pub async fn apply_act(
// An act that changed a checkout wakes the one carry owner (modules::card_carry), which
// carries every resident's committed card work; a turn's end is no longer the only push.
if disk == super::disk_change::DiskChange::Changed {
crate::persona::card_carry::request();
crate::cognition::extensions::request_card_carry();
}

ActOutcome::Acted { acts }
Expand Down
Loading
Loading