Skip to main content
Welcome. This site supports keyboard navigation and screen readers. Press ? at any time for keyboard shortcuts. Press [ to focus the sidebar, ] to focus the content. High-contrast themes are available via the toolbar.
serard@dev00:~/cv

QuietCli: useful answers beyond smaller CLI output

An AI agent asks whether a repository needs review. Git produces a terminal report. QuietCli lets the agent write the program between those two things: run the documented commands, compute the relevant facts locally, and return a small result whose limitations remain visible.

The useful answer might contain only these domain properties. This is an illustrative projection, rather than a complete execution envelope:

{"Branch":"main","Changed":1,"Untracked":1,"Clean":false,"AnswerComplete":true}

The following PowerShell 7.4+ Core example shows the code the agent can write to answer this question. It contains the Git parsing and counting logic from Generated-GitOverview on GitHub (ouvre dans une nouvelle fenêtre) directly: the agent chooses the fields, calculates them locally and reduces the output to the useful answer. QuietCli handles execution and the result envelope. Extract the complete QuietCli ZIP (ouvre dans une nouvelle fenêtre), then set $moduleRoot and $repository to your module and repository paths. The output above corresponds to branch main, one changed tracked entry and one untracked entry; your counts will depend on the repository.

#requires -Version 7.4
#requires -PSEdition Core

$repository = 'C:/code/my-project'
$moduleRoot = 'C:/tools/QuietCli'
Import-Module (Join-Path $moduleRoot 'QuietCli.PoSh.psd1') -ErrorAction Stop
$repositoryPath = [IO.Path]::GetFullPath($repository)

# The agent writes the commands, parser and calculations for this question.
$result = Invoke-QuietTask -MaxOutputBytes 2048 -ArgumentList @($repositoryPath) -ScriptBlock {
    param($repo)

    $branch = Invoke-QuietStep branch {
        Invoke-QuietCli -FilePath git -ArgumentList @('branch', '--show-current') `
            -WorkingDirectory $repo -Summary 'Current branch extracted.' -Parse {
                param($capture)
                $name = $capture.Stdout.Trim()
                [pscustomobject]@{ Name = $name; Detached = ($name.Length -eq 0) }
            }
    }
    if ($branch.Outcome -ne 'Success') { return }

    $state = @{ Changed = 0L; Untracked = 0L; SkipRenameSource = $false }
    $status = Invoke-QuietStep status {
        Invoke-QuietCli -FilePath git `
            -ArgumentList @('status', '--porcelain=v1', '-z', '--untracked-files=normal') `
            -WorkingDirectory $repo -RecordDelimiter ([char]0) -State $state `
            -Summary 'Git status counted locally.' -OnRecord {
                param($record, $state)
                if ($record.Stream -ne 'stdout' -or $record.Truncated) { return }
                if ($state.SkipRenameSource) { $state.SkipRenameSource = $false; return }
                if ($record.Text.Length -lt 4 -or $record.Text[2] -ne ' ') {
                    throw 'Unsupported Git status record.'
                }

                $code = $record.Text.Substring(0, 2)
                if ($code -eq '??') { $state.Untracked++ }
                else {
                    $state.Changed++
                    # A rename/copy has a second NUL-delimited path, not another entry.
                    if ($code.Contains('R') -or $code.Contains('C')) {
                        $state.SkipRenameSource = $true
                    }
                }
            } -Complete {
                param($state, $capture)
                if ($state.SkipRenameSource) { throw 'Incomplete rename record.' }
                [pscustomobject]@{ Changed = $state.Changed; Untracked = $state.Untracked }
            }
    }
    if ($status.Outcome -ne 'Success') { return }

    [pscustomobject]@{
        Branch = $branch.Data.Name
        Detached = $branch.Data.Detached
        Changed = $status.Data.Changed
        Untracked = $status.Data.Untracked
        Clean = ($status.Data.Changed -eq 0 -and $status.Data.Untracked -eq 0)
        AnswerComplete = $true
    }
}

if ($result.Outcome -ne 'Success' -or
    $result.Execution.AnalysisComplete -ne $true -or
    $result.Truncation.Applied -or
    $result.Data.AnswerComplete -ne $true) {
    throw "Git overview is incomplete: $($result.Outcome). Inspect the full result."
}

# Keep $result for its execution diagnostics; display only the five domain fields.
$result.Data |
    Select-Object Branch, Changed, Untracked, Clean, AnswerComplete |
    ConvertTo-Json -Compress

This is the agent-authored companion itself: native Git commands, a small state object and a PowerShell reduction. It can run without an RTK proxy. It counts entries in Git's machine-readable status, with untracked directories grouped by --untracked-files=normal. Chapter 4 explains the parser and the counter boundaries.

The question determines the properties. Reviewing the actual changes requires different data, such as selected paths and targeted content. A compact answer is useful only when it preserves the information needed for the current decision.

QuietCli combines a documented agent workflow with a PowerShell runtime. The agent authors commands, parsers, conditions and calculations. The runtime manages native execution and packages results. It does not discover the meaning of a particular tool's output or choose the business question automatically.

This retains the central interest of OPumper: reusable local automation produces decision evidence before the model reads output. QuietCli expresses that workflow through companion scripts and tasks; OPumper adds a provider and registry architecture. RTK offers another useful entry point through its command proxy. Chapter 7 explains their practical combination without claiming comparative performance measurements.

Read the series

Chapter What you will learn
1. From Terminal Output to Useful Answers Define the information worth returning and preserve its meaning.
2. The Agent Writes the Companion Turn documentation and a question into inspectable local code.
3. A Result Contract You Can Trust Interpret status, domain completeness and omissions together.
4. A Practical Git Companion Count Git entries using the supplied companion and documented formats.
5. Streaming Long-Running Jobs Reduce events progressively and require completion evidence.
6. Compose Tasks and Reuse Scripts Reuse a companion while retaining failures under one final budget.
7. QuietCli, OPumper and RTK Together Choose a suitable approach and avoid accidental information loss.
8. Costs, Limits and Verification Reproduce the examples and assess the limits of the evidence.

Run the examples

The examples and runtime are maintained in the FrenchExDev repository (ouvre dans une nouvelle fenêtre). Download the complete QuietCli ZIP (ouvre dans une nouvelle fenêtre), which extracts into QuietCli/ and includes version 0.1.0, the skill, fixtures and verification launcher (ouvre dans une nouvelle fenêtre). In PowerShell 7.4+ Core, with Git and Python already available:

$moduleRoot = 'C:/tools/QuietCli'
& (Join-Path $moduleRoot 'scripts/Invoke-Examples.ps1') -QuietCliRoot $moduleRoot -Python python3

To exercise another local checkout explicitly:

$moduleRoot = 'C:/code/FrenchExDev/FrenchExDev_i2/PoSh/FrenchExDev/FrenchExDev.QuietCli.PoSh'
& (Join-Path $moduleRoot 'scripts/Invoke-Examples.ps1') -QuietCliRoot $moduleRoot `
    -Python python3

The runner uses a temporary repository, checks success and failure paths, removes that repository, and emits one compact verification summary. Its full report identifies the executed checks. The examples use 2,048 UTF-8 bytes as their final output budget; this is a byte limit, not a tokenizer measurement. The published streaming run used an offline Podman adapter because host Python was unavailable; chapter 8 explains that environment choice and the optional -PythonImage parameter.

Reuse the generation instructions

The standalone master prompt specifies the source inspection, chapter structure, examples, comparison rules and acceptance checks needed to regenerate this series. The module, examples and skill on GitHub (ouvre dans une nouvelle fenêtre) are the maintained code source. The source manifest identifies the packaged files by hash and records the external references checked. GitHub links follow the moving develop branch; retain the downloaded package manifest when reproducing a particular version.

The related RTK vs Pump-Me series develops the provider-based approach in more depth. Start with chapter 1 for the common requirement behind both approaches.

⬇ Download