Skip to content

feat(cli): add 'add-all' command and auto_delete_added_files config - #232

Open
sebastianbraun25 wants to merge 5 commits into
VectifyAI:mainfrom
sebastianbraun25:feat/issue-231-add-all-command
Open

feat(cli): add 'add-all' command and auto_delete_added_files config#232
sebastianbraun25 wants to merge 5 commits into
VectifyAI:mainfrom
sebastianbraun25:feat/issue-231-add-all-command

Conversation

@sebastianbraun25

@sebastianbraun25 sebastianbraun25 commented Aug 27, 2026

Copy link
Copy Markdown

Problem

The openkb add command supports adding directories recursively, but users who frequently download documents to /raw must manually invoke openkb add raw/ and then manually delete processed files. There is no batch processing command for the /raw staging directory, and no configuration option to auto-delete successfully ingested files and duplicates.

Solution / Changes

New CLI command:

  • openkb add-all processes all files in the KB's raw/ directory recursively
  • Ingests all supported file types (PDF, Markdown, DOCX, PPTX, XLSX, XLS, HTML, TXT, CSV)
  • Returns summary of operation: Added, Skipped, Failed, Deleted counts

New configuration parameter:

  • auto_delete_added_files (boolean, default: false)
  • When enabled, both add and add-all automatically delete files after processing
  • Deletes on both "added" (successful ingestion) and "skipped" (duplicate/already in KB)
  • Preserves "failed" files to allow user retries
  • Applies to all ingest methods: direct files, directories, and URLs

Implementation:

  • Added _delete_if_auto_cleanup_enabled() helper function to handle cleanup logic
  • Updated both add and add-all commands to use the helper function
  • Updated docstrings to document cleanup behavior on both success and skip cases

Issues

Sebastian Braun added 5 commits August 27, 2026 15:27
- Added retryable exception classifier (_should_retry_exception)
- Modified _llm_call() to pass retries=2 to litellm.completion()
- Modified _llm_call_async() to pass retries=2 to litellm.acompletion()
- LiteLLM handles exponential backoff (base 2) internally
- Retries transient errors (Timeout, RateLimitError, ConnectionError)
- Skips retry for permanent errors (ValueError, Auth, BadRequest)
- Added comprehensive unit tests for exception filtering logic

Fixes VectifyAI#229
…ption

- New 'openkb add-all' command processes all files in raw/ directory
- New config parameter 'auto_delete_added_files' (default: false)
- When enabled, both 'add' and 'add-all' automatically delete successfully ingested files
- Updated help texts to document the new cleanup behavior
- Config applies to all ingest methods: direct files, directories, and URLs
Duplicates (skipped files) should also be auto-deleted when auto_delete_added_files
is enabled, so raw/ stays clean. Only 'failed' status files are preserved to allow
retries. Updated docstrings and helper function logic accordingly.
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(cli): add-all command and auto_delete_added_files config

1 participant