feat(hrm): Add optional HRM AI agent management commands#693
feat(hrm): Add optional HRM AI agent management commands#693mikejmorgan-ai wants to merge 1 commit intomainfrom
Conversation
- Add `cx hire` command for deploying AI agents - Add `cx fire` command for terminating AI agents - HRM AI is gated behind `--features hrm` flag (not default) - Commands show helpful premium feature message when disabled - Includes PostgreSQL integration for agent fleet management Usage: cargo build --features hrm # Enable HRM AI cx hire devops --server prod-1 cx fire <agent-id> License: BSL 1.1 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Summary of ChangesHello @mikejmorgan-ai, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a new, optional Human Resource Management (HRM) AI module to the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
📝 WalkthroughWalkthroughThis pull request introduces a new "hrm" feature to Wezterm that enables AI agent management through new CLI commands. It adds four optional dependencies (hrm-ai, sqlx, tokio, uuid), implements hire and fire CLI subcommands for deploying and terminating agents, and integrates these commands into the CLI system. Changes
Sequence Diagram(s)sequenceDiagram
participant User as User/CLI
participant Runtime as Tokio Runtime
participant Env as Environment
participant Repo as AgentRepository
participant Service as AgentHiringService
participant DB as Database
User->>Runtime: Initialize async runtime
User->>Env: Read DATABASE_URL
Env-->>Repo: DATABASE_URL
User->>Repo: Create with DATABASE_URL
Repo->>DB: Connect
User->>Service: Create AgentHiringService
User->>User: Derive agent name (if not supplied)
User->>User: Prompt confirmation (if not --yes)
User->>Service: Deploy agent with config
Service->>DB: Create agent record
DB-->>Service: Agent created
Service-->>User: Success response (ID, name, status)
User->>User: Print deployment details
sequenceDiagram
participant User as User/CLI
participant Runtime as Tokio Runtime
participant Env as Environment
participant Repo as AgentRepository
participant Service as AgentTerminationService
participant DB as Database
User->>Runtime: Initialize async runtime
User->>Env: Read DATABASE_URL
Env-->>Repo: DATABASE_URL
User->>Repo: Create with DATABASE_URL
Repo->>DB: Connect
User->>Repo: Fetch agent by ID
DB-->>Repo: Agent record
Repo-->>User: Agent found/not found
User->>User: Prompt confirmation (if not --force)
User->>Service: Create AgentTerminationService
User->>Service: Terminate agent with reason
Service->>DB: Update agent status, record audit
DB-->>Service: Termination confirmed
Service-->>User: Success response (audit ID, shutdown duration)
User->>User: Print termination details
Estimated Code Review Effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR adds optional HRM AI agent management commands (cx hire and cx fire) for deploying and terminating AI agents on servers. The feature is gated behind a --features hrm flag to keep it as an optional premium capability.
Changes:
- Added agent deployment and termination CLI commands with feature-gated implementation
- Integrated optional dependencies (hrm-ai, sqlx, tokio, uuid) for HRM functionality
- Implemented graceful fallback messaging when the feature is not enabled
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
wezterm/Cargo.toml |
Added optional HRM AI dependencies with feature flag |
wezterm/src/cli/mod.rs |
Registered hire and fire subcommands in CLI router |
wezterm/src/cli/hire.rs |
Implements agent deployment with feature-gated execution |
wezterm/src/cli/fire.rs |
Implements agent termination with confirmation flow |
|
|
||
| // Get database URL from environment | ||
| let db_url = std::env::var("DATABASE_URL") | ||
| .unwrap_or_else(|_| "postgres://localhost/cx_agents".to_string()); |
There was a problem hiding this comment.
The default database URL uses an unencrypted postgres:// connection. For enterprise-grade deployments mentioned in the documentation, this should default to a secure connection (e.g., require SSL) or at minimum include a warning about the security implications of the default.
| .unwrap_or_else(|_| "postgres://localhost/cx_agents".to_string()); | |
| .unwrap_or_else(|_| { | |
| // Default enforces TLS for safety; production should always set DATABASE_URL explicitly | |
| eprintln!( | |
| "warning: DATABASE_URL not set, using default postgres://localhost/cx_agents?sslmode=require; \ | |
| this is intended for development only and must be overridden in production." | |
| ); | |
| "postgres://localhost/cx_agents?sslmode=require".to_string() | |
| }); |
| let db_url = std::env::var("DATABASE_URL") | ||
| .unwrap_or_else(|_| "postgres://localhost/cx_agents".to_string()); |
There was a problem hiding this comment.
The default database URL uses an unencrypted postgres:// connection. For enterprise-grade deployments mentioned in the documentation, this should default to a secure connection (e.g., require SSL) or at minimum include a warning about the security implications of the default.
| let db_url = std::env::var("DATABASE_URL") | |
| .unwrap_or_else(|_| "postgres://localhost/cx_agents".to_string()); | |
| let db_url = match std::env::var("DATABASE_URL") { | |
| Ok(url) => url, | |
| Err(_) => { | |
| eprintln!( | |
| "WARNING: DATABASE_URL is not set. Falling back to a local default \ | |
| postgres:// connection with sslmode=require.\n\ | |
| For production and enterprise deployments, explicitly configure a secure DATABASE_URL." | |
| ); | |
| "postgres://localhost/cx_agents?sslmode=require".to_string() | |
| } | |
| }; |
| let agent_name = cmd.name.unwrap_or_else(|| { | ||
| format!("{}-{}", cmd.agent_type, &uuid::Uuid::new_v4().to_string()[..8]) | ||
| }); |
There was a problem hiding this comment.
The magic number 8 for UUID truncation should be defined as a named constant (e.g., const UUID_SHORT_LENGTH: usize = 8) to make the intent clear and enable consistent usage if this pattern is repeated elsewhere.
| wezterm-term.workspace = true | ||
|
|
||
| # HRM AI - Optional premium agent management (enable with --features hrm) | ||
| hrm-ai = { git = "https://github.com/mikejmorgan-ai/hrm-ai-standalone.git", optional = true } |
There was a problem hiding this comment.
The git dependency lacks version pinning (no tag, branch, or rev). This can lead to non-reproducible builds and unexpected breaking changes. Consider pinning to a specific tag or commit hash, e.g., tag = \"v1.0.0\" or rev = \"abc123\".
There was a problem hiding this comment.
Code Review
This pull request introduces cx hire and cx fire commands for managing optional HRM AI agents, gated behind a --features hrm flag. The implementation is well-structured, using conditional compilation effectively. My main feedback focuses on improving the robustness of database connections by requiring the DATABASE_URL environment variable to be set explicitly, rather than falling back to a hardcoded default. This change will prevent potential issues like connecting to the wrong database or silent failures.
| let db_url = std::env::var("DATABASE_URL") | ||
| .unwrap_or_else(|_| "postgres://localhost/cx_agents".to_string()); |
There was a problem hiding this comment.
Using a hardcoded fallback for DATABASE_URL can lead to unexpected behavior. If the environment variable is not set, the command will silently try to connect to postgres://localhost/cx_agents, which might not exist or might be the wrong database. This could cause confusion or data corruption.
It's more robust to fail explicitly if DATABASE_URL is not set, forcing the user to configure the environment correctly. This can be achieved by using .context() from anyhow to provide a clear error message.
| let db_url = std::env::var("DATABASE_URL") | |
| .unwrap_or_else(|_| "postgres://localhost/cx_agents".to_string()); | |
| let db_url = std::env::var("DATABASE_URL") | |
| .context("DATABASE_URL environment variable must be set to connect to the agent database")?; |
| let db_url = std::env::var("DATABASE_URL") | ||
| .unwrap_or_else(|_| "postgres://localhost/cx_agents".to_string()); |
There was a problem hiding this comment.
Similar to the fire command, using a hardcoded fallback for DATABASE_URL is risky. It's better to require the environment variable to be explicitly set to avoid connecting to an incorrect database or failing silently.
Explicitly erroring out when DATABASE_URL is missing will make the command more robust and easier to debug for users.
| let db_url = std::env::var("DATABASE_URL") | |
| .unwrap_or_else(|_| "postgres://localhost/cx_agents".to_string()); | |
| let db_url = std::env::var("DATABASE_URL") | |
| .context("DATABASE_URL environment variable must be set to connect to the agent database")?; |
|
There was a problem hiding this comment.
Actionable comments posted: 9
🤖 Fix all issues with AI agents
In `@wezterm/Cargo.toml`:
- Around line 44-46: The hrm-ai git dependency in Cargo.toml is unpinned and
should be fixed to a specific tag or commit to ensure reproducible builds;
update the hrm-ai entry (the hrm-ai dependency line) to include either a tag
(e.g., tag = "vX.Y.Z") or a commit SHA (rev = "<commit-sha>") alongside the git
URL so Cargo will fetch a fixed revision rather than the moving default branch.
In `@wezterm/src/cli/fire.rs`:
- Around line 97-105: Replace the existing WHAT/HOW comments above
theme.print_header, the DATABASE_URL getenv, and AgentRepository::new with
CX-prefixed intent comments that explain WHY these steps are necessary;
specifically add comments like "// CX Terminal: explain why we print the
termination header (provide user context)" before theme.print_header, "// CX
Terminal: explain why we fall back to default DATABASE_URL (ensure local dev
connectivity)" near the db_url initialization, and "// CX Terminal: explain why
we construct AgentRepository (to fetch agent termination metadata)" before
AgentRepository::new to satisfy the guideline that comments state intent and use
the CX prefix.
- Around line 1-5: Replace the current license header in this new file (fire.rs)
so it attributes the Business Source License 1.1 to AI Venture Holdings LLC:
update the copyright line and ensure the BSL 1.1 notice remains intact and
identical in wording to the project's standard header used across other new
files.
- Around line 7-22: Replace the module-level inner doc comments (the leading //!
lines at the top of wezterm/src/cli/fire.rs) with regular line comments that
explain WHY this module exists (not WHAT or HOW), using the required prefix "//
CX Terminal:"; remove example usage blocks and triple-backticks, keep the note
about the hrm feature but convert it to a CX Terminal comment, and ensure the
comment text follows the project's comment policy (intent-focused WHY and marked
with the CX prefix) so rustfmt/build and policy checks pass.
- Around line 108-113: The code prints an error when
repo.get_agent(&cmd.agent_id).await? returns None but still returns Ok(());
change this to propagate a non-zero failure by returning
Err(anyhow::anyhow!(...)) instead of Ok(()). Replace the None branch that
currently calls theme.print_error(&format!("Agent not found: {}",
cmd.agent_id)); return Ok(()) with a call to theme.print_error(...) followed by
returning Err(anyhow::anyhow!("Agent not found: {}", cmd.agent_id)) so the
function exits with an error when the agent is missing.
In `@wezterm/src/cli/hire.rs`:
- Around line 125-139: The comment "Print header" above the call to
theme.print_header and any other inline comments that only state "what" should
be rewritten to explain the intent (WHY) using the prescribed CX prefix: replace
or remove superficial comments and add a CX Terminal comment like "// CX
Terminal: explain why we're printing the header and deployment summary here
(e.g., to provide the user a clear context before collecting input/output)" near
theme.print_header; similarly, if any surrounding println! blocks need
commentary, either remove them or add a "// CX Terminal: ..." comment explaining
the purpose of printing agent_type/server/name/capabilities (for user
confirmation before deployment) and reference the cmd.agent_type, cmd.server,
cmd.name, and cmd.capabilities variables so the reviewers can locate the logic.
- Around line 1-5: Replace the copyright holder in the file-level license header
comment block at the top of the file (the multi-line /** ... */ header) so it
attributes the Business Source License 1.1 to "AI Venture Holdings LLC" instead
of "CX Linux", preserving the BSL 1.1 wording and formatting.
- Around line 7-19: Replace the module-level inner doc comments (the leading //!
block at the top of hire.rs) with non-doc comments that explain WHY using the
required prefix; remove the //! markers and convert each line to a normal
comment starting with "// CX Terminal:" that describes the rationale for the HRM
hiring command (compliance/audit/guarded flow) rather than usage HOW/WHAT or
examples; ensure no inner doc comments remain so rustfmt/build errors are
resolved and the new comments follow the "explain WHY" guideline.
- Around line 81-83: The --format flag (pub format: String) is accepted in the
Hire CLI struct but not used in run_hire_with_hrm; either remove the format
field or implement conditional output: in run_hire_with_hrm match on self.format
(e.g., "table" | "json") and branch the output path accordingly—keep the
existing table rendering for "table" and, for "json", serialize the same data
structure using Serde (derive Serialize or build a serializable DTO) and print
the JSON; ensure you validate unknown values (return an error) and update any
help/usage text if you remove the flag.
🧹 Nitpick comments (3)
wezterm/src/cli/fire.rs (1)
155-168: Add structured logs/tracing around termination operations.
Consider emitting structured fields (agent_id, audit_id, success) for observability, separate from user-facing output.As per coding guidelines, Use structured logging with distributed tracing support for monitoring and debugging across all components.
wezterm/src/cli/mod.rs (1)
34-36: Use CX Terminal prefix and intent-focused wording for new HRM comment.
Prefer// CX Terminal: WHY — …over “what”-style comments for new CX additions.As per coding guidelines, Code comments must explain WHY, never WHAT or HOW, and Rust: Mark CX additions with '// CX Terminal:' comment prefix.
wezterm/src/cli/hire.rs (1)
86-115: Add tests for the new hire/fire flows to keep coverage ≥95%.
Cover feature-off messaging, confirmation logic, and success/error paths.As per coding guidelines, Maintain 95%+ test coverage across all code.
| # HRM AI - Optional premium agent management (enable with --features hrm) | ||
| hrm-ai = { git = "https://github.com/mikejmorgan-ai/hrm-ai-standalone.git", optional = true } | ||
| sqlx = { version = "0.7", features = ["runtime-tokio", "postgres"], optional = true } |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
# First, let's examine the Cargo.toml file to see the current state
cat -n wezterm/Cargo.toml | head -60Repository: cxlinux-ai/cx-core
Length of output: 2220
🏁 Script executed:
# Also check if there are any branding violations in the file
rg -n "(cortex|cortexlinux)" wezterm/Cargo.tomlRepository: cxlinux-ai/cx-core
Length of output: 44
🏁 Script executed:
# Search for any related configuration or documentation mentioning hrm-ai
rg -n "hrm-ai|hrm_ai" wezterm/ --type toml --type yaml --type mdRepository: cxlinux-ai/cx-core
Length of output: 257
Pin the hrm-ai git dependency to a tag or commit.
Unpinned git deps can change without notice and break reproducibility/supply-chain controls.
🔒 Suggested pinning
-hrm-ai = { git = "https://github.com/mikejmorgan-ai/hrm-ai-standalone.git", optional = true }
+hrm-ai = { git = "https://github.com/mikejmorgan-ai/hrm-ai-standalone.git", rev = "<commit-sha>", optional = true }🤖 Prompt for AI Agents
In `@wezterm/Cargo.toml` around lines 44 - 46, The hrm-ai git dependency in
Cargo.toml is unpinned and should be fixed to a specific tag or commit to ensure
reproducible builds; update the hrm-ai entry (the hrm-ai dependency line) to
include either a tag (e.g., tag = "vX.Y.Z") or a commit SHA (rev =
"<commit-sha>") alongside the git URL so Cargo will fetch a fixed revision
rather than the moving default branch.
| /** | ||
| * Copyright (c) 2026 CX Linux | ||
| * Licensed under the Business Source License 1.1 | ||
| * You may not use this file except in compliance with the License. | ||
| */ |
There was a problem hiding this comment.
Fix the license header copyright holder.
New files must attribute BSL 1.1 to AI Venture Holdings LLC.
📄 Suggested update
- * Copyright (c) 2026 CX Linux
+ * Copyright (c) 2026 AI Venture Holdings LLCAs per coding guidelines, Include BSL 1.1 license header on all new files with copyright to AI Venture Holdings LLC.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| /** | |
| * Copyright (c) 2026 CX Linux | |
| * Licensed under the Business Source License 1.1 | |
| * You may not use this file except in compliance with the License. | |
| */ | |
| /** | |
| * Copyright (c) 2026 AI Venture Holdings LLC | |
| * Licensed under the Business Source License 1.1 | |
| * You may not use this file except in compliance with the License. | |
| */ |
🤖 Prompt for AI Agents
In `@wezterm/src/cli/fire.rs` around lines 1 - 5, Replace the current license
header in this new file (fire.rs) so it attributes the Business Source License
1.1 to AI Venture Holdings LLC: update the copyright line and ensure the BSL 1.1
notice remains intact and identical in wording to the project's standard header
used across other new files.
| //! HRM AI Agent Termination Command | ||
| //! | ||
| //! Safely terminates AI agents with confirmation and audit logging. | ||
| //! This module is only available when the `hrm` feature is enabled. | ||
| //! | ||
| //! # Example | ||
| //! ```bash | ||
| //! # Terminate an agent by ID | ||
| //! cx fire abc123-def456 | ||
| //! | ||
| //! # Force termination (skip confirmation) | ||
| //! cx fire abc123-def456 --force | ||
| //! | ||
| //! # Terminate with reason | ||
| //! cx fire abc123-def456 --reason "Migrating to new server" | ||
| //! ``` |
There was a problem hiding this comment.
Replace inner doc comments to restore fmt/build and align comment policy.
//! here triggers rustfmt errors (see pipeline). Convert to regular intent-focused comments and use the CX prefix.
✅ Suggested rewrite
-//! HRM AI Agent Termination Command
-//!
-//! Safely terminates AI agents with confirmation and audit logging.
-//! This module is only available when the `hrm` feature is enabled.
-//!
-//! # Example
-//! ```bash
-//! # Terminate an agent by ID
-//! cx fire abc123-def456
-//!
-//! # Force termination (skip confirmation)
-//! cx fire abc123-def456 --force
-//!
-//! # Terminate with reason
-//! cx fire abc123-def456 --reason "Migrating to new server"
-//! ```
+// CX Terminal: WHY — provide a guarded termination flow with audit logging
+// when the premium HRM feature is enabled.As per coding guidelines, Code comments must explain WHY, never WHAT or HOW, and Rust: Mark CX additions with '// CX Terminal:' comment prefix.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| //! HRM AI Agent Termination Command | |
| //! | |
| //! Safely terminates AI agents with confirmation and audit logging. | |
| //! This module is only available when the `hrm` feature is enabled. | |
| //! | |
| //! # Example | |
| //! ```bash | |
| //! # Terminate an agent by ID | |
| //! cx fire abc123-def456 | |
| //! | |
| //! # Force termination (skip confirmation) | |
| //! cx fire abc123-def456 --force | |
| //! | |
| //! # Terminate with reason | |
| //! cx fire abc123-def456 --reason "Migrating to new server" | |
| //! ``` | |
| // CX Terminal: WHY — provide a guarded termination flow with audit logging | |
| // when the premium HRM feature is enabled. |
🤖 Prompt for AI Agents
In `@wezterm/src/cli/fire.rs` around lines 7 - 22, Replace the module-level inner
doc comments (the leading //! lines at the top of wezterm/src/cli/fire.rs) with
regular line comments that explain WHY this module exists (not WHAT or HOW),
using the required prefix "// CX Terminal:"; remove example usage blocks and
triple-backticks, keep the note about the hrm feature but convert it to a CX
Terminal comment, and ensure the comment text follows the project's comment
policy (intent-focused WHY and marked with the CX prefix) so rustfmt/build and
policy checks pass.
| // Print header | ||
| theme.print_header("CX Linux Agent Termination"); | ||
|
|
||
| // Get database URL from environment | ||
| let db_url = std::env::var("DATABASE_URL") | ||
| .unwrap_or_else(|_| "postgres://localhost/cx_agents".to_string()); | ||
|
|
||
| // Create repository to fetch agent info | ||
| let repo = AgentRepository::new(&db_url).await?; |
There was a problem hiding this comment.
Inline comments should state intent (WHY) and use the CX prefix.
Comments like “Print header” and “Get database URL” are “what/how”; rephrase to intent or remove.
As per coding guidelines, Code comments must explain WHY, never WHAT or HOW, and Rust: Mark CX additions with '// CX Terminal:' comment prefix.
🤖 Prompt for AI Agents
In `@wezterm/src/cli/fire.rs` around lines 97 - 105, Replace the existing WHAT/HOW
comments above theme.print_header, the DATABASE_URL getenv, and
AgentRepository::new with CX-prefixed intent comments that explain WHY these
steps are necessary; specifically add comments like "// CX Terminal: explain why
we print the termination header (provide user context)" before
theme.print_header, "// CX Terminal: explain why we fall back to default
DATABASE_URL (ensure local dev connectivity)" near the db_url initialization,
and "// CX Terminal: explain why we construct AgentRepository (to fetch agent
termination metadata)" before AgentRepository::new to satisfy the guideline that
comments state intent and use the CX prefix.
| let agent = match repo.get_agent(&cmd.agent_id).await? { | ||
| Some(a) => a, | ||
| None => { | ||
| theme.print_error(&format!("Agent not found: {}", cmd.agent_id)); | ||
| return Ok(()); | ||
| } |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
# First, let me check the file and the specific lines mentioned
cat -n wezterm/src/cli/fire.rs | head -150 | tail -50Repository: cxlinux-ai/cx-core
Length of output: 2259
🏁 Script executed:
# Get the context around lines 108-113
sed -n '90,130p' wezterm/src/cli/fire.rsRepository: cxlinux-ai/cx-core
Length of output: 1467
🏁 Script executed:
# Check the function signature and return type
sed -n '80,120p' wezterm/src/cli/fire.rsRepository: cxlinux-ai/cx-core
Length of output: 1416
🏁 Script executed:
# Check if anyhow is imported in this file
head -50 wezterm/src/cli/fire.rs | grep -E "^use|^extern"Repository: cxlinux-ai/cx-core
Length of output: 113
🏁 Script executed:
# Check how errors are handled elsewhere in the file
rg "Err\(|anyhow::" wezterm/src/cli/fire.rs -A 2Repository: cxlinux-ai/cx-core
Length of output: 100
Return a non-zero exit when the agent is missing.
Printing an error but returning Ok(()) makes automation treat failures as success. Use anyhow::anyhow!() to propagate the error instead, which is already imported in this file and aligns with the error handling pattern used elsewhere in the function.
🚫 Suggested error propagation
- None => {
- theme.print_error(&format!("Agent not found: {}", cmd.agent_id));
- return Ok(());
- }
+ None => {
+ theme.print_error(&format!("Agent not found: {}", cmd.agent_id));
+ return Err(anyhow::anyhow!("Agent not found: {}", cmd.agent_id));
+ }🤖 Prompt for AI Agents
In `@wezterm/src/cli/fire.rs` around lines 108 - 113, The code prints an error
when repo.get_agent(&cmd.agent_id).await? returns None but still returns Ok(());
change this to propagate a non-zero failure by returning
Err(anyhow::anyhow!(...)) instead of Ok(()). Replace the None branch that
currently calls theme.print_error(&format!("Agent not found: {}",
cmd.agent_id)); return Ok(()) with a call to theme.print_error(...) followed by
returning Err(anyhow::anyhow!("Agent not found: {}", cmd.agent_id)) so the
function exits with an error when the agent is missing.
| /** | ||
| * Copyright (c) 2026 CX Linux | ||
| * Licensed under the Business Source License 1.1 | ||
| * You may not use this file except in compliance with the License. | ||
| */ |
There was a problem hiding this comment.
Fix the license header copyright holder.
New files must attribute BSL 1.1 to AI Venture Holdings LLC.
📄 Suggested update
- * Copyright (c) 2026 CX Linux
+ * Copyright (c) 2026 AI Venture Holdings LLCAs per coding guidelines, Include BSL 1.1 license header on all new files with copyright to AI Venture Holdings LLC.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| /** | |
| * Copyright (c) 2026 CX Linux | |
| * Licensed under the Business Source License 1.1 | |
| * You may not use this file except in compliance with the License. | |
| */ | |
| /** | |
| * Copyright (c) 2026 AI Venture Holdings LLC | |
| * Licensed under the Business Source License 1.1 | |
| * You may not use this file except in compliance with the License. | |
| */ |
🤖 Prompt for AI Agents
In `@wezterm/src/cli/hire.rs` around lines 1 - 5, Replace the copyright holder in
the file-level license header comment block at the top of the file (the
multi-line /** ... */ header) so it attributes the Business Source License 1.1
to "AI Venture Holdings LLC" instead of "CX Linux", preserving the BSL 1.1
wording and formatting.
| //! HRM AI Agent Hiring Command | ||
| //! | ||
| //! Deploys AI agents to managed servers with enterprise-grade compliance. | ||
| //! This module is only available when the `hrm` feature is enabled. | ||
| //! | ||
| //! # Example | ||
| //! ```bash | ||
| //! # Deploy a DevOps agent | ||
| //! cx hire devops --server prod-1 --name "Deploy Bot" | ||
| //! | ||
| //! # Deploy with custom configuration | ||
| //! cx hire security --server sec-cluster --capabilities audit,scan,patch | ||
| //! ``` |
There was a problem hiding this comment.
Replace inner doc comments to fix fmt/build and align comment policy.
//! here triggers rustfmt errors. Convert to regular intent-focused comments and use the CX prefix.
✅ Suggested rewrite
-//! HRM AI Agent Hiring Command
-//!
-//! Deploys AI agents to managed servers with enterprise-grade compliance.
-//! This module is only available when the `hrm` feature is enabled.
-//!
-//! # Example
-//! ```bash
-//! # Deploy a DevOps agent
-//! cx hire devops --server prod-1 --name "Deploy Bot"
-//!
-//! # Deploy with custom configuration
-//! cx hire security --server sec-cluster --capabilities audit,scan,patch
-//! ```
+// CX Terminal: WHY — provide a guarded hiring flow with compliance and audit
+// when the premium HRM feature is enabled.As per coding guidelines, Code comments must explain WHY, never WHAT or HOW, and Rust: Mark CX additions with '// CX Terminal:' comment prefix.
🧰 Tools
🪛 GitHub Actions: CX Terminal Build
[error] 7-19: Rust syntax error: inner doc comments like //! can only appear before items. Replace with regular comments. Example: change '//! HRM AI Agent Hiring Command' to '// HRM AI Agent Hiring Command' and adjust subsequent lines accordingly. This caused cargo fmt --all -- --check to fail.
🪛 GitHub Actions: fmt
[error] 7-7: expected outer doc comment
[error] 8-8: expected outer doc comment
[error] 9-9: expected outer doc comment
[error] 10-10: expected outer doc comment
[error] 11-11: expected outer doc comment
[error] 12-12: expected outer doc comment
[error] 13-13: expected outer doc comment
[error] 14-14: expected outer doc comment
[error] 15-15: expected outer doc comment
[error] 16-16: expected outer doc comment
[error] 17-17: expected outer doc comment
[error] 18-18: expected outer doc comment
[error] 19-19: expected outer doc comment
[error] 19-19: Error writing files: failed to resolve mod hire: cannot parse /home/runner/work/cx-core/cx-core/wezterm/src/cli/hire.rs
🤖 Prompt for AI Agents
In `@wezterm/src/cli/hire.rs` around lines 7 - 19, Replace the module-level inner
doc comments (the leading //! block at the top of hire.rs) with non-doc comments
that explain WHY using the required prefix; remove the //! markers and convert
each line to a normal comment starting with "// CX Terminal:" that describes the
rationale for the HRM hiring command (compliance/audit/guarded flow) rather than
usage HOW/WHAT or examples; ensure no inner doc comments remain so rustfmt/build
errors are resolved and the new comments follow the "explain WHY" guideline.
| /// Output format: table, json | ||
| #[arg(long, default_value = "table")] | ||
| pub format: String, |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
cd wezterm && head -100 src/cli/hire.rs | tail -30Repository: cxlinux-ai/cx-core
Length of output: 1008
🏁 Script executed:
cat -n wezterm/src/cli/hire.rs | sed -n '70,100p'Repository: cxlinux-ai/cx-core
Length of output: 1255
🏁 Script executed:
# Search for usage of 'format' variable in hire.rs
rg "format" wezterm/src/cli/hire.rs -A 2 -B 2Repository: cxlinux-ai/cx-core
Length of output: 551
🏁 Script executed:
# Check if there's any output/serialization code in hire.rs
rg "to_string|serialize|json|table" wezterm/src/cli/hire.rsRepository: cxlinux-ai/cx-core
Length of output: 343
🏁 Script executed:
# Search for usage of cmd.format or self.format
rg "cmd\.format|self\.format" wezterm/src/cli/Repository: cxlinux-ai/cx-core
Length of output: 373
🏁 Script executed:
# Look for the run_hire_with_hrm function
rg "fn run_hire_with_hrm" wezterm/src/cli/ -A 30Repository: cxlinux-ai/cx-core
Length of output: 1814
🏁 Script executed:
# Check if there's any conditional logic based on format
rg "match.*format|if.*format" wezterm/src/cli/hire.rsRepository: cxlinux-ai/cx-core
Length of output: 44
🏁 Script executed:
# Get the full run_hire_with_hrm function to see if format is used anywhere
cat -n wezterm/src/cli/hire.rs | sed -n '104,200p'Repository: cxlinux-ai/cx-core
Length of output: 4008
🏁 Script executed:
# Check the complete file length
wc -l wezterm/src/cli/hire.rsRepository: cxlinux-ai/cx-core
Length of output: 89
🏁 Script executed:
# See the rest of run_hire_with_hrm and check for format usage
tail -100 wezterm/src/cli/hire.rsRepository: cxlinux-ai/cx-core
Length of output: 3118
🏁 Script executed:
# Compare with a command that properly implements format (ask.rs)
rg "match self.format" wezterm/src/cli/ask.rs -A 10 -B 2Repository: cxlinux-ai/cx-core
Length of output: 429
Remove unused --format flag or implement table/json output.
The format field is accepted but never used in run_hire_with_hrm. Either remove the flag or implement conditional output logic (match on self.format as other commands do). If JSON output is added, use Serde for serialization per the coding guidelines.
🤖 Prompt for AI Agents
In `@wezterm/src/cli/hire.rs` around lines 81 - 83, The --format flag (pub format:
String) is accepted in the Hire CLI struct but not used in run_hire_with_hrm;
either remove the format field or implement conditional output: in
run_hire_with_hrm match on self.format (e.g., "table" | "json") and branch the
output path accordingly—keep the existing table rendering for "table" and, for
"json", serialize the same data structure using Serde (derive Serialize or build
a serializable DTO) and print the JSON; ensure you validate unknown values
(return an error) and update any help/usage text if you remove the flag.
| // Print header | ||
| theme.print_header("CX Linux Agent Deployment"); | ||
|
|
||
| println!(); | ||
| println!(" 📋 Deployment Request"); | ||
| println!(" ─────────────────────────────────────"); | ||
| println!(" Agent Type: {}", cmd.agent_type); | ||
| println!(" Server: {}", cmd.server); | ||
| if let Some(ref name) = cmd.name { | ||
| println!(" Name: {}", name); | ||
| } | ||
| if let Some(ref caps) = cmd.capabilities { | ||
| println!(" Capabilities: {}", caps.join(", ")); | ||
| } | ||
| println!(); |
There was a problem hiding this comment.
Inline comments should state intent (WHY) and use the CX prefix.
Comments like “Print header” and “Deployment Request” are “what”; rephrase to intent or remove.
As per coding guidelines, Code comments must explain WHY, never WHAT or HOW, and Rust: Mark CX additions with '// CX Terminal:' comment prefix.
🤖 Prompt for AI Agents
In `@wezterm/src/cli/hire.rs` around lines 125 - 139, The comment "Print header"
above the call to theme.print_header and any other inline comments that only
state "what" should be rewritten to explain the intent (WHY) using the
prescribed CX prefix: replace or remove superficial comments and add a CX
Terminal comment like "// CX Terminal: explain why we're printing the header and
deployment summary here (e.g., to provide the user a clear context before
collecting input/output)" near theme.print_header; similarly, if any surrounding
println! blocks need commentary, either remove them or add a "// CX Terminal:
..." comment explaining the purpose of printing
agent_type/server/name/capabilities (for user confirmation before deployment)
and reference the cmd.agent_type, cmd.server, cmd.name, and cmd.capabilities
variables so the reviewers can locate the logic.



Summary
cx hirecommand for deploying AI agents to serverscx firecommand for terminating AI agents gracefully--features hrmflagChanges
Cargo.tomlcli/hire.rscli/fire.rscli/mod.rsUsage
Test plan
--features hrm- verify premium message displays--features hrm- verify commands connect to PostgreSQLcx hirecreates agent recordscx fireterminates agents with audit loggingLicense
BSL 1.1 (Business Source License)
🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes
hirecommand to deploy AI agents with configurable types (DevOps, Security, Database, Network, Support) and custom capabilities.firecommand to terminate AI agents with optional confirmation and audit logging.hrmfeature enables AI agent management capabilities (enable via feature flag).✏️ Tip: You can customize this high-level summary in your review settings.