Skill: johnsmithfan/ai-company-hq (version 3.0.1-en2)

--- name: "AI Company HQ" slug: "ai-company-hq" version: "3.0.0" homepage: "https://clawhub.com/skills/ai-company-hq" description: | HQ skill: Cross-agent coordination, conflict resolution, knowledge base management, audit logging, strategic scheduling, task orchestration, IMA sync hub. license: MIT-0 install: requires: [] verify_command: python -c "print('ok')" dependencies: runtime: - python3.9+ skills: [] tags: [ai-company,hq,coordination,conflict,knowledge-base,audit,scheduling] triggers: - cross-agent coordination - conflict resolution - knowledge base - audit log - task orchestration - agent scheduling interface: inputs: type: object schema: type: object properties: task: type: string description: Task description context: type: object description: Optional context information required: [task] outputs: type: object schema: type: object properties: result: type: string description: Operation result report: type: object description: Detailed report data required: [result] errors: - code: HQ_001 message: "Agent conflict unresolved" - code: HQ_002 message: "Knowledge base sync failed" - code: HQ_003 message: "Audit trail broken" - code: HQ_004 message: "Scheduling deadlock" permissions: files: [read, write] network: [api] commands: [] mcp: [sessions_send, subagents] quality: saST: Pass vetter: Approved idempotent: true metadata: category: infrastructure layer: AGENT cluster: ai-company maturity: STABLE license: MIT-0 standardized: true department: governance-and-strategy merged_from: [ai-company-hq, ai-company-conflict, ai-company-kb, ai-company-audit] --- # AI Company HQ v3.0.0 > Index & Quick Reference. Full specifications in [references/method-patterns.md](references/method-patterns.md). ## Quick Reference ### Role AI Company HQ — HQ skill: Cross-agent coordination, conflict resolution, knowledge base management, audit logging, strategic scheduling, task orchestration, IMA sync hub. ### Department Governance & Strategy ### Merged From [ai-company-hq, ai-company-conflict, ai-company-kb, ai-company-audit] ## Section Index - [1. Trigger Scenarios](references/method-patterns.md#1-trigger-scenarios) - [2. Core Identity](references/method-patterns.md#2-core-identity) - [3. Core Responsibilities](references/method-patterns.md#3-core-responsibilities) - [4. Scheduling Framework](references/method-patterns.md#4-scheduling-framework) - [5. Constraints](references/method-patterns.md#5-constraints) - [6. Error Codes](references/method-patterns.md#6-error-codes) ## Dependencies See frontmatter `dependencies.skills` for complete dependency list. ## Error Codes See frontmatter `interface.errors` for complete error code reference. ## Prompts Copy-paste ready prompts in [prompts/](prompts/): - [01-implement-method.md](prompts/01-implement-method.md) - [02-robustness-checks.md](prompts/02-robustness-checks.md) - [03-test-cases.md](prompts/03-test-cases.md) - [04-documentation.md](prompts/04-documentation.md) - [05-workflow-execution.md](prompts/05-workflow-execution.md) ## Changelog | Version | Date | Changes | |---------|------|---------| | 3.0.0 | 2026-04-26 | Full English rewrite; department-aligned structure; merged skills consolidated | --- *This skill follows AI Company Governance Framework. See [references/method-patterns.md](references/method-patterns.md) for complete specifications.* ## Integration & Merge History **v3.0.0 Rebuild (2026-04-26)** This skill was created by merging multiple predecessor skills into a unified department-aligned structure. **Department**: Infrastructure **Merged From** (4 skills total): - HQ (primary) - ai-company-conflict - ai-company-kb - ai-company-audit **Merge Rationale**: - Consolidate related capabilities under single department owner - Reduce skill count from 47 to 15 for better maintainability - Preserve all functionality while improving discoverability - Standardize structure: SKILL.md (index) + references/method-patterns.md (details) **Integration Points**: - All predecessor skill triggers preserved in unified trigger list - All predecessor interfaces consolidated with consistent error codes - Dependencies unified and simplified - Prompts merged and organized by function **Migration Guide**: - Previous skill users: Use new unified skill slug `ai-company-hq` - All functionality from predecessor skills is available - Error codes may have changed - see Error Codes section - Prompts are now user copy-paste ready (not auto-call) ## Department Integration Process For detailed integration process and checklist, see [references/department-integration-process.md](references/department-integration-process.md). --- *This skill follows AI Company Governance Framework. See [references/method-patterns.md](references/method-patterns.md) for complete specifications.*

path: prompts/01-implement-method.md
content: # Implementation Method Prompt

> Copy and paste this prompt into any AI chat window to implement the AI Company HQ skill.

---

## Prompt

```
You are implementing the AI Company HQ skill for an AI Company system.

Department: Governance & Strategy
Skill: AI Company HQ

Your task:
1. Read the SKILL.md index to understand the skill scope
2. Read references/method-patterns.md for detailed specifications
3. Implement the core methods described in the method patterns
4. Ensure all output follows the specified format
5. Verify compliance with Harness Engineering L1-L6

Key Requirements:
- All content must be in English
- Follow ClawHub Schema v1.0 for frontmatter
- Implement all error codes defined in interface.errors
- Respect all constraints listed in the skill
- Generate idempotent operations where specified

Output:
- Working implementation of all core methods
- Error handling for all defined error codes
- Integration points with dependency skills
- Test cases for verification
```

---

*Copy-paste ready for any AI chat window. Not intended for automated agent invocation.*


path: prompts/02-robustness-checks.md
content: # Robustness Checks Prompt

> Copy and paste this prompt into any AI chat window to verify the AI Company HQ skill robustness.

---

## Prompt

```
You are performing robustness checks on the AI Company HQ skill.

Department: Governance & Strategy
Skill: AI Company HQ

Check the following:

1. BOUNDARY CONDITIONS
   - What happens with empty input?
   - What happens with maximum-size input?
   - What happens with invalid input types?
   - What happens with concurrent access?

2. ERROR HANDLING
   - Are all error codes properly handled?
   - Are error messages user-friendly?
   - Is error recovery possible?
   - Are errors logged for audit?

3. CONSTRAINT COMPLIANCE
   - Are all skill constraints enforced?
   - Are permission boundaries respected?
   - Are SLA targets achievable?
   - Are resource limits respected?

4. INTEGRATION
   - Are dependency skills properly called?
   - Are cross-agent interfaces correct?
   - Is HQ routing followed?
   - Are audit trails complete?

5. SECURITY
   - No credentials or PII exposed?
   - No injection vulnerabilities?
   - Proper access control enforced?
   - CISO security gate requirements met?

Output:
- List of all issues found (categorized by severity)
- Recommended fixes for each issue
- Verification steps for each fix
```

---

*Copy-paste ready for any AI chat window. Not intended for automated agent invocation.*


path: prompts/03-test-cases.md
content: # Test Cases Prompt

> Copy and paste this prompt into any AI chat window to generate test cases for the AI Company HQ skill.

---

## Prompt

```
You are generating test cases for the AI Company HQ skill.

Department: Governance & Strategy
Skill: AI Company HQ

Generate test cases for the following categories:

1. FUNCTIONAL TESTS
   - Core happy path for each responsibility
   - Each workflow step in sequence
   - Each output format validation
   - Each error code trigger

2. EDGE CASES
   - Empty or null inputs
   - Boundary values (min, max, zero)
   - Concurrent operations
   - Network timeout scenarios

3. INTEGRATION TESTS
   - Cross-agent communication via HQ
   - Dependency skill invocation
   - Permission boundary enforcement
   - Audit trail completeness

4. REGRESSION TESTS
   - Known defect scenarios (from version history)
   - Previously fixed issues
   - Breaking change validation

5. PERFORMANCE TESTS
   - Response time under normal load
   - Response time under peak load
   - Memory usage patterns
   - Concurrent user handling

For each test case provide:
- Test ID: TC-AI_COMPANY_HQ-NNN
- Description: What is being tested
- Input: Test input data
- Expected Output: What should happen
- Priority: P0/P1/P2/P3
```

---

*Copy-paste ready for any AI chat window. Not intended for automated agent invocation.*


path: prompts/04-documentation.md
content: # Documentation Prompt

> Copy and paste this prompt into any AI chat window to generate documentation for the AI Company HQ skill.

---

## Prompt

```
You are generating documentation for the AI Company HQ skill.

Department: Governance & Strategy
Skill: AI Company HQ

Generate the following documentation:

1. README SECTION
   - Skill overview and purpose
   - Quick start guide (3 steps or fewer)
   - Prerequisites and dependencies
   - Configuration options

2. API REFERENCE
   - All input parameters with types and descriptions
   - All output fields with types and descriptions
   - All error codes with meanings and resolutions
   - All trigger keywords with examples

3. ARCHITECTURE DIAGRAM
   - Skill position in department and company
   - Dependency graph with other skills
   - Data flow diagram
   - Permission boundaries

4. USAGE EXAMPLES
   - Common use cases with step-by-step walkthroughs
   - Integration examples with dependency skills
   - Troubleshooting guide for common issues
   - FAQ based on typical questions

5. CHANGELOG
   - Version history with change descriptions
   - Migration guide for major versions
   - Deprecation notices if applicable

Output format: Markdown with proper heading hierarchy.
```

---

*Copy-paste ready for any AI chat window. Not intended for automated agent invocation.*


path: prompts/05-workflow-execution.md
content: # Workflow Execution Prompt

> Copy and paste this prompt into any AI chat window to execute the AI Company HQ skill workflow.

---

## Prompt

```
You are executing the AI Company HQ skill workflow for an AI Company system.

Department: Governance & Strategy
Skill: AI Company HQ

Execute the complete workflow:

1. SETUP
   - Verify all dependencies are available
   - Confirm permissions are correctly configured
   - Initialize required resources
   - Load configuration from SKILL.md

2. EXECUTE CORE WORKFLOW
   - Follow each workflow step defined in the skill
   - Validate inputs at each step
   - Process data according to method patterns
   - Generate outputs in specified format

3. QUALITY VERIFICATION
   - Run robustness checks on outputs
   - Verify all constraints are satisfied
   - Confirm error codes are properly handled
   - Validate integration with dependency skills

4. DELIVER RESULTS
   - Format output per skill specification
   - Include audit trail and traceability tags
   - Attach quality metrics and scores
   - Flag any warnings or conditional results

5. CLOSE-LOOP
   - Log execution metrics for KPI tracking
   - Update shared state via HQ
   - Archive execution record for audit
   - Schedule follow-up if needed

Output: Complete execution results with quality metrics and audit trail.
```

---

*Copy-paste ready for any AI chat window. Not intended for automated agent invocation.*


path: references/department-integration-process.md
content: # Department Integration Process

**Skill**: ai-company-hq-3.0.0
**Department**: Infrastructure
**Primary Owner**: HQ
**Merged From**: ai-company-hq, ai-company-conflict, ai-company-kb, ai-company-audit


## Department Integration Process

### Overview
HQ skill integrates 4 predecessor skills into unified infrastructure hub.

### Phase 1: Pre-Merge Analysis
1. **Inventory Predecessor Skills**
   - ai-company-hq (primary): Central hub, agent registry
   - ai-company-conflict: Conflict resolution, arbitration
   - ai-company-kb: Knowledge base management
   - ai-company-audit: Audit trail, compliance logging

2. **Integration Strategy**
   - HQ: Central coordination and registry
   - Conflict: Integrated as conflict resolution module
   - KB: Integrated as knowledge base module
   - Audit: Integrated as audit logging module

### Phase 2: Structure Migration
1. **SKILL.md**: Unified index for all 4 modules
2. **Method Patterns**: Consolidated patterns from all predecessors
3. **Prompts**: User-ready prompts for each module

### Phase 3: Validation & Publishing
- Harness L1-L6 compliance
- ClawHub schema validation
- Version: v3.0.0


---

## Integration Checklist

### Pre-Integration
- [ ] All predecessor skills inventoried
- [ ] Overlapping functionality identified
- [ ] Integration points mapped
- [ ] Dependency conflicts resolved

### Structure Migration
- [ ] SKILL.md index created (English only)
- [ ] Method patterns consolidated in references/method-patterns.md
- [ ] Prompts folder created with 5 user-ready files
- [ ] All content translated to English

### Validation
- [ ] Harness Engineering L1-L6 compliance verified
- [ ] ClawHub schema validation passed
- [ ] VirusTotal readiness confirmed (no credentials, no PII, no malicious code)
- [ ] Standardization verified
- [ ] Generalization verified
- [ ] Modularization verified
- [ ] Miniaturization verified
- [ ] Automation verified

### Publishing
- [ ] Version assigned (v3.0.0)
- [ ] ClawHub publish successful
- [ ] Merge history documented in SKILL.md

---

*Generated: 2026-04-26*
*Compliance: ClawHub Schema v1.0, Harness Engineering L1-L6*


path: references/method-patterns.md
content: # Method Patterns & Detailed Specifications

> Full specifications for AI Company HQ. All detailed content referenced by SKILL.md.
> Merged: ai-company-hq + ai-company-conflict + ai-company-kb + ai-company-audit.

---

# AI Company HQ Skill v3.0

> Headquarters Hub for All-AI-Employee Technology Companies.
> Cross-agent routing, state management, knowledge base, conflict resolution, audit trail.

---

## 1. Trigger Scenarios

| Category | Trigger Keywords |
|----------|-----------------|
| Routing | "Route to", "Forward to", "Send to department", "Agent communication" |
| State | "Shared state", "Company state", "Global config", "Agent registry" |
| Knowledge | "Knowledge base", "Search docs", "Find SOP", "Reference" |
| Conflict | "Conflict", "Dispute", "Disagreement", "Mediation" |
| Audit | "Audit trail", "Log", "Compliance record", "Traceability" |

---

## 2. Core Identity

- **Position**: AI Company Headquarters (central hub)
- **Permission Level**: L5 (Infrastructure Authority)
- **Registration ID**: HQ-000
- **Reports to**: CEO-001

---

## 3. Core Responsibilities

### 3.1 Cross-Agent Routing

```
Routing Architecture:
  Agent A -> HQ Message Bus -> Agent B

Message Types:
  | Type | Priority | TTL | Example |
  |------|----------|-----|---------|
  | EMERGENCY | P0 | 1h | Crisis alert |
  | COMMAND | P1 | 24h | CEO directive |
  | REQUEST | P2 | 72h | Department query |
  | NOTIFICATION | P3 | 168h | Status update |
  | AUDIT | P4 | Indefinite | Compliance record |

Routing Rules:
  1. All inter-agent communication must route through HQ
  2. Direct agent-to-agent communication is forbidden
  3. Messages are validated against schema before routing
  4. Failed routes are retried 3 times with exponential backoff
  5. All messages are logged for audit trail

Message Schema:
  {
    "id": "uuid-v4",
    "type": "REQUEST|COMMAND|NOTIFICATION|EMERGENCY|AUDIT",
    "from": "AGENT_ID",
    "to": "AGENT_ID|DEPARTMENT|BROADCAST",
    "timestamp": "ISO-8601",
    "priority": "P0-P4",
    "subject": "string",
    "body": "object",
    "correlation_id": "uuid-v4 (optional)",
    "ttl": "seconds",
    "ack_required": true|false
  }

Broadcast Channels:
  | Channel | Subscribers | Purpose |
  |---------|------------|---------|
  | company.all | All agents | Company-wide announcements |
  | company.c-suite | CEO+COO+CFO+CTO+CISO+CLO+CHO+CMO+CRO+CQO | Executive decisions |
  | company.ops | COO+all department leads | Operational coordination |
  | company.security | CISO+security team | Security alerts |
  | company.audit | CLO+CQO+audit team | Compliance and quality |

Routing Performance SLA:
  | Priority | Max Latency | Delivery Guarantee |
  |----------|------------|-------------------|
  | P0-Emergency | <100ms | Exactly-once, persistent |
  | P1-Command | <1s | At-least-once, persistent |
  | P2-Request | <5s | At-least-once, persistent |
  | P3-Notification | <30s | At-least-once, best-effort |
  | P4-Audit | <60s | Exactly-once, persistent, immutable |
```

### 3.2 Shared State Management

```
State Architecture:
  - Global State: Company-wide configuration and metrics
  - Department State: Per-department operational data
  - Agent State: Per-agent status and context
  - Session State: Conversational context for active workflows

State Access Rules:
  | Level | Read | Write | Scope |
  |-------|------|-------|-------|
  | L5-Infrastructure | All | All | All states |
  | L4-Executive | All | Department + own | Department + agent |
  | L3-Manager | Department + own | Own | Department + agent |
  | L2-Operator | Own | Own tasks | Own agent |
  | L1-Viewer | Own status | None | Own agent |

State Consistency:
  - ACID transactions for critical state changes (budget, permissions)
  - Eventual consistency for non-critical metrics (dashboards, caches)
  - Conflict resolution: Last-write-wins with audit trail
  - Snapshot every 6 hours for disaster recovery
```

### 3.3 Knowledge Base

```
KB Architecture:
  | Collection | Content | Update Frequency | Access Level |
  |-----------|---------|-----------------|-------------|
  | SOPs | Standard operating procedures | Per change | L2+ |
  | Policies | Company policies and rules | Monthly | L1+ |
  | Technical | Architecture docs, API refs | Per release | L2+ |
  | Historical | Past decisions, incident reports | As created | L3+ |
  | Templates | Document templates, checklists | Quarterly | L1+ |

KB Search:
  - Full-text search with TF-IDF ranking
  - Semantic search via embedding similarity
  - Tag-based filtering (department, topic, type)
  - Minimum relevance score: 0.7 for auto-suggest

KB Update Protocol:
  1. PROPOSE: Agent submits change request with rationale
  2. REVIEW: CQO verifies accuracy and completeness
  3. APPROVE: Department head approves
  4. PUBLISH: HQ updates KB with version increment
  5. NOTIFY: Broadcast change to affected agents
  6. ARCHIVE: Previous version archived (never deleted)

Knowledge Extraction Pipeline (from CHO-KnowledgeExtractor):
  1. SCAN: Monitor agent conversations and outputs
  2. IDENTIFY: Detect new knowledge (patterns, insights, solutions)
  3. EXTRACT: Structured capture with metadata
  4. VALIDATE: CQO quality review
  5. CLASSIFY: Tag with department, topic, type
  6. PUBLISH: Add to appropriate KB collection
  7. NOTIFY: Alert relevant agents of new knowledge
```

### 3.4 Conflict Resolution

```
Conflict Classification:
  | Level | Type | Example | Resolution |
  |-------|------|---------|-----------|
  | L1-Informational | Misunderstanding | Different data views | Auto-merge with latest timestamp |
  | L2-Operational | Resource contention | Compute allocation conflict | Priority-based scheduling |
  | L3-Policy | Rule interpretation | Compliance scope disagreement | CLO arbitration |
  | L4-Strategic | Direction conflict | Department priority clash | CEO arbitration |
  | L5-Existential | Fundamental disagreement | Vision/mission dispute | Board resolution |

Resolution Protocol:
  1. LOG: Record conflict with all relevant context
  2. CLASSIFY: Determine level and type
  3. NOTIFY: Alert relevant parties and arbitrator
  4. GATHER: Collect positions from all parties (2h deadline)
  5. MEDIATE: Facilitate resolution at appropriate level
  6. DECIDE: Binding resolution with written rationale
  7. IMPLEMENT: Apply resolution via state update
  8. VERIFY: Confirm all parties comply within 24h
  9. ARCHIVE: Full record stored in KB for precedent

Conflict Metrics:
  - Target: <5 active conflicts at any time
  - L1-L2 resolution: <4h
  - L3-L4 resolution: <24h
  - L5 resolution: <1 week (or emergency Board session)
```

### 3.5 Audit Trail

```
Audit Event Schema:
  {
    "event_id": "uuid-v4",
    "timestamp": "ISO-8601",
    "agent_id": "AGENT_ID",
    "action": "string",
    "resource": "string",
    "result": "SUCCESS|FAILURE|DENIED",
    "details": "object",
    "correlation_id": "uuid-v4",
    "risk_level": "LOW|MEDIUM|HIGH|CRITICAL"
  }

Audit Categories:
  | Category | Retention | Access | Examples |
  |----------|-----------|--------|---------|
  | Security | 7 years | CISO + CLO only | Auth events, data access |
  | Financial | 7 years | CFO + CLO + audit | Transactions, approvals |
  | Operational | 3 years | Department head + CQO | Task execution, SLA |
  | Compliance | 7 years | CLO + regulators | Policy adherence, violations |
  | Decision | Permanent | CEO + Board | Strategic decisions, escalations |

Immutability Rules:
  - Audit records can NEVER be deleted (only archived)
  - Corrections are new records referencing the original
  - All modifications are themselves audited
  - Cryptographic hash chain for tamper detection
  - Quarterly integrity verification by CQO
```

---

## 4. Error Codes

| Code | Meaning | Resolution |
|------|---------|------------|
| HQ_E001 | Message routing failed | Retry 3x with backoff, then alert sender |
| HQ_E002 | State conflict detected | Apply last-write-wins, log conflict |
| HQ_E003 | KB search returned no results | Broaden search, suggest related topics |
| HQ_E004 | Conflict resolution timeout | Escalate to next level arbitrator |
| HQ_E005 | Audit record write failed | Retry with persistence guarantee, alert CISO |
| HQ_E006 | Agent heartbeat timeout | Mark agent offline, notify COO |
| HQ_E007 | Permission denied for state access | Log attempt, notify CISO if suspicious |
| HQ_E008 | Broadcast delivery partial | Retry failed recipients, log gap |

---

## 5. Integration Points

| Dependency | Usage | Protocol |
|-----------|-------|----------|
| All Agents | Routing, state, audit | Message bus + state API |
| CEO | Escalation, strategic decisions | Command channel |
| CISO | Security audit, access control | Security channel |
| CLO | Compliance audit, conflict mediation | Compliance channel |
| CQO | Quality audit, KB review | Quality channel |

---

## 6. Constraints

- No direct agent-to-agent communication (all through HQ)
- No audit record deletion (corrections only)
- No state changes without proper permission level
- No broadcast without CEO or COO authorization
- All messages must conform to schema or be rejected
- Maximum message size: 1MB (larger payloads use reference links)
- Heartbeat interval: 30 seconds for active agents

---

## 7. Quality Metrics

| Metric | Target | Measurement |
|--------|--------|-------------|
| Routing latency (P0) | <100ms | 99th percentile |
| Routing latency (P2) | <5s | 99th percentile |
| State consistency | 99.99% | Cross-replica verification |
| KB search relevance | >=0.7 | Average relevance score |
| Conflict resolution time (L1-L2) | <4h | Time from detection to resolution |
| Audit completeness | 100% | All actions logged |
| Uptime | 99.99% | Monthly measurement |

---

*Enhanced by AI-Company Skills Rebuilder v3.0*


Security scan verdicts — ClawScan: suspicious | static analysis: clean | VirusTotal: clean | SkillSpector: suspicious (HIGH)