Skip to content

feat(#46): external knowledge import — markdown, text, auto-detect - #333

Merged
ajianaz merged 1 commit into
developfrom
feat/v020-46-external-import
Jun 14, 2026
Merged

ajianaz merged 1 commit into
developfrom
feat/v020-46-external-import

Conversation

@ajianaz

@ajianaz ajianaz commented Jun 14, 2026

Copy link
Copy Markdown
Collaborator

Closes #46

Changes

Extended Import command

# Auto-detect format
uteke import README.md --tags docs

# Explicit format
uteke import notes.md --format markdown --tags notes
uteke import data.jsonl --format jsonl

# Stdin
echo "Quick note" | uteke import - --tags quick

# Plain text
uteke import notes.txt --format text --tags journal

Format detection

  • .md/.markdown → markdown (split by #/##/### headings)
  • .jsonl → JSONL (existing behavior)
  • .txt/.csv → text (split by double newline paragraphs)
  • Content starting with { → JSONL
  • Default fallback → text

Markdown splitting

  • Each #/##/### heading starts a new chunk
  • Heading + body becomes one memory
  • Very short chunks (<10 chars) filtered

Tests

  • cargo test --workspace ✅ (162 passed, 5 ignored)
  • cargo clippy --workspace -- -D warnings ✅
  • cargo fmt --all ✅

- CLI: `uteke import <file> --tags a,b --format markdown`
- Auto-detect format from extension (.md, .jsonl, .txt) or content
- Markdown: split by headings (##), each section becomes a memory
- Text: split by double newline (paragraphs)
- JSONL: existing behavior preserved
- Stdin: `echo 'text' | uteke import - --tags note`
- --format flag: auto (default), jsonl, markdown, text

Closes #46
}
}
}

use uteke_core::ImportResult;

let chunks: Vec<String> = if content.contains("\n# ") || content.contains("\n## ") {
// Markdown with headings — split by headings
@github-actions

Copy link
Copy Markdown

🔍 Cora AI Code Review

❌ Blocked — critical issues found.

🔴 Error (2)

  • crates/uteke-cli/src/commands/maintenance.rs:216 — In import_text, markdown is detected with content.contains("\n# ") || content.contains("\n## "). This only matches headings preceded by a newline, so a markdown document that begins with # or ## on the first line will not be treated as markdown and will instead be split as plain text paragraphs. That changes chunking behavior for a common valid markdown case.
  • crates/uteke-cli/src/commands/maintenance.rs:228 — The new import_text implementation swallows all uteke.remember(...) errors by logging a warning and incrementing skipped, then always returns Ok(ImportResult { imported, skipped }). If all chunks fail, run_import still prints a success message (✓ Imported 0 memories ...) and exits successfully. This is a behavior regression from the JSONL path, which returns an error when the import operation fails.

Review powered by cora-cli · BYOK · MIT

@ajianaz
ajianaz merged commit 3c4a1c2 into develop Jun 14, 2026
8 of 9 checks passed
@ajianaz
ajianaz deleted the feat/v020-46-external-import branch June 14, 2026 06:28
ajianaz added a commit that referenced this pull request Aug 13, 2026
)

- CLI: `uteke import <file> --tags a,b --format markdown`
- Auto-detect format from extension (.md, .jsonl, .txt) or content
- Markdown: split by headings (##), each section becomes a memory
- Text: split by double newline (paragraphs)
- JSONL: existing behavior preserved
- Stdin: `echo 'text' | uteke import - --tags note`
- --format flag: auto (default), jsonl, markdown, text

Closes #46
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.

feat: import from external knowledge sources

2 participants