- ้กน็ฎๆฆ่ฟฐ
- ๅทฅ็จๅๅ
- ๆ ธๅฟๆถๆ
- Package่ฎพ่ฎก
- ๅฎ็ฐ็ป่
- ไฝฟ็จๆต็จ
- MCP็ๆ้ๆ
- Adapter่ฎพ่ฎก
- ๅผๅ่ทฏ็บฟๅพ
- ้ๅฝ
SVP (Semantic Voxel Protocol) - ่ฏญไนไฝ็ด ๅ่ฎฎ
AI-Humanๅไฝ็ผ็จ็"ๆบ่ฝไธไธๆ็ฝๅ ณ"๏ผ้่ฟ่ฏญไนไฝ็ด +LODๆๆฏ๏ผไธบAIๆไพ็ปๆๅ็ไปฃ็ ่ฎค็ฅ็ฉบ้ดใ
Code โ Voxel Space โ AI Understanding
ๅๅงไปฃ็ โโโถ ่ฏญไนไฝ็ด ็ฉบ้ด โโโถ AIๅฏ็่งฃ็็ปๆๅไธไธๆ
svp/
โโโ packages/
โ โโโ core/ # @semanticvoxelprotocol/core
โ โ โโโ ๆ ธๅฟๅผๆ๏ผไฝ็ด ๅใLODใไธไธๆ็ฎก็๏ผ
โ โ
โ โโโ sdk/ # @semanticvoxelprotocol/sdk
โ โ โโโ TypeScript SDK๏ผๅผๅ่
ไฝฟ็จ๏ผ
โ โ
โ โโโ mcp-server/ # @semanticvoxelprotocol/mcp-server
โ โ โโโ MCPๅ่ฎฎ้้
๏ผClaude/Cursor้ๆ๏ผ
โ โ
โ โโโ cli/ # @semanticvoxelprotocol/cli
โ โ โโโ ๅฝไปค่กๅทฅๅ
ท
โ โ
โ โโโ vscode-extension/ # VS Codeๆฉๅฑ
โ โ โโโ IDEๆไปถ
โ โ
โ โโโ adapters/
โ โ โโโ lsp-adapter/ # LSPๅ่ฎฎ้้
โ โ โโโ git-adapter/ # Git้ๆ
โ โ โโโ tree-sitter-adapter/ # ่ฏญๆณ่งฃๆ
โ โ
โ โโโ shared/ # @semanticvoxelprotocol/shared
โ โโโ ๅ
ฑไบซ็ฑปๅๅๅทฅๅ
ท
โ
โโโ apps/
โ โโโ playground/ # ๅผๅๆต่ฏ็ฏๅข
โ
โโโ docs/
โ โโโ specification/ # ๅ่ฎฎ่ง่
โ โโโ api-reference/ # APIๆๆกฃ
โ
โโโ examples/
โโโ basic-usage/ # ๅบ็ก็จๆณ็คบไพ
โโโ mcp-integration/ # MCP้ๆ็คบไพ
โโโโโโโโโโโโโโโโโโโ
โ vscode-ext โ
โโโโโโโโโโฌโโโโโโโโโ
โ
โโโโโโโโโโผโโโโโโโโโ
โ cli โ
โโโโโโโโโโฌโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโ
โ โ โ
โโโโโโโโโโผโโโโโโโโโ โ โโโโโโโโโโโผโโโโโโโโโโ
โ mcp-server โ โ โ playground โ
โโโโโโโโโโฌโโโโโโโโโ โ โโโโโโโโโโโโโโโโโโโโโ
โ โ
โโโโโโโโโโผโโโโโโโโโโโโโโดโโโโโโโโโ
โ sdk โ
โโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโ
โ โ โ
โโโโโโผโโโโโ โโโโโโโโผโโโโโโโ โโโโโโผโโโโโ
โ core โ โ shared โ โadapters โ
โโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Application Layer โ
โ CLI โ VS Code Ext โ MCP Server โ Web UI โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ SDK Layer โ
โ VoxelClient โ ContextAPI โ QueryAPI โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Core Engine Layer โ
โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โ
โ โ Ingestion โ โ Voxelizationโ โ LOD โ โ
โ โ Engine โ โ Engine โ โ Manager โ โ
โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โ
โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โ
โ โ Context โ โ Query โ โ Sync โ โ
โ โ Aggregator โ โ Engine โ โ Manager โ โ
โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Adapter Layer โ
โ LSP Adapter โ Git Adapter โ Tree-sitter โ File System โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Data Layer โ
โ Octree Index โ Vector DB โ Semantic Cache โ File Storage โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
// packages/core/src/ingestion/engine.ts
interface IngestionConfig {
source: {
rootPath: string;
include: string[];
exclude: string[];
gitIntegration: boolean;
};
context: {
configFiles: string[];
designDocs: string[];
envVars: string[];
screenshots: string[];
};
watch: {
enabled: boolean;
debounceMs: number;
};
}
class IngestionEngine {
constructor(private config: IngestionConfig) {}
// ๆซๆๆบ็ ๆไปถ
async scanSource(): Promise<SourceFile[]> {
// ไฝฟ็จglobๆซๆๆไปถ
// ๆ้คnode_modules็ญ
}
// ๅ ่ฝฝๅค้จไธไธๆ
async loadExternalContext(): Promise<ExternalContext> {
// ่ฏปๅ.svp/config.yaml
// ๅ ่ฝฝ่ฎพ่ฎกๆๆกฃ
// ่งฃๆ็ฏๅขๅ้
}
// ็ๅฌๆไปถๅๅ
watchChanges(callback: (event: FileEvent) => void): void {
// ไฝฟ็จchokidar็ๅฌ
// ้ฒๆๅค็
}
}// packages/core/src/voxelization/engine.ts
interface SemanticVoxel {
id: string;
position: { x: number; y: number; z: number };
nodeType: ASTNodeType;
semanticRole: SemanticRole;
dataType?: string;
scopeLevel: number;
parent?: VoxelRef;
children: VoxelRef[];
references: VoxelRef[];
sourceLocation: SourceLocation;
codeSnippet: string;
visual: VisualProperties;
}
class VoxelizationEngine {
constructor(
private parser: TreeSitterAdapter,
private lspAdapter: LSPAdapter
) {}
// ๅฐAST่ฝฌๆขไธบ่ฏญไนไฝ็ด
async voxelize(ast: ASTNode[]): Promise<SemanticVoxel[]> {
// ้ๅAST่็น
// ไธบๆฏไธช่็นๅๅปบไฝ็ด
// ่ฎก็ฎ็ฉบ้ดๅๆ
}
// ๆๅปบๅ
ซๅๆ ็ดขๅผ
buildOctree(voxels: SemanticVoxel[]): OctreeIndex {
// ไฝฟ็จ็จ็ๅ
ซๅๆ
// ๆฏๆๅฟซ้็ฉบ้ดๆฅ่ฏข
}
// ๅปบ็ซๅ
ณ็ณปๅพ่ฐฑ
buildRelationGraph(voxels: SemanticVoxel[]): RelationGraph {
// ่ฐ็จๅ
ณ็ณป
// ๆฐๆฎๆตๅ
ณ็ณป
// ็ปงๆฟๅ
ณ็ณป
}
}// packages/core/src/lod/manager.ts
enum LODLevel {
ARCHITECTURE = 5, // ๆถๆๆๅพ
MODULE = 4, // ๆจกๅๅฅ็บฆ
ALGORITHM = 3, // ็ฎๆณ้ป่พ
IMPLEMENTATION = 2, // ๅฎ็ฐ็ป่
SYNTAX = 1 // ่ฏญๆณ็ปๆ
}
interface LODProfile {
level: LODLevel;
includeProperties: string[];
excludeProperties: string[];
renderMode: 'voxel' | 'cluster' | 'graph';
}
class LODManager {
// ้ข่ฎก็ฎๆฏไธชไฝ็ด ็LOD็บงๅซ
precomputeLODs(voxel: SemanticVoxel): Map<LODLevel, LODVoxel> {
// LOD-5: ๅชไฟ็ๆฅๅฃๅฎไน
// LOD-4: ไฟ็ๅฝๆฐ็ญพๅๅๅ
ณ้ฎๆณจ้
// LOD-3: ไฟ็ๆงๅถๆต็ปๆ
// LOD-2: ไฟ็ๅฎๆดๅฎ็ฐ
// LOD-1: ไฟ็่ฏญๆณ็ป่
}
// ๆ นๆฎไธไธๆ้ๆฉLOD
selectLOD(context: TaskContext): LODLevel {
// taskType: navigation/debugging/refactoring
// userExpertise: novice/intermediate/expert
// timeConstraint: quick/normal/deep
}
// LODๅนณๆป่ฟๆธก
async transitionLOD(
from: LODLevel,
to: LODLevel,
focusVoxel?: VoxelRef
): Promise<TransitionResult> {
// ๅจ็ป่ฟๆธก
// ไฟๆไธไธๆ่ฟ็ปญๆง
}
}// packages/core/src/context/aggregator.ts
interface ContextSnapshot {
codeContext: {
voxels: SemanticVoxel[];
relations: RelationEdge[];
lod: LODLevel;
};
externalContext: {
designDocs: DesignDoc[];
envVars: EnvVar[];
screenshots: Screenshot[];
};
meta: {
projectName: string;
language: string;
totalFiles: number;
totalVoxels: number;
coverage: number;
tokenUsage: TokenUsage;
};
}
class ContextAggregator {
constructor(
private voxelEngine: VoxelizationEngine,
private lodManager: LODManager,
private queryEngine: QueryEngine
) {}
// ๅๆไปปๅกๆๅพ
analyzeIntent(query: string): TaskIntent {
// ๅ
ณ้ฎ่ฏๆๅ
// ๅฎไฝ่ฏๅซ
// ไปปๅกๅ็ฑป
}
// ็ป่ฃ
ไธไธๆ
async buildContext(
query: string,
maxTokens: number
): Promise<ContextSnapshot> {
// 1. ๅๆๆๅพ
// 2. ๆ็ดข็ธๅ
ณไฝ็ด
// 3. ้ๆฉLOD
// 4. ๅ ่ฝฝๅค้จไธไธๆ
// 5. ็ฎก็Token้ข็ฎ
}
// Token้ข็ฎ็ฎก็
manageTokenBudget(
context: ContextSnapshot,
maxTokens: number
): TrimmedContext {
// ไผๅ
็บงๆๅบ
// ่ฃๅชไฝไผๅ
็บงๅ
ๅฎน
// ็กฎไฟๆ ธๅฟไธไธๆไฟ็
}
}// packages/core/src/query/engine.ts
interface QueryOptions {
keywords?: string[];
semanticType?: string;
lod?: LODLevel;
boundingBox?: BoundingBox;
limit?: number;
}
class QueryEngine {
constructor(private octreeIndex: OctreeIndex) {}
// ่ฏญไนๆ็ดข
async semanticSearch(query: string): Promise<VoxelRef[]> {
// ๅ้ๅๆฅ่ฏข
// ็ธไผผๅบฆ่ฎก็ฎ
// ่ฟๅ็ธๅ
ณไฝ็ด
}
// ็ฉบ้ดๆฅ่ฏข
async spatialQuery(
center: Position,
radius: number
): Promise<VoxelRef[]> {
// ๅ
ซๅๆ ่ๅดๆฅ่ฏข
}
// ๅ
ณ็ณปๆฅ่ฏข
async relationQuery(
voxelId: string,
relationType: RelationType
): Promise<VoxelRef[]> {
// ่ฐ็จๅพ้ๅ
// ๆฐๆฎๆต่ฟฝ่ธช
}
}package.json
{
"name": "@semanticvoxelprotocol/core",
"version": "0.1.0",
"description": "SVPๆ ธๅฟๅผๆ",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"build": "tsc",
"test": "jest",
"lint": "eslint src/**/*.ts"
},
"dependencies": {
"@semanticvoxelprotocol/shared": "workspace:*",
"tree-sitter": "^0.21.0",
"chokidar": "^3.6.0",
"yaml": "^2.4.0"
},
"devDependencies": {
"typescript": "^5.4.0",
"@types/node": "^20.11.0"
}
}็ฎๅฝ็ปๆ
core/
โโโ src/
โ โโโ index.ts # ๅ
ฅๅฃ
โ โโโ ingestion/
โ โ โโโ engine.ts
โ โ โโโ scanner.ts
โ โ โโโ watcher.ts
โ โโโ voxelization/
โ โ โโโ engine.ts
โ โ โโโ coordinate.ts
โ โ โโโ properties.ts
โ โโโ lod/
โ โ โโโ manager.ts
โ โ โโโ profiles.ts
โ โ โโโ transition.ts
โ โโโ context/
โ โ โโโ aggregator.ts
โ โ โโโ intent.ts
โ โ โโโ budget.ts
โ โโโ query/
โ โ โโโ engine.ts
โ โ โโโ semantic.ts
โ โ โโโ spatial.ts
โ โโโ storage/
โ โ โโโ octree.ts
โ โ โโโ cache.ts
โ โ โโโ persistence.ts
โ โโโ utils/
โ โโโ logger.ts
โ โโโ errors.ts
โโโ tests/
โ โโโ *.test.ts
โโโ package.json
โโโ tsconfig.json
package.json
{
"name": "@semanticvoxelprotocol/sdk",
"version": "0.1.0",
"description": "SVP TypeScript SDK",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"build": "tsc",
"test": "jest"
},
"dependencies": {
"@semanticvoxelprotocol/core": "workspace:*",
"@semanticvoxelprotocol/shared": "workspace:*",
"axios": "^1.6.0",
"ws": "^8.16.0"
}
}ๆ ธๅฟAPI
// packages/sdk/src/client.ts
export class SVPClient {
constructor(options: SVPClientOptions) {
// ๅๅงๅ่ฟๆฅ
}
// ่ทๅไธไธๆๅฟซ็
ง
async getContext(query: string): Promise<ContextSnapshot> {
// ่ฐ็จๆ ธๅฟๅผๆ
}
// ๆฅ่ฏขไฝ็ด
async queryVoxels(options: QueryOptions): Promise<SemanticVoxel[]> {
// ็ฉบ้ด/่ฏญไนๆฅ่ฏข
}
// ๅๆขLOD
async switchLOD(level: LODLevel): Promise<void> {
// LODๅๆข
}
// ็ๅฌๅๅ
onChange(callback: (event: ChangeEvent) => void): void {
// WebSocketๅฎๆถๅๆญฅ
}
}package.json
{
"name": "@semanticvoxelprotocol/mcp-server",
"version": "0.1.0",
"description": "SVP MCP Server",
"bin": {
"svp-mcp": "dist/server.js"
},
"scripts": {
"build": "tsc",
"start": "node dist/server.js"
},
"dependencies": {
"@semanticvoxelprotocol/core": "workspace:*",
"@modelcontextprotocol/sdk": "^0.5.0"
}
}MCP Serverๅฎ็ฐ
// packages/mcp-server/src/server.ts
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
class SVP_MCPServer {
private server: Server;
private core: SVPCore;
constructor() {
this.server = new Server({
name: 'svp-mcp-server',
version: '0.1.0'
}, {
capabilities: {
resources: {},
tools: {}
}
});
this.setupHandlers();
}
private setupHandlers() {
// Resources: ๆด้ฒไฝ็ด ๅฐๅพ
this.server.setRequestHandler(ListResourcesRequestSchema, async () => {
return {
resources: [
{
uri: 'svp://project/voxels',
name: 'Project Voxel Map',
mimeType: 'application/vnd.svp.voxel+json'
},
{
uri: 'svp://project/context',
name: 'Current Context',
mimeType: 'application/vnd.svp.context+json'
}
]
};
});
// Tools: ๆไพLODๅๆขใๆฅ่ฏข็ญๅ่ฝ
this.server.setRequestHandler(ListToolsRequestSchema, async () => {
return {
tools: [
{
name: 'switch_lod',
description: 'Switch to a different LOD level',
inputSchema: {
type: 'object',
properties: {
level: {
type: 'number',
enum: [1, 2, 3, 4, 5],
description: 'LOD level'
}
},
required: ['level']
}
},
{
name: 'query_voxels',
description: 'Query voxels by semantic criteria',
inputSchema: {
type: 'object',
properties: {
keywords: {
type: 'array',
items: { type: 'string' }
},
semanticType: { type: 'string' },
lod: { type: 'number' }
}
}
},
{
name: 'get_context',
description: 'Get context snapshot for a query',
inputSchema: {
type: 'object',
properties: {
query: { type: 'string' },
maxTokens: { type: 'number' }
},
required: ['query']
}
}
]
};
});
}
async run() {
const transport = new StdioServerTransport();
await this.server.connect(transport);
}
}
// ๅฏๅจๆๅกๅจ
const server = new SVP_MCPServer();
server.run();package.json
{
"name": "@semanticvoxelprotocol/cli",
"version": "0.1.0",
"description": "SVP CLIๅทฅๅ
ท",
"bin": {
"svp": "dist/cli.js"
},
"scripts": {
"build": "tsc"
},
"dependencies": {
"@semanticvoxelprotocol/core": "workspace:*",
"commander": "^12.0.0",
"chalk": "^5.3.0",
"ora": "^8.0.0"
}
}CLIๅฎ็ฐ
// packages/cli/src/cli.ts
import { Command } from 'commander';
import chalk from 'chalk';
const program = new Command();
program
.name('svp')
.description('Semantic Voxel Protocol CLI')
.version('0.1.0');
// svp init
program
.command('init')
.description('Initialize SVP for current project')
.option('-l, --language <lang>', 'Project language', 'typescript')
.action(async (options) => {
console.log(chalk.blue('Initializing SVP...'));
// ๅๅปบ.svp/็ฎๅฝ
// ็ๆ้ป่ฎค้
็ฝฎ
// ้ฆๆฌกไฝ็ด ๅ
});
// svp voxelize
program
.command('voxelize')
.description('Voxelize the codebase')
.option('-w, --watch', 'Watch for changes')
.action(async (options) => {
console.log(chalk.blue('Voxelizing...'));
// ๆซๆๆบ็
// ็ๆไฝ็ด
// ๆๅปบ็ดขๅผ
});
// svp serve
program
.command('serve')
.description('Start SVP service')
.option('-p, --port <port>', 'Port number', '8080')
.action(async (options) => {
console.log(chalk.blue(`Starting SVP service on port ${options.port}...`));
// ๅฏๅจHTTP/gRPCๆๅก
// ๆฏๆๅคๅฎขๆท็ซฏ่ฟๆฅ
});
// svp query
program
.command('query <query>')
.description('Query the voxel space')
.option('-l, --lod <level>', 'LOD level', '4')
.action(async (query, options) => {
// ๆง่กๆฅ่ฏข
// ๆพ็คบ็ปๆ
});
program.parse();// packages/shared/src/types.ts
// ๆ ธๅฟไฝ็ด ็ฑปๅ
export interface SemanticVoxel {
id: string;
position: Vector3;
nodeType: ASTNodeType;
semanticRole: SemanticRole;
dataType?: string;
scopeLevel: number;
parent?: VoxelRef;
children: VoxelRef[];
references: VoxelRef[];
sourceLocation: SourceLocation;
codeSnippet: string;
visual: VisualProperties;
lodProfiles: Map<LODLevel, LODVoxel>;
}
// LOD็บงๅซ
export enum LODLevel {
SYNTAX = 1,
IMPLEMENTATION = 2,
ALGORITHM = 3,
MODULE = 4,
ARCHITECTURE = 5
}
// ไธไธๆๅฟซ็
ง
export interface ContextSnapshot {
codeContext: {
voxels: SemanticVoxel[];
relations: RelationEdge[];
lod: LODLevel;
};
externalContext: {
designDocs: DesignDoc[];
envVars: EnvVar[];
screenshots: Screenshot[];
};
meta: ContextMeta;
}
// ๆฅ่ฏข้้กน
export interface QueryOptions {
keywords?: string[];
semanticType?: ASTNodeType;
lod?: LODLevel;
boundingBox?: BoundingBox;
limit?: number;
}
// ไปปๅกไธไธๆ
export interface TaskContext {
taskType: TaskType;
userExpertise: UserExpertise;
timeConstraint: TimeConstraint;
focusArea?: VoxelRef[];
history: NavigationPath[];
}// packages/core/src/storage/octree.ts
export class OctreeNode {
voxels: SemanticVoxel[] = [];
children: OctreeNode[] | null = null;
constructor(
public bounds: BoundingBox,
public depth: number,
public maxDepth: number = 8
) {}
insert(voxel: SemanticVoxel): void {
if (this.depth === this.maxDepth) {
this.voxels.push(voxel);
return;
}
if (!this.children) {
this.subdivide();
}
const childIndex = this.getChildIndex(voxel.position);
this.children![childIndex].insert(voxel);
}
queryRange(range: BoundingBox): SemanticVoxel[] {
if (!this.intersects(range)) {
return [];
}
let results = this.voxels.filter(v => range.contains(v.position));
if (this.children) {
for (const child of this.children) {
results = results.concat(child.queryRange(range));
}
}
return results;
}
private subdivide(): void {
// ๅๅปบ8ไธชๅญ่็น
}
private getChildIndex(position: Vector3): number {
// ่ฎก็ฎๅญ่็น็ดขๅผ
}
private intersects(range: BoundingBox): boolean {
// AABB็ธไบคๆต่ฏ
}
}# ๅ
จๅฑๅฎ่ฃ
CLI
npm install -g @semanticvoxelprotocol/cli
# ๆ่
ๆฌๅฐๅฎ่ฃ
npm install --save-dev @semanticvoxelprotocol/cli
# ๅฎ่ฃ
SDK๏ผ็จไบ็จๅบๅ่ฎฟ้ฎ๏ผ
npm install @semanticvoxelprotocol/sdk# ่ฟๅ
ฅ้กน็ฎ็ฎๅฝ
cd my-project
# ๅๅงๅSVP
svp init
# ไบคไบๅผ้
็ฝฎ
# ? Project language: TypeScript
# ? Include git history: Yes
# ? LOD default level: 4 (Module Contract)
# ? Token budget: 8000
# ็ๆ้
็ฝฎๆไปถ
# .svp/config.yaml# .svp/config.yaml
project:
name: "my-project"
language: "typescript"
description: "A task management application"
source:
root: "./src"
include:
- "src/**/*"
- "lib/**/*"
exclude:
- "node_modules"
- "dist"
- "**/*.test.ts"
- "**/*.spec.ts"
git:
enabled: true
maxHistoryDepth: 100
context:
designDocs:
- path: "docs/architecture.md"
description: "System architecture"
- path: "docs/api-design.md"
description: "API design document"
envVars:
- path: ".env.example"
description: "Environment template"
screenshots:
- path: "assets/architecture.png"
description: "Architecture diagram"
relatedTo: ["src/core", "src/api"]
lod:
defaultLevel: 4
overrides:
- path: "src/core/**"
level: 2
- path: "src/utils/**"
level: 5
exposure:
virtualFolders:
"/core":
physicalPaths: ["src/core/**"]
description: "Core business logic"
"/api":
physicalPaths: ["src/api/**"]
description: "API endpoints"
restrictedPaths:
- "src/secrets/**"
- ".env.production"
tokenBudget:
default: 8000
max: 32000
sync:
reverseSync:
enabled: true
highlightActiveVoxels: true
showArchitectureUpdates: true
realtime:
enabled: true
debounceMs: 500# ๅฏๅจๆฌๅฐๆๅก
svp serve
# ้้กน
svp serve --port 8080 --watch
# ่พๅบ
# โ Loaded configuration from .svp/config.yaml
# โ Indexed 1,247 files
# โ Generated 45,832 voxels
# โ Built octree index (depth: 8)
# โ SVP service running on http://localhost:8080import { SVPClient } from '@semanticvoxelprotocol/sdk';
const client = new SVPClient({
endpoint: 'http://localhost:8080',
project: 'my-project'
});
// ่ทๅไธไธๆ
const context = await client.getContext({
query: 'ๅฎ็ฐ็จๆท็ปๅฝๅ่ฝ',
maxTokens: 8000
});
console.log(context.codeContext.voxels);
console.log(context.externalContext.designDocs);
// ๆฅ่ฏขไฝ็ด
const voxels = await client.queryVoxels({
keywords: ['auth', 'login'],
semanticType: 'function',
lod: 4
});
// ๅๆขLOD
await client.switchLOD(LODLevel.IMPLEMENTATION);
// ็ๅฌๅๅ
client.onChange((event) => {
console.log('Code changed:', event.file);
console.log('Affected voxels:', event.voxels);
});// claude_desktop_config.json
{
"mcpServers": {
"semantic-voxel": {
"command": "npx",
"args": ["-y", "@semanticvoxelprotocol/mcp-server"],
"env": {
"SVP_PROJECT_PATH": "/path/to/your/project"
}
}
}
}็ฐๅจClaudeๅฏไปฅ๏ผ
- ่ชๅจ่ทๅ้กน็ฎไธไธๆ
- ๅฏผ่ช่ฏญไนไฝ็ด ็ฉบ้ด
- ๅจๆๅๆขLOD็บงๅซ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ AI็ผ็จๅ่ฎฎ็ๆ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ A2A (Agent-to-Agent) โ
โ - Agent้ดๅไฝ้ไฟก โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ MCP (Model Context Protocol) โ
โ - ๅทฅๅ
ท่ฐ็จใ่ตๆบ่ฎฟ้ฎ โ
โ - SVPไฝไธบMCP Serverๆด้ฒไฝ็ด ๆๅก โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
SVP (Semantic Voxel Protocol) โ
โ โ
ไปฃ็ ่ฏญไน่กจ็คบใLOD็ฎก็ โ
โ โ
ๅ
ฑไบซ่ฎค็ฅ็ฉบ้ด โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ LSP (Language Server Protocol) โ
โ - ่ฏญๆณๅๆใ็ฌฆๅท่งฃๆ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
// Resources๏ผ่ตๆบ๏ผ
{
'svp://{project}/voxels': 'ไฝ็ด ๅฐๅพ',
'svp://{project}/context': 'ๅฝๅไธไธๆ',
'svp://{project}/architecture': 'ๆถๆ่งๅพ',
'svp://{project}/relations': 'ๅ
ณ็ณปๅพ่ฐฑ'
}
// Tools๏ผๅทฅๅ
ท๏ผ
{
'switch_lod': 'ๅๆขLOD็บงๅซ',
'query_voxels': 'ๆฅ่ฏขไฝ็ด ',
'get_context': '่ทๅไธไธๆๅฟซ็
ง',
'navigate_relation': 'ๅฏผ่ชๅ
ณ็ณปๅพ่ฐฑ',
'highlight_voxel': '้ซไบฎไฝ็ด '
}
// Prompts๏ผๆ็คบๆจกๆฟ๏ผ
{
'code_review': 'ไปฃ็ ๅฎกๆฅๆจกๆฟ',
'refactoring': '้ๆๅปบ่ฎฎๆจกๆฟ',
'architecture_review': 'ๆถๆๅฎกๆฅๆจกๆฟ'
}โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ MCP็ๆ็ณป็ป โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโ โ
โ โ Filesystem โ โ GitHub โ โ Database โ โ
โ โ Server โ โ Server โ โ Server โ โ
โ โโโโโโโโฌโโโโโโโ โโโโโโโโฌโโโโโโโ โโโโโโโฌโโโโโโโ โ
โ โ โ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ
โ โโโโโโโโโโผโโโโโโโโโ โ
โ โ MCP Host โ โ
โ โ (Claude/Cursor) โ โ
โ โโโโโโโโโโฌโโโโโโโโโ โ
โ โ โ
โ โโโโโโโโโโผโโโโโโโโโ โ
โ โ SVP Server โ โ
โ โ (ไปฃ็ ่ฏญไนๆๅก) โ โ
โ โโโโโโโโโโโโโโโโโโโ โ
โ โ
โ Claude: "ๆ้่ฆไฟฎๆน็จๆท่ฎค่ฏๆจกๅ" โ
โ โ โ
โ SVP Server: ๆไพ็ธๅ
ณไฝ็ด ๏ผLOD-4ๆจกๅ่งๅพ๏ผ โ
โ โ โ
โ Filesystem Server: ่ฏปๅ/ๅๅ
ฅๆไปถ โ
โ โ โ
โ GitHub Server: ๅๅปบPR โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
// packages/adapters/lsp-adapter/src/index.ts
export class LSPAdapter {
private connection: Connection;
constructor(private serverPath: string) {}
async initialize(): Promise<void> {
// ๅฏๅจLSPๆๅกๅจ
// ๅปบ็ซ่ฟๆฅ
}
// ่ทๅ็ฌฆๅทไฟกๆฏ
async getSymbols(filePath: string): Promise<SymbolInformation[]> {
const response = await this.connection.sendRequest(
'textDocument/documentSymbol',
{ textDocument: { uri: filePath } }
);
return response;
}
// ่ทๅ็ฑปๅๅฎไน
async getTypeDefinition(
filePath: string,
position: Position
): Promise<Location[]> {
const response = await this.connection.sendRequest(
'textDocument/typeDefinition',
{
textDocument: { uri: filePath },
position
}
);
return response;
}
// ่ทๅๅผ็จ
async getReferences(
filePath: string,
position: Position
): Promise<Location[]> {
const response = await this.connection.sendRequest(
'textDocument/references',
{
textDocument: { uri: filePath },
position,
context: { includeDeclaration: true }
}
);
return response;
}
}// packages/adapters/git-adapter/src/index.ts
export class GitAdapter {
constructor(private repoPath: string) {}
// ่ทๅๆไปถๅๅฒ
async getFileHistory(filePath: string): Promise<Commit[]> {
const result = await execAsync(
`git log --follow --format="%H|%an|%ad|%s" -- "${filePath}"`,
{ cwd: this.repoPath }
);
return this.parseLog(result.stdout);
}
// ่ทๅๅๆด่ฎฐๅฝ
async getChanges(filePath: string): Promise<Change[]> {
const result = await execAsync(
`git log -p -- "${filePath}"`,
{ cwd: this.repoPath }
);
return this.parseDiff(result.stdout);
}
// ่ทๅไฝ่
ไฟกๆฏ
async getAuthors(filePath: string): Promise<Author[]> {
const result = await execAsync(
`git log --format="%an" -- "${filePath}" | sort | uniq -c | sort -rn`,
{ cwd: this.repoPath }
);
return this.parseAuthors(result.stdout);
}
}// packages/adapters/tree-sitter-adapter/src/index.ts
import Parser from 'tree-sitter';
import TypeScript from 'tree-sitter-typescript';
export class TreeSitterAdapter {
private parser: Parser;
private languageMap: Map<string, Parser.Language>;
constructor() {
this.parser = new Parser();
this.languageMap = new Map([
['typescript', TypeScript.typescript],
['tsx', TypeScript.tsx],
['javascript', TypeScript.javascript]
]);
}
parse(code: string, language: string): Parser.Tree {
const lang = this.languageMap.get(language);
if (!lang) {
throw new Error(`Unsupported language: ${language}`);
}
this.parser.setLanguage(lang);
return this.parser.parse(code);
}
// ๆๅๅฝๆฐๅฎไน
extractFunctions(tree: Parser.Tree): FunctionNode[] {
const query = new Parser.Query(
this.parser.getLanguage(),
`
(function_declaration
name: (identifier) @name
parameters: (formal_parameters) @params
body: (statement_block) @body) @function
(arrow_function
parameters: (formal_parameters) @params
body: (_) @body) @function
`
);
const matches = query.matches(tree.rootNode);
return matches.map(match => this.parseFunctionNode(match));
}
// ๆๅ็ฑปๅฎไน
extractClasses(tree: Parser.Tree): ClassNode[] {
// ็ฑปไผผๅฎ็ฐ
}
}- ้กน็ฎ่ๆๆถๆญๅปบ
- Coreๅ
ๅบ็กๅฎ็ฐ
- Ingestion Engine
- Voxelization Engine
- LOD Manager
- Context Aggregator
- Sharedๅ ็ฑปๅๅฎไน
- CLIๅบ็กๅฝไปค
- SDKๅบ็กAPI
- ๅๅ ๆต่ฏ่ฆ็
- MCP Serverๅฎ็ฐ
- LSP Adapter
- Git Adapter
- Tree-sitter Adapter
- VS Code Extension MVP
- ๆๆกฃ็ฝ็ซ
- ๅค่ฏญ่จๆฏๆ๏ผPython, Go, Rust๏ผ
- JetBrains Plugin
- Web UI
- ๆง่ฝไผๅ
- ็คพๅบ็คบไพ
- ๅ่ฎฎ่ง่ๅฎๅ
- W3C/Linux Foundationๆไบค
- ไผไธ็บงๅ่ฝ
- Cloud Service
| ๅฑ็บง | ๆๆฏ |
|---|---|
| ่ฏญ่จ | TypeScript 5.4+ |
| ่ฟ่กๆถ | Node.js 20+ |
| ๆๅปบ | tsc + esbuild |
| ๆต่ฏ | Jest |
| ๅ ็ฎก็ | pnpm workspaces |
| ไปฃ็ ่ดจ้ | ESLint + Prettier |
packages/{name}/
โโโ src/
โ โโโ index.ts # ๅ
ฅๅฃๆไปถ
โ โโโ {feature}/ # ๅ่ฝๆจกๅ
โ โ โโโ index.ts
โ โ โโโ *.ts
โ โโโ utils/ # ๅทฅๅ
ทๅฝๆฐ
โโโ tests/
โ โโโ *.test.ts
โโโ package.json
โโโ tsconfig.json
โโโ README.md
- Package:
@semanticvoxelprotocol/{name} - Class:
PascalCase - Interface:
PascalCase - Function:
camelCase - Constant:
UPPER_SNAKE_CASE - Type:
PascalCase
- ้ตๅพชSemVer
- Alpha:
0.x.x-alpha.x - Beta:
0.x.x-beta.x - RC:
0.x.x-rc.x - Stable:
1.x.x