Skip to content

Develop#8

Merged
graycyrus merged 10 commits intotinyhumansai:developfrom
M3gA-Mind:develop
Mar 25, 2026
Merged

Develop#8
graycyrus merged 10 commits intotinyhumansai:developfrom
M3gA-Mind:develop

Conversation

@M3gA-Mind
Copy link
Copy Markdown
Contributor

No description provided.

M3gA-Mind and others added 6 commits March 21, 2026 08:54
- Simplified test scripts in package.json by removing specific config references for vitest.
- Updated @tauri-apps/api dependency version to 2.10.1.
- Removed unused dependencies from yarn.lock and updated Cargo.toml and Cargo.lock for tinyhumansai to version 0.1.4.
- Enhanced memory management in Conversations and Login components by ensuring async token synchronization.
- Introduced recall_memory command in Tauri for improved context retrieval from memory.
- Added `chat_send` and `chat_cancel` Tauri commands for backend-driven conversation loops.
- Moved agentic loop logic from frontend to Rust, optimizing performance and reducing frontend responsibilities.
- Implemented event protocol (`chat:tool_call`, `chat:tool_result`, `chat:done`, `chat:error`) to communicate loop progress to the frontend.
- Introduced AI config loading, OpenClaw context building, and cancellation support for chat requests.
- Downgraded @tauri-apps/api to version 2.9.1 and updated @tauri-apps/cli to 2.9.6 in package.json.
- Added three.js library with version 0.183.2.
- Modified Login component to accept isWeb prop and refactored its structure for improved user experience.
- Updated build.rs for local builds and adjusted memory client references in memory module.
- Updated Welcome component to navigate to login based on isWeb prop.
@M3gA-Mind M3gA-Mind marked this pull request as draft March 25, 2026 06:51
…ust Cargo.lock with new source and checksum information.
…k; add detailed documentation for memory inference flow in new markdown file; refactor Login component to remove unnecessary isWeb prop; enhance Skills component with improved skill filtering and synchronization UI.
…go.lock; adjust memory client query_skill_context method to simplify namespace handling by removing integration_id parameter.
@M3gA-Mind M3gA-Mind marked this pull request as ready for review March 25, 2026 15:24
@graycyrus graycyrus merged commit 4442d35 into tinyhumansai:develop Mar 25, 2026
1 of 4 checks passed
sanil-23 added a commit to sanil-23/openhuman that referenced this pull request Apr 2, 2026
Fixes from CodeRabbit review on PR tinyhumansai#268:

- tinyhumansai#8 Two engine instances: Add global.rs singleton shared between
  HeartbeatEngine::run() and RPC handlers. Both use get_or_init_engine()
  so decision log, counters, and last_tick_at are always in sync.

- tinyhumansai#3 Dedup disabled: tick() now extracts actual document IDs from
  memory via build_situation_report_with_doc_ids() and passes them
  to decision_log.record(). filter_unsurfaced() actually filters now.

- tinyhumansai#5 Decision log not loaded on trigger: tick() loads persisted log
  from KV on first execution (total_ticks == 0), not only from run().

- tinyhumansai#4 Inconsistent action schema: handle_escalation() normalizes agent
  response into RecommendedAction[] via normalize_escalation_response().
  Both act and escalate paths store the same schema.

- tinyhumansai#7 Key collision: store_actions() uses millisecond timestamp + random
  suffix instead of second-precision truncation.

- tinyhumansai#10 No-changes unreachable: tick() checks has_new_data (unsurfaced
  doc IDs) OR has_memory_changes (report text) instead of naive string
  matching on environment section.
graycyrus pushed a commit that referenced this pull request Apr 2, 2026
…eat (#268)

* feat: subconscious loop — local-model background awareness via heartbeat

Add a subconscious inference layer to the heartbeat engine. On each
tick, the engine reads HEARTBEAT.md tasks, builds a delta-based
situation report (memory docs, graph relations, skills health,
environment), and evaluates them with the local Ollama model.

Architecture:
- HeartbeatEngine (scheduler) delegates to SubconsciousEngine (brain)
- HeartbeatConfig extended with inference_enabled, context_budget_tokens
- No separate SubconsciousConfig — all config lives under [heartbeat]
- Default HEARTBEAT.md ships with 3 active tasks (email, deadlines, skills)

Subconscious module (src/openhuman/subconscious/):
- engine.rs: tick logic, local model inference, escalation to cloud model
- situation_report.rs: delta assembler (memory, graph, skills, env, tasks)
- prompt.rs: task-driven system prompt for local model
- decision_log.rs: dedup tracking with 24h TTL and acknowledgment
- types.rs: Decision (noop/act/escalate), TickOutput, RecommendedAction
- schemas.rs: RPC controllers (subconscious_status, subconscious_trigger)
- integration_test.rs: two-tick lifecycle test with fixtures

Decision flow:
- noop: no changes, skip — no LLM call wasted
- act: local model recommends actions → stored in memory KV
- escalate: calls cloud model to resolve → concrete actions stored

Verified with real Ollama inference (gemma3:4b):
- Tick 1: ingested gmail+notion → "act: deadline needs attention" (high)
- Tick 2: ingested state changes → "act: deadline moved" (high)
- Skills health section populated from live skill registry

Closes #145

* feat: add subconscious_actions RPC endpoint

New endpoint openhuman.subconscious_actions returns stored action
entries from the subconscious KV namespace, sorted by most recent
first, with configurable limit (default 20).

Response format:
{
  "entries": [
    { "tick_at": 1775117975.58, "actions": [...] }
  ],
  "count": 1
}

The upcoming subconscious page will call this to display
notifications and recommended actions to the user.

* fix: budget underflow and UTF-8 panic in situation report truncation

- Use saturating_add for newline byte to prevent underflow when
  section exactly fills the remaining budget
- Truncate at valid UTF-8 char boundary using char_indices instead
  of raw byte slicing, which panicked on multibyte characters
- Add tests for exact-fit and multibyte truncation

* fix: address CodeRabbit review — shared engine, dedup, consistent schema

Fixes from CodeRabbit review on PR #268:

- #8 Two engine instances: Add global.rs singleton shared between
  HeartbeatEngine::run() and RPC handlers. Both use get_or_init_engine()
  so decision log, counters, and last_tick_at are always in sync.

- #3 Dedup disabled: tick() now extracts actual document IDs from
  memory via build_situation_report_with_doc_ids() and passes them
  to decision_log.record(). filter_unsurfaced() actually filters now.

- #5 Decision log not loaded on trigger: tick() loads persisted log
  from KV on first execution (total_ticks == 0), not only from run().

- #4 Inconsistent action schema: handle_escalation() normalizes agent
  response into RecommendedAction[] via normalize_escalation_response().
  Both act and escalate paths store the same schema.

- #7 Key collision: store_actions() uses millisecond timestamp + random
  suffix instead of second-precision truncation.

- #10 No-changes unreachable: tick() checks has_new_data (unsurfaced
  doc IDs) OR has_memory_changes (report text) instead of naive string
  matching on environment section.

* fix: include document content in situation report, not just titles

The local model needs actual content to evaluate HEARTBEAT.md tasks
meaningfully. Previously it only saw titles like "Deadline reminder"
with no way to know if it's urgent.

Now recalls content per namespace (up to 500 chars each, max 10
namespaces) via client.recall_namespace(). The model sees actual
email text and page content alongside the task checklist.

* fix: timestamp parsing, byte-boundary slicing, and truncation overshoot

- schemas.rs: split on first ':' after 'actions:' prefix before parsing
  timestamp, so keys like 'actions:123456:xyz' parse correctly
- situation_report.rs: use truncate_at_char_boundary() for error strings
  instead of raw byte slice which panics on multibyte characters
- situation_report.rs: fix append_section and truncate_at_char_boundary
  to use char END offset (i + len_utf8) in take_while condition, so
  multibyte chars that start before but end after the budget are excluded
@oxoxDev oxoxDev mentioned this pull request Apr 22, 2026
14 tasks
sanil-23 added a commit to sanil-23/openhuman that referenced this pull request Apr 28, 2026
…ems)

tinyhumansai#4  gmail unknown bucket — orphan:{id} fallback instead of collapsing
    all no-address messages into one "unknown" source tree; messages with
    neither address nor id are dropped with a warn (skip sentinel).

tinyhumansai#5  PII in gmail/ingest.rs — participants, source_id, and owner wrapped
    with redact() before logging; no email addresses in log output.

tinyhumansai#7  PII in chunker.rs — source_id in debug logs replaced with
    redact(source_id) hash.

tinyhumansai#8  Parent dir fsync after rename in atomic.rs — on Unix, open the parent
    directory and call sync_all() after a successful rename so the dirent
    is durable across a crash; best-effort warn on failure, non-fatal.

tinyhumansai#9  Body verify on re-stage in atomic.rs — when the path already exists,
    read and hash the on-disk body; if sha differs from the new body,
    remove the stale file and re-write atomically so SQLite content_sha256
    always matches the on-disk bytes. New unit test covers the re-write path.

tinyhumansai#10 PII in paths.rs — malformed source_id fallback log now emits
    redact(source_id) instead of the raw string.

tinyhumansai#11 PII in read.rs — sha256 mismatch warn logs now emit
    redact(abs_path) instead of abs_path.display().

tinyhumansai#13 Same-tx enqueue in handle_extract — append_buffer and topic_route
    jobs are built before the transaction opens and enqueued via
    enqueue_tx() inside the same tx that commits the lifecycle update,
    eliminating the crash window where lifecycle commits but jobs are lost.

tinyhumansai#16 PII in score/extract/mod.rs — LLM extractor info! log demoted to
    debug! and endpoint wrapped with redact_endpoint() to strip
    path/query/credentials from the URL.

tinyhumansai#17 Non-email scope slug in bucket_seal.rs — only the gmail: prefix is
    stripped before slugify; all other source kinds (slack:, discord:,
    document:, …) slugify the full scope string so slack:#eng and
    discord:#eng no longer produce the same "eng" slug and collide in
    summaries/source/.

tinyhumansai#18 Don't commit summary on stage_summary failure — bucket_seal.rs,
    global_tree/digest.rs, and global_tree/seal.rs now propagate
    stage_summary errors via .context()?  instead of falling back to a
    NULL content_path row; the seal is retried via the normal job-retry
    path. insert_summary_tx callers in those three paths now always pass
    Some(&staged) instead of Option.

tinyhumansai#20 PII in topic_tree/backfill.rs — all entity_id occurrences in log
    lines (info/debug/warn) replaced with redact(entity_id).

New shared helper: src/openhuman/memory/tree/util/redact.rs
  - redact(s)          → stable 8-hex-char SHA-256 prefix for PII fields
  - redact_endpoint(u) → host:port only (strips scheme, creds, path, query)
  - Full unit-test coverage for both helpers

Items tinyhumansai#14 (lease tokens) and tinyhumansai#19 (preview-vs-disk reader audit)
intentionally deferred to follow-up commits — both have larger blast
radius and need separate review.

Items tinyhumansai#1, tinyhumansai#12, tinyhumansai#15 pushed back on PR thread (verified false positive or
covered by upstream contract).

Items #2, tinyhumansai#3 deferred (pre-existing in slack_backfill.rs, not introduced
by this PR).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants