Skip to content

docs(ai): add PowerShell instructions to the minimal chat example#108567

Merged
steipete merged 2 commits into
openclaw:mainfrom
VectorPeak:docs/ai-chat-powershell
Jul 16, 2026
Merged

docs(ai): add PowerShell instructions to the minimal chat example#108567
steipete merged 2 commits into
openclaw:mainfrom
VectorPeak:docs/ai-chat-powershell

Conversation

@VectorPeak

@VectorPeak VectorPeak commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Resolves a documentation gap where developers following the minimal @openclaw/ai example from native PowerShell could not directly use the documented environment-variable commands.

The existing KEY=value command syntax is valid in POSIX shells, but PowerShell treats ANTHROPIC_API_KEY=... as an executable name and exits before Node starts.

Why This Change Was Made

The example now provides separate POSIX and PowerShell commands, uses the repository's secret-scanner-safe placeholders, states how long PowerShell assignments remain in scope, and shows how to clear both session-scoped keys with $env:KEY = $null. The script header points to the README as the canonical command reference so the shell-specific instructions do not drift.

Runtime behavior, provider selection, and the keyless Ollama command are unchanged.

User Impact

Developers can run the example from either a POSIX shell or native PowerShell without translating environment-variable syntax. PowerShell users are also shown how to remove the session-scoped API keys without waiting for the shell to close.

Evidence

User-realistic path:

@openclaw/ai reference -> examples/ai-chat -> native PowerShell
  -> copy environment-variable command -> PowerShell command parsing
  -> Node process

Before, the POSIX form fails before Node starts:

ANTHROPIC_API_KEY=example-anthropic-key-not-real : The term ... is not recognized
CommandNotFoundException
exit 1

After, a no-network Node probe receives both the PowerShell environment variable and the quoted prompt:

{"key":"example-anthropic-key-not-real","argv":["Say hello"]}

The cleanup now uses Microsoft's documented PowerShell 5.1 environment-variable contract: $env:KEY = $null removes that variable from the current process session, while child processes inherit assigned environment variables. See about_Environment_Variables.

Validation:

  • node --check examples/ai-chat/index.mjs - passed
  • git diff --check - passed
  • node scripts/check-changed.mjs -- examples/ai-chat/README.md examples/ai-chat/index.mjs - passed all fail-safe lanes on Blacksmith Testbox (run 29494981621, exit 0)
  • Contributor Windows PowerShell 5.1 environment assignment and child-process probe - passed
  • No real credentials or provider requests were used

@openclaw-barnacle openclaw-barnacle Bot added size: XS triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. and removed triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Jul 16, 2026
@VectorPeak
VectorPeak force-pushed the docs/ai-chat-powershell branch from 60da87f to 6294d99 Compare July 16, 2026 02:52
@VectorPeak

VectorPeak commented Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

Updated the PowerShell cleanup documentation on current single-commit head e1618d52eec.

The documented command uses -ErrorAction SilentlyContinue, so it removes whichever session-scoped API key was set without visible error output or interruption when the other provider variable is absent. PowerShell may still record that suppressed non-terminating error in $Error and set $? to false; the PR body states this precisely.

A Windows PowerShell 5.1 one-provider cleanup probe passed, as did oxfmt, isolated markdownlint-cli2, node --check, and git diff --check. Current-head remote CI is green with no failed or pending checks; ClawSweeper review is still running.

@openclaw-barnacle openclaw-barnacle Bot added triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. and removed triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Jul 16, 2026
@VectorPeak
VectorPeak force-pushed the docs/ai-chat-powershell branch from 1f86b4a to f7a47e0 Compare July 16, 2026 04:32
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Jul 16, 2026
@clawsweeper

clawsweeper Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 16, 2026, 2:16 AM ET / 06:16 UTC.

Summary
Adds native PowerShell run and API-key cleanup commands to the minimal @openclaw/ai example and moves shell-specific invocation guidance from the script header into its README.

PR surface: Docs +17, Other -2. Total +15 across 2 files.

Reproducibility: yes. Running the current POSIX-style inline environment assignment in native PowerShell fails before Node starts, and the PR includes the resulting CommandNotFoundException plus an after-change PowerShell probe.

Review metrics: none identified.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🐚 platinum hermit
Patch quality: 🦞 diamond lobster
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • none.

Next step before merge

  • [P2] No repair lane is needed; the open PR has no actionable defect and only needs ordinary maintainer review and merge handling.

Security
Cleared: The patch only changes example documentation and a script comment, uses explicitly non-secret placeholders, and introduces no dependency, permission, workflow, credential-handling, or executable supply-chain change.

Review details

Best possible solution:

Land the narrow cross-shell documentation update after the normal exact-head merge gate, keeping the README as the single command reference and leaving runtime/provider behavior unchanged.

Do we have a high-confidence way to reproduce the issue?

Yes. Running the current POSIX-style inline environment assignment in native PowerShell fails before Node starts, and the PR includes the resulting CommandNotFoundException plus an after-change PowerShell probe.

Is this the best way to solve the issue?

Yes. Separating POSIX and PowerShell commands in the example README is the narrowest maintainable fix, while replacing the duplicate script-header commands with a README pointer prevents shell-specific instructions from drifting.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 5f2828b50ada.

Label changes

Label justifications:

  • P3: This is a low-risk documentation and developer-ergonomics improvement for native PowerShell users.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR provides after-change PowerShell live output showing environment and argument propagation plus a Windows PowerShell 5.1 cleanup probe; these directly demonstrate the documented behavior without using real credentials or network requests.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR provides after-change PowerShell live output showing environment and argument propagation plus a Windows PowerShell 5.1 cleanup probe; these directly demonstrate the documented behavior without using real credentials or network requests.
Evidence reviewed

PR surface:

Docs +17, Other -2. Total +15 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 0 0 0 0
Docs 1 19 2 +17
Config 0 0 0 0
Generated 0 0 0 0
Other 1 1 3 -2
Total 2 20 5 +15

What I checked:

  • Current-main documentation gap: At current main, the example exposes inline POSIX KEY=value command invocations, which native PowerShell parses as an executable name rather than an environment assignment. (examples/ai-chat/README.md:9, 5f2828b50ada)
  • Canonical example relationship: The public @openclaw/ai technical reference directs library consumers to examples/ai-chat, so cross-shell correctness in this README directly affects the supported runnable example. Public docs: docs/reference/openclaw-ai.md. (docs/reference/openclaw-ai.md:105, 5f2828b50ada)
  • PowerShell behavior proof: The PR records the pre-change CommandNotFoundException, an after-change no-network Node probe preserving both the environment variable and quoted prompt, and a Windows PowerShell 5.1 cleanup probe with only one provider key set. (examples/ai-chat/README.md:19, 0efadb843510)
  • Exact-head validation: The provided GitHub context reports successful documentation, lint, security, real-behavior-proof, build, and aggregate CI gates for the current PR head. (0efadb843510)
  • History inspection limitation: The required read-only local git history command could not start because the execution sandbox failed during loopback initialization; available repository and GitHub evidence still supports the functional verdict, but ownership provenance remains lower confidence. (examples/ai-chat/README.md:1)

Likely related people:

  • steipete: Recent repository history and public technical-reference ownership connect this account to top-level OpenClaw package documentation; the exact example-file provenance could not be confirmed because local git inspection was unavailable. (role: adjacent documentation and package owner; confidence: low; files: docs/reference/openclaw-ai.md, examples/ai-chat/README.md, examples/ai-chat/index.mjs)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
Review history (1 earlier review cycle)
  • reviewed 2026-07-16T05:33:28.486Z sha 0efadb8 :: needs maintainer review before merge. :: none

@VectorPeak
VectorPeak force-pushed the docs/ai-chat-powershell branch 3 times, most recently from e1618d5 to 36f9a94 Compare July 16, 2026 11:06
@steipete steipete self-assigned this Jul 16, 2026
VectorPeak and others added 2 commits July 16, 2026 12:34
Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
Co-authored-by: clawsweeper[bot] <274271284+clawsweeper[bot]@users.noreply.github.com>
@steipete
steipete force-pushed the docs/ai-chat-powershell branch from 36f9a94 to 38ddcb7 Compare July 16, 2026 11:47
@steipete

Copy link
Copy Markdown
Contributor

Maintainer review complete. This is the best fix: the example README owns shell-specific invocations, while index.mjs now points there instead of duplicating commands.

I rebased the branch and refined cleanup to PowerShell's official $env:KEY = $null form. This removes each process-scoped variable without the suppressed missing-path error state from the earlier combined Remove-Item command.

Proof on exact head 38ddcb7bbbef0ca85b5c7ed6a3b2bbf31aeab867:

Known gap: this Mac has no local pwsh; setup behavior has the contributor's Windows PowerShell 5.1 child-process probe, and cleanup follows the official 5.1 contract directly. No real keys or provider requests used.

@steipete
steipete merged commit b3c0aaf into openclaw:main Jul 16, 2026
93 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 17, 2026
…enclaw#108567)

* docs(ai): add PowerShell instructions to the minimal chat example

Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
Co-authored-by: clawsweeper[bot] <274271284+clawsweeper[bot]@users.noreply.github.com>

* docs(ai): simplify PowerShell key cleanup

---------

Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
Co-authored-by: clawsweeper[bot] <274271284+clawsweeper[bot]@users.noreply.github.com>
Co-authored-by: Peter Steinberger <steipete@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants