ワンクリックで
pcl-expert
Expert in Persona Control Language (PCL) - language design, compiler architecture, runtime systems, and ecosystem development
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Expert in Persona Control Language (PCL) - language design, compiler architecture, runtime systems, and ecosystem development
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Expert system for designing, creating, and validating PCL skills with comprehensive domain knowledge extraction
Expert-level Docker containerization, image optimization, and container orchestration. Use this skill for building efficient Docker images, managing containers, and implementing Docker best practices.
Expert-level TypeScript development with modern tooling, advanced types, and best practices. Use this skill for TypeScript projects requiring type-safe code, modern bundling, and comprehensive testing.
Expert-level code review focusing on quality, security, performance, and maintainability. Use this skill for conducting thorough code reviews, identifying issues, and providing constructive feedback.
Expert-level AI system design, MLOps, architecture patterns, and AI infrastructure
Expert-level AI implementation, deployment, LLM integration, and production AI systems
| name | pcl-expert |
| version | 1.0.0 |
| description | Expert in Persona Control Language (PCL) - language design, compiler architecture, runtime systems, and ecosystem development |
| category | languages |
| tags | ["pcl","persona-control-language","compiler-design","language-design","dsl","runtime-systems","lexer","parser","semantic-analysis","codegen","type-systems","ast","lsp","mcp"] |
| allowed-tools | ["Read","Write","Edit","Execute","Debug","Test"] |
Master expert in Persona Control Language (PCL) - a domain-specific programming language and compiler for AI persona management. Comprehensive expertise in language design, compiler architecture, runtime execution, tooling ecosystem, and standards compliance.
// Token classification and scanning
interface Token {
type: TokenType;
value: string;
position: Position;
range: SourceRange;
}
// Advanced tokenization patterns
class Lexer {
// Character-by-character scanning
// Position tracking (line, column, offset)
// Error recovery mechanisms
// Unicode support (UTF-8)
// Comment handling (single-line, multi-line)
// String literal processing (escape sequences)
// Numeric literal parsing (integers, floats, scientific)
}
// Recursive descent parsing
interface Parser {
// Top-down parsing strategy
// AST node construction
// Error synchronization
// Predictive parsing (lookahead)
// Operator precedence handling
// Left-recursion elimination
}
// AST node patterns
type ASTNode =
| PersonaDeclaration
| SkillDeclaration
| TeamDeclaration
| WorkflowDeclaration
| Expression
| Statement;
// Discriminated unions for type safety
interface PersonaDeclaration {
type: 'PersonaDeclaration';
id: PersonaId;
skills: Skill[];
metadata: PersonaMetadata;
range: SourceRange;
}
// Type checking and validation
class SemanticAnalyzer {
private symbolTable: SymbolTable;
private typeChecker: TypeChecker;
private validator: Validator;
// Two-pass analysis
// 1. Declaration phase: Build symbol table
// 2. Validation phase: Type check and validate
analyzePersona(node: PersonaDeclaration): Result<void, Error[]> {
// Validate persona ID uniqueness
// Check skill references exist
// Verify composition constraints
// Ensure no circular dependencies
}
analyzeTeam(node: TeamDeclaration): Result<void, Error[]> {
// Validate team composition rules
// Check merge mode compatibility
// Verify persona references
// Validate weight distributions
}
}
// Target: JavaScript/TypeScript runtime
class CodeGenerator {
// Generate executable runtime code
// Optimize for performance
// Generate source maps
// Inline constants
// Dead code elimination
// Tree shaking
generatePersona(node: PersonaDeclaration): string {
// Emit JavaScript persona constructor
// Include skill composition logic
// Generate metadata serialization
}
generateWorkflow(node: WorkflowDeclaration): string {
// Emit workflow orchestration code
// Include state machine transitions
// Generate error handling wrappers
}
}
// PCL runtime architecture
class PCLRuntime {
// Persona lifecycle management
// Team coordination and consensus
// Workflow orchestration
// Memory management
// Event system
// Provider abstraction
async executePersona(
persona: Persona,
input: string,
context: Context
): Promise<PersonaResponse> {
// Activate persona with skills
// Execute with provider (OpenAI, Anthropic, etc.)
// Manage conversation context
// Handle errors and fallbacks
}
async executeTeam(
team: Team,
input: string,
options: TeamOptions
): Promise<TeamResponse> {
// Coordinate multiple personas
// Merge responses (consensus, weighted, etc.)
// Track outcomes and performance
// Adapt weights dynamically
}
}
// Workflow state management
interface StateMachine {
states: Map<string, State>;
transitions: Transition[];
currentState: string;
// State transition logic
transition(event: string, payload?: any): Promise<void>;
// Snapshot and restore
saveSnapshot(): Snapshot;
restoreSnapshot(snapshot: Snapshot): void;
// Event handlers
onStateEnter(state: string, handler: Handler): void;
onStateExit(state: string, handler: Handler): void;
}
// Multi-session memory with knowledge sharing
class MemoryManager {
// Short-term memory (current session)
// Long-term memory (persistent storage)
// Knowledge graphs (semantic relationships)
// Memory retrieval (semantic search)
// Memory consolidation (background process)
async store(
sessionId: string,
content: MemoryContent,
metadata: MemoryMetadata
): Promise<void>;
async retrieve(
sessionId: string,
query: string,
options: RetrievalOptions
): Promise<MemoryContent[]>;
async shareKnowledge(
sourcePersona: PersonaId,
targetPersona: PersonaId,
knowledge: Knowledge
): Promise<void>;
}
// PCL language server for IDE integration
class PCLLanguageServer {
// Features:
// - Syntax highlighting
// - Code completion (personas, skills, keywords)
// - Hover documentation
// - Go to definition
// - Find references
// - Rename refactoring
// - Code actions (quick fixes)
// - Diagnostics (errors, warnings)
// - Formatting
provideCompletionItems(
document: TextDocument,
position: Position
): CompletionItem[] {
// Context-aware completions
// Skill suggestions from registry
// Persona templates
// Keyword completions
}
provideDiagnostics(document: TextDocument): Diagnostic[] {
// Real-time error checking
// Type validation
// Semantic warnings
// Performance hints
}
}
// MCP server for AI tool integration
class PCLMCPServer {
// Expose PCL capabilities as MCP tools
// Resource management (personas, skills, teams)
// Prompt templates
// Sampling integration
async handleToolCall(
tool: string,
params: Record<string, unknown>
): Promise<ToolResult> {
switch (tool) {
case 'persona/activate':
return this.activatePersona(params);
case 'team/compose':
return this.composeTeam(params);
case 'workflow/execute':
return this.executeWorkflow(params);
}
}
async listResources(): Promise<Resource[]> {
// List available personas
// List available skills
// List available teams
// List available workflows
}
}
// Built-in personas, skills, and utilities
const stdlib = {
personas: {
ARCHI: {
/* Architecture expert */
},
DEV: {
/* Development expert */
},
SEC: {
/* Security expert */
},
DEVOPS: {
/* DevOps expert */
},
// 25+ built-in personas
},
skills: {
foundation: ['communication', 'analysis', 'problem-solving'],
technical: ['coding', 'debugging', 'testing'],
security: ['threat-modeling', 'secure-coding'],
architecture: ['system-design', 'patterns'],
standards: ['compliance', 'governance'],
tools: ['git', 'docker', 'kubernetes'],
},
teams: {
'security-review': {
personas: ['SEC', 'ARCHI', 'CRITIC'],
mergeMode: 'consensus',
},
'dream-team': {
personas: ['ARCHI', 'DEV', 'SEC', 'DEVOPS', 'QA'],
mergeMode: 'weighted',
},
standardization: {
personas: ['STANDARD_ARCHITECT', 'SPEC_EDITOR', 'COMPLIANCE_ENGINEER'],
mergeMode: 'sequential',
},
},
};
// Skill registry and artifact management
class SkillRegistry {
// Version management (semver)
// Dependency resolution
// Artifact storage (local, HTTP, S3)
// Search and discovery
// Import/export
async publish(
skill: Skill,
artifact: Artifact,
metadata: Metadata
): Promise<void>;
async install(skillId: string, version?: string): Promise<Skill>;
async search(query: SearchQuery): Promise<SearchResult[]>;
async resolve(dependencies: Dependency[]): Promise<Skill[]>;
}
// Production-ready observability stack
class Observability {
// OpenTelemetry integration
// Distributed tracing (Jaeger)
// Metrics collection (Prometheus)
// Structured logging
// Health checks
// Performance profiling
// SLO tracking
tracing: {
instrumentWorkflow(workflow: Workflow): void;
instrumentPersona(persona: Persona): void;
instrumentProvider(provider: Provider): void;
};
metrics: {
recordLatency(operation: string, duration: number): void;
recordTokenUsage(provider: string, tokens: number): void;
recordErrors(type: string, count: number): void;
};
logging: {
debug(message: string, context?: Record<string, unknown>): void;
info(message: string, context?: Record<string, unknown>): void;
warn(message: string, context?: Record<string, unknown>): void;
error(
message: string,
error: Error,
context?: Record<string, unknown>
): void;
};
}
// Learning and optimization systems
interface AdaptiveIntelligence {
// Memory management
memory: {
store: MemoryStorage;
manager: MemoryManager;
knowledgeSharing: KnowledgeSharing;
};
// Analytics and insights
analytics: {
performanceTracker: PerformanceTracker;
trendAnalyzer: TrendAnalyzer;
analyticsStore: AnalyticsStore;
};
// Intelligent routing
routing: {
router: IntelligentRouter;
taskClassifier: TaskClassifier;
};
// Response caching
cache: {
responseCache: ResponseCache;
semanticMatcher: SemanticMatcher;
};
// A/B testing
experiments: {
manager: ExperimentManager;
variantSelector: VariantSelector;
resultsAnalyzer: ResultsAnalyzer;
};
// Confidence scoring
confidence: {
scorer: ConfidenceScorer;
signalCollector: SignalCollector;
calibration: CalibrationEngine;
};
// Context management
context: {
windowManager: ContextWindowManager;
deduplication: Deduplication;
prioritization: Prioritization;
threading: Threading;
};
// Escalation management
escalation: {
manager: EscalationManager;
triggers: EscalationTriggers;
};
// Team optimization
teams: {
outcomeTracker: OutcomeTracker;
weightAdapter: WeightAdapter;
};
}
// REST API for remote artifact management
class HTTPRegistryServer {
// Express-based HTTP server
// OpenAPI/Swagger documentation
// JWT authentication
// Rate limiting
// CORS support
// Compression (gzip, brotli)
// Security headers (Helmet)
routes: {
// Authentication
'POST /auth/register': RegisterHandler;
'POST /auth/login': LoginHandler;
'POST /auth/refresh': RefreshTokenHandler;
'POST /auth/logout': LogoutHandler;
// Artifacts
'GET /artifacts': ListArtifactsHandler;
'GET /artifacts/:name': GetArtifactHandler;
'POST /artifacts': PublishArtifactHandler;
'PUT /artifacts/:name': UpdateArtifactHandler;
'DELETE /artifacts/:name': DeleteArtifactHandler;
// Versions
'GET /artifacts/:name/versions': ListVersionsHandler;
'GET /artifacts/:name/versions/:version': GetVersionHandler;
// Search
'GET /search': SearchHandler;
'GET /search/suggestions': SuggestionsHandler;
// Metrics & Health
'GET /metrics': MetricsHandler;
'GET /health': HealthCheckHandler;
'GET /profiler': ProfilerHandler;
};
}
// Command-line interface for PCL development
const cli = {
// Compilation
'pcl build': 'Compile PCL to JavaScript/TypeScript',
'pcl watch': 'Watch mode for development',
// Execution
'pcl run': 'Execute a PCL program',
'pcl repl': 'Interactive REPL',
// Skills management
'pcl skills list': 'List installed skills',
'pcl skills search': 'Search skill registry',
'pcl skills install': 'Install a skill',
'pcl skills create': 'Create a new skill',
'pcl skills publish': 'Publish to registry',
'pcl skills validate': 'Validate skill format',
// Registry
'pcl registry export': 'Export registry',
'pcl registry import': 'Import registry',
'pcl registry search': 'Search remote registry',
// Initialization
'pcl init': 'Initialize PCL project',
'pcl completion': 'Shell completion scripts',
// Language server
'pcl lsp': 'Start language server',
// MCP server
'pcl mcp': 'Start MCP server',
// HTTP server
'pcl serve': 'Start HTTP registry server',
};
persona TYPESCRIPT_EXPERT {
description: "Expert in TypeScript development"
skills: [
"typescript-advanced",
"type-system-design",
"compiler-api",
"testing-frameworks"
]
provider: "anthropic:claude-3-5-sonnet"
temperature: 0.7
maxTokens: 4096
}
team CODE_REVIEW_TEAM {
description: "Comprehensive code review team"
personas: [
TYPESCRIPT_EXPERT,
SECURITY_EXPERT,
PERFORMANCE_EXPERT
]
mergeMode: "consensus"
weights: {
TYPESCRIPT_EXPERT: 0.5,
SECURITY_EXPERT: 0.3,
PERFORMANCE_EXPERT: 0.2
}
}
workflow CODE_REVIEW_WORKFLOW {
description: "Automated code review process"
step ANALYZE {
persona: TYPESCRIPT_EXPERT
input: file("src/components/Button.tsx")
output: "analysis"
}
step SECURITY_CHECK {
persona: SECURITY_EXPERT
input: $analysis
output: "security_report"
}
step FINAL_REVIEW {
team: CODE_REVIEW_TEAM
input: {
analysis: $analysis,
security: $security_report
}
output: "final_verdict"
}
}
skill RUST_EXPERT {
name: "rust-expert"
version: "1.0.0"
category: "languages"
description: "Expert in Rust programming"
capabilities: [
"memory-safety",
"concurrency",
"zero-cost-abstractions",
"trait-system"
]
tools: ["Read", "Write", "Execute", "Debug"]
}
// Unit tests for each compiler phase
describe('Lexer', () => {
it('tokenizes persona declaration', () => {
const source = 'persona ARCHI { }';
const tokens = lexer.scan(source);
expect(tokens[0].type).toBe('KEYWORD');
});
});
// Integration tests for full pipeline
describe('Compiler', () => {
it('compiles valid PCL to JavaScript', () => {
const source = readFile('examples/persona.pcl');
const result = compile(source);
expect(result.ok).toBe(true);
});
});
// End-to-end tests for runtime
describe('Runtime', () => {
it('executes persona with OpenAI provider', async () => {
const persona = loadPersona('ARCHI');
const response = await runtime.execute(persona, 'Design a REST API');
expect(response.content).toBeDefined();
});
});
// BAD
let currentPersona: Persona | null = null;
// GOOD
class Parser {
private currentPersona: Persona | null = null;
}
// BAD
function parse(source: string): AST {
throw new Error('Parse failed');
}
// GOOD
function parse(source: string): Result<AST, Error[]> {
const errors: Error[] = [];
if (errors.length > 0) {
return { ok: false, errors };
}
return { ok: true, value: ast };
}
// BAD
function transform(node: PersonaDeclaration) {
node.skills.push(newSkill);
}
// GOOD
function transform(node: PersonaDeclaration): PersonaDeclaration {
return {
...node,
skills: [...node.skills, newSkill],
};
}
// BAD
function processNode(node: any) {
if (node.type === 'PersonaDecl') {
// Typo - should be PersonaDeclaration
}
}
// GOOD
type ASTNode =
| { type: 'PersonaDeclaration' /* ... */ }
| { type: 'SkillDeclaration' /* ... */ };
function processNode(node: ASTNode) {
switch (
node.type
// TypeScript enforces correct types
) {
}
}
// Memoize expensive computations
const typeCache = new Map<ASTNode, Type>();
function inferType(node: ASTNode): Type {
if (typeCache.has(node)) {
return typeCache.get(node)!;
}
const type = computeType(node);
typeCache.set(node, type);
return type;
}
// Deduplicate identical strings
class StringPool {
private pool = new Map<string, string>();
intern(str: string): string {
if (this.pool.has(str)) {
return this.pool.get(str)!;
}
this.pool.set(str, str);
return str;
}
}
// Process large files in chunks
async function* parseStream(stream: ReadableStream): AsyncGenerator<ASTNode> {
const lexer = new StreamingLexer(stream);
const parser = new IncrementalParser(lexer);
for await (const node of parser.parseNodes()) {
yield node;
}
}
persona-control-languageStatus: ✅ Active Last Updated: 2026-01-31 Maintainer: PCL Core Team License: MIT