Skip to main content

sem 🧰

PyPI version Python versions License: MIT Build Status

sem (distributed as the sempropos package) is an open-source, local, offline-first CLI tool that turns a natural-language task description into a shell command. It retrieves relevant context from your system's local man pages and synthesizes the output using a local model.

Say goodbye to complex web searches just to find the right flag — sem keeps it entirely on your machine.

✨ Features

  • Privacy First, Offline First: No API keys, no telemetry, no cloud backend required. Run entirely on your machine.
  • Local SQLite Index: Fast retrieval of man pages (sections 1 and 8).
  • Semantic Retrieval: Hybrid ranking via BM25, embedding similarity, weighted score fusion, and an exact-tool-name boost.
  • Fast local inference: Uses Ollama (with reasoning disabled and the model kept warm) for near-instant answers, and falls back to showing matched man pages when no model is available.
  • Pluggable providers: Ollama out of the box, plus any OpenAI-compatible endpoint (vLLM, LM Studio, llama.cpp server, a gateway…). More providers are on the way.
  • Shell integration: Press Ctrl+S to turn the natural-language sentence you just typed into a command, in place.
  • Smart staleness checks: Detects when your package manager updates software and gently prompts an index refresh.

🚀 Quick Start

uv tool install sempropos
sem install          # check requirements, download the embedding model, build the index

Install from source

git clone https://github.com/ADPer0705/sempropos.git
cd sempropos
uv venv && uv sync
uv run sem install

sem install writes a default configuration, downloads the embedding model into the local data directory (so it works offline afterwards), and builds the index. If Ollama is running it is selected as the synthesis backend; otherwise sem still works and falls back to showing matched man pages.

📖 Usage

The Main Query

Describe what you want to do in natural language. A bare query works, and ask is available when you want to be explicit:

sem "list files in archive.7z"
sem ask "find all files larger than 100MB"
sem ask "monitor network traffic on eth0"

If it succeeds, you'll be handed the correct shell invocation instantly.

Commands

Management is done with subcommands, not flags:

sem install      # First-time setup: check requirements, write config, build the index
sem update       # Refresh the index with newly installed tools (incremental)
sem check        # Check index freshness and completeness
sem configure    # Choose synthesis/embedding providers interactively
sem providers    # List providers and whether they are available
sem init zsh     # Print shell integration for zsh (also: bash, fish)
sem version      # Print the version

🐚 Shell integration (Ctrl+S)

Add one line to your shell rc, then reload it:

# ~/.zshrc  (or ~/.bashrc; use `sem init fish` for fish)
eval "$(sem init zsh)"

Now, instead of running sem as a separate command, type the natural-language task directly on your prompt and press Ctrl+S. The line is replaced in place with the generated command, ready to review and run:

❯ find all files larger than 100MB        # press Ctrl+S
❯ find . -type f -size +100M

Notes:

  • The snippet runs stty -ixon, which frees Ctrl+S from the terminal's XOFF/flow-control behavior. If your terminal still intercepts it, you can re-bind a different key (for example ^G) by editing the bindkey/bind line.
  • Ctrl+R (history) and Ctrl+T (files) are left to fzf; sem only adds Ctrl+S.
  • The command is inserted, never executed — you always get the final say.

🧠 Backend behavior

Synthesis backend selection order per query:

  1. Ollama if the daemon is reachable, using the configured model.
  2. OpenAI-compatible endpoint if one is configured (base_url).
  3. tier0 fallback: retrieved tools, key flags, and examples, with no LLM.

To keep queries fast, Ollama is called with reasoning/thinking disabled, a temperature of 0, a bounded output length, and a long keep_alive so the model stays warm between invocations. sem install / update warm the model once so your first real query is not the one paying the load cost.

The default recommendation is a small instruct model (see RECOMMENDED_SYNTHESIS_MODEL) that stays fast on most consumer hardware while remaining capable when grounded by retrieved man-page context. sem configure lets you opt into a larger model or a remote endpoint.

When your package database changes since the last index, sem prints a non-blocking warning so you know it's time to run sem update.

📁 Data Layout

Default location for data assets:

~/.local/share/sempropos/
	index.db
	tool_embeddings.npy
	tool_embedding_ids.npy
	index.meta
	last_indexed
	embeddings/          # pinned embedding-model cache (kept for offline use)

Flag ranking uses the SQLite FTS5 index, so no flag embedding files are needed.

Override the data location with:

export SEMPROPOS_DATA_DIR=/path/to/sempropos-data

🤝 Contributing

We welcome contributions from everyone! Whether you're fixing bugs, adding new features, or improving documentation, your help makes sem better for the entire community.

Please read our CONTRIBUTING.md for conventions on pull requests, code style, and reporting issues.

🧪 Testing & Quality

Tests are being rebuilt. Until the suite returns, CI installs the package and verifies that every module imports cleanly on Python 3.11–3.13.

The quality policy for this repository remains:

  • Running the tool must never require an API key.
  • Provider integration tests are mocked/offline by default for deterministic CI runs.
  • Optional live provider smoke checks are local-only and guarded by explicit env vars/markers.

Local checks:

make lint     # ruff (when development dependencies are installed)
make format   # ruff format + autofix

📄 License

This project is licensed under the MIT License.

💬 Community & Support

  • If you found a bug or have a feature request, please open an issue.
  • Want to chat or ask a question? Join the discussion on GitHub Discussions.

Metadata

Release files for sempropos 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sempropos 0.2.0
File Size Uploaded Provenance Actions
sempropos-0.2.0.tar.gz 48.4 kB With provenance Details for sempropos-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sempropos 0.2.0
File Interpreter ABI Platform Actions
sempropos-0.2.0-py3-none-any.whl Python 3 none any Details for sempropos-0.2.0-py3-none-any.whl

Total release size: 103.1 kB

Release files / sempropos-0.2.0.tar.gz

Download URL sempropos-0.2.0.tar.gz
Size 48.4 kB
Tags Source
SHA-256 checksum
How to use checksums
263229b13765a56761a1d77586ec88f19fd39f7f444d8d3baee293e4948993bf
BLAKE2b-256 checksum
How to use checksums
516ea78700f4d55a2923f53def482231c25c2513bb6c3191d1295b45224d3885
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 29, 2026.

Transparency log

Release files / sempropos-0.2.0-py3-none-any.whl

Download URL sempropos-0.2.0-py3-none-any.whl
Size 54.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c3e59b3e040284b22a041e11d14fe618acb325e45b879724fbea7060aea0f0de
BLAKE2b-256 checksum
How to use checksums
176db2cc3145c21726f3370021ba2f5b01c70aef032fbc19166992d1c00789ee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 29, 2026.

Transparency log

Security for sempropos 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for sempropos-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 29, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page