feat(cli): add org support for /kiloclaw command#8218
Merged
Conversation
Pass the selected organization context through to KiloClaw API endpoints so the /kiloclaw command resolves the correct org-scoped instance when a team is selected via /teams.
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (4 files)
Reviewed by gpt-5.4-2026-03-05 · 166,635 tokens |
Align variable naming with existing patterns in the same file (lines 326, 396).
kirillk
reviewed
Apr 2, 2026
| headers[HEADER_ORGANIZATIONID] = organizationId | ||
| } | ||
| // kilocode_change end | ||
|
|
Contributor
There was a problem hiding this comment.
do we need kilocode_change here?
kirillk
approved these changes
Apr 2, 2026
jliounis
pushed a commit
to jliounis/kilocode
that referenced
this pull request
May 18, 2026
…-chat-orgs feat(cli): add org support for /kiloclaw command
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
The
/kiloclawcommand always resolved the user's personal KiloClaw instance, even when the user had selected an organization via/teams. This PR adds organization support so the command resolves the correct org-scoped instance when a team is active.Implementation
The org context flows through 3 layers, following the same pattern used by existing org-aware endpoints (
/notifications,/fim,/modes):Gateway (
packages/kilo-gateway/src/server/routes.ts): Both/claw/statusand/claw/chat-credentialshandlers now readauth.accountId(set by/teams) and forward it as theX-KiloCode-OrganizationIdheader when proxying to the cloud API.Command handler (
packages/opencode/src/kilocode/kilo-commands.tsx): The/kiloclawonSelectnow fetchessdk.client.kilo.profile()in parallel with the status check to obtaincurrentOrgId, and passes it to the setup/upgrade dialogs.Dialogs (
dialog-claw-setup.tsx,dialog-claw-upgrade.tsx): Both accept anorgIdprop and construct the correct dashboard URL —https://app.kilo.ai/organizations/{orgId}/clawwhen in org context, falling back tohttps://app.kilo.ai/clawfor personal.Cloud changes (separate repo —
cloud/): The REST API routes/api/kiloclaw/statusand/api/kiloclaw/chat-credentialsneed a corresponding update to destructureorganizationIdfromgetUserFromAuth()and usegetActiveOrgInstance()when present. The cloud already has org membership validation ingetUserFromAuth()and thegetActiveOrgInstance()function in the instance registry.No SDK regeneration needed — the Hono route signatures are unchanged.
Screenshots
N/A — TUI changes, no visual diff.
How to Test
/login)/teams/kiloclawhttps://app.kilo.ai/organizations/{orgId}/claw/teams/kiloclawagain — should resolve the personal instance and link tohttps://app.kilo.ai/claw