### Install and run LangQuant with Ollama Source: https://github.com/hermes-labs-ai/langquant/blob/main/README.md Sets up a virtual environment, installs LangQuant, pulls required Ollama models, and runs a sample goal. Use this to get started with the CLI. ```bash python3 -m venv .venv source .venv/bin/activate pip install langquant # Confirm the installed release before configuring local models langquant --version ollama pull qwen3.5:9b ollama pull qwen3.5:4b langquant --goal "Plan a small API change" ``` -------------------------------- ### Clone and set up the development environment Source: https://github.com/hermes-labs-ai/langquant/blob/main/CONTRIBUTING.md Use these commands to clone the repository, create a virtual environment, and install the package with development and experiment dependencies. Run them in a terminal from your preferred working directory. ```bash git clone https://github.com/hermes-labs-ai/langquant.git cd langquant python3 -m venv .venv source .venv/bin/activate python -m pip install -e ".[dev,experiments]" ``` -------------------------------- ### Install dev dependencies and run tests Source: https://github.com/hermes-labs-ai/langquant/blob/main/AGENTS.md Installs the development dependencies and runs the test suite and linter. This is the CI command set. ```bash python -m pip install -e ".[dev]" python -m pytest -q ruff check . ``` -------------------------------- ### Python: create and configure a session Source: https://github.com/hermes-labs-ai/langquant/blob/main/README.md Creates a LangQuantSession with main and state models, configures the assistant role and constraints, sends a chat message, and saves state. Use this to integrate LangQuant into Python applications. ```python from langquant import LangQuantSession session = LangQuantSession( main_model="qwen3.5:9b", state_model="qwen3.5:4b", approx_token_budget=7000, ) session.configure( role="senior backend engineer", style="direct, concise, technical", goal="design a rate limiter for a payments API", constraints=["no Redis"], ) reply = session.chat("We decided to use a token bucket.") print(reply) print(session.show_state()) session.save_state("state.json") ``` -------------------------------- ### Run scaffold amplification matrix Source: https://github.com/hermes-labs-ai/langquant/blob/main/AGENTS.md Runs the scaffold amplification matrix harness. ```bash python run_experiment.py ``` -------------------------------- ### Run LangQuant A/B experiment Source: https://github.com/hermes-labs-ai/langquant/blob/main/AGENTS.md Runs the LangQuant A/B continuity experiment. ```bash python conversation_ab_experiment.py ``` -------------------------------- ### Run tests and linting Source: https://github.com/hermes-labs-ai/langquant/blob/main/CONTRIBUTING.md Run the unit test suite with pytest and check code style with ruff. Unit tests use mocked HTTP calls and do not require Ollama; experiment runners require a local Ollama service and model downloads. ```bash python -m pytest -v ruff check . ``` -------------------------------- ### Run boundary tests and lint Source: https://github.com/hermes-labs-ai/langquant/blob/main/README.md Commands to run the request-boundary tests and linting. The tests use mocked model calls and do not require Ollama. They verify UI transcript content is absent from model requests and handle unavailable local model service. ```bash python -m pytest -q ruff check . ``` -------------------------------- ### Inspect main-model boundary with sed Source: https://github.com/hermes-labs-ai/langquant/blob/main/docs/EXPERIMENTS.md Prints lines 235-340 of langquant/core.py to inspect the main-model boundary. ```bash sed -n '235,340p' langquant/core.py ``` -------------------------------- ### Python: load state and continue Source: https://github.com/hermes-labs-ai/langquant/blob/main/README.md Loads a previously saved state from state.json into a new session and continues the conversation. Use this to resume work across sessions. ```python from langquant import LangQuantSession session = LangQuantSession() session.load_state("state.json") print(session.chat("What should we decide next?")) ``` -------------------------------- ### State transition equations Source: https://github.com/hermes-labs-ai/langquant/blob/main/README.md Shows the core state transition equations for LangQuant: the conversational model produces a reply from the current state and message, and the state updater produces the next state. The prior transcript is not an argument, making this a first-order loop. ```text reply_t = conversational_model(state_t, message_t) state_(t + 1) = state_updater(state_t, message_t, reply_t) ``` -------------------------------- ### Analyze results Source: https://github.com/hermes-labs-ai/langquant/blob/main/AGENTS.md Runs the information-theoretic analysis on experiment results. ```bash python analyze_results.py ``` -------------------------------- ### Rerun model experiments with Ollama models Source: https://github.com/hermes-labs-ai/langquant/blob/main/docs/EXPERIMENTS.md Reruns the model experiments after pulling the required local Ollama models. Overwrites result paths, so preserve existing artifacts before an intentional rerun. ```bash ollama pull qwen3.5:9b ollama pull qwen3.5:4b python conversation_ab_experiment.py python continuity_experiment.py python run_experiment.py ``` -------------------------------- ### Pull Ollama models Source: https://github.com/hermes-labs-ai/langquant/blob/main/AGENTS.md Pulls the required Ollama models locally before running experiments. ```bash ollama pull qwen3.5:9b ollama pull qwen3.5:4b ``` -------------------------------- ### CLI conversation commands Source: https://github.com/hermes-labs-ai/langquant/blob/main/README.md Shows the interactive commands available inside a LangQuant conversation: /state, /transcript, /save, and /quit. Use /state to inspect the exact state passed to the model. ```text /state show the exact state for the next model call /transcript show the human-facing transcript /save state.json save the current state /quit end the session ``` -------------------------------- ### Recompute continuity table with jq Source: https://github.com/hermes-labs-ai/langquant/blob/main/docs/EXPERIMENTS.md Recomputes the continuity table from the rigorous summary file, grouping by condition and calculating completed sessions, mean probe score, and mean final state words. ```bash jq -s ' group_by(.condition) | map({ condition: .[0].condition, completed_sessions: length, mean_probe_score: (map(.mean_recall) | add / length), mean_final_state_words: (map(.final_scaffold_tokens) | add / length) }) ' results/lpci_rigorous_summary.jsonl ``` -------------------------------- ### Count rows in result files with wc -l Source: https://github.com/hermes-labs-ai/langquant/blob/main/docs/EXPERIMENTS.md Counts lines in three result files to verify their sizes. Useful for a quick sanity check of the committed artifacts. ```bash wc -l results/lpci_ab_test.jsonl \ results/lpci_rigorous_summary.jsonl \ results/full_run_v1.jsonl ``` -------------------------------- ### Confirm missing cell with jq Source: https://github.com/hermes-labs-ai/langquant/blob/main/docs/EXPERIMENTS.md Filters the rigorous summary for the 'compressed' condition and extracts topic and replication fields to confirm the one missing cell. ```bash jq -s ' map(select(.condition == "compressed")) | map([.topic, .replication]) ' results/lpci_rigorous_summary.jsonl ```