-
Notifications
You must be signed in to change notification settings - Fork 0
Build CompText Universe inside Hugging Face Space #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
2c9d603
docs(hf-space): specify CompText Universe design
ProfRandom92 10c9223
docs(hf): add CompText Universe implementation plan
ProfRandom92 5b5dd17
feat(hf): add static CompText universe snapshot
ProfRandom92 4df00a0
feat(hf): add universe snapshot loader
ProfRandom92 df0bc16
feat(hf): add deterministic AIR and Evidence previews
ProfRandom92 8fceab7
test(hf): cover universe snapshot contracts
ProfRandom92 b7a5668
test(hf): cover AIR and Evidence previews
ProfRandom92 9c797d6
feat(hf): build CompText Universe explorer UI
ProfRandom92 de1d768
docs(hf): present CompText Universe Space
ProfRandom92 8023b68
test(hf): enforce Space safety boundaries
ProfRandom92 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,38 +1,54 @@ | ||
| --- | ||
| title: CompText Prompt Compression Lab | ||
| emoji: 🗜️ | ||
| colorFrom: blue | ||
| colorTo: purple | ||
| title: CompText Universe | ||
| emoji: 🧭 | ||
| colorFrom: indigo | ||
| colorTo: blue | ||
| sdk: gradio | ||
| python_version: 3.10.13 | ||
| sdk_version: 5.44.1 | ||
| app_file: app.py | ||
| fullWidth: true | ||
| header: mini | ||
| pinned: false | ||
| license: apache-2.0 | ||
| short_description: Explore CompText architecture, contracts and safe context compression. | ||
| models: | ||
| - microsoft/llmlingua-2-bert-base-multilingual-cased-meetingbank | ||
| tags: | ||
| - context-engineering | ||
| - prompt-compression | ||
| - software-engineering | ||
| - gradio | ||
| preload_from_hub: | ||
| - microsoft/llmlingua-2-bert-base-multilingual-cased-meetingbank | ||
| --- | ||
|
|
||
| # CompText Prompt Compression Lab | ||
| # CompText Universe | ||
|
|
||
| A CPU-friendly Hugging Face Space for evaluating prompt and context compression with Microsoft LLMLingua-2. | ||
| > Models are providers. Context is the product. Evidence is the trust layer. CompText is the kernel. | ||
|
|
||
| ## Features | ||
| A public, experimental showcase for the CompText local engineering-orchestration architecture. The real CompText runtime remains local; this Space visualizes architecture and contracts, builds non-executable AIR and simulated Evidence previews, and tests fail-closed context compression. | ||
|
|
||
| - Compress arbitrary prompts at configurable retention rates | ||
| - Compare original and compressed text | ||
| - Measure token reduction and runtime | ||
| - Check preservation of negations, CLI flags, file paths, JSON keys, version numbers, and code-like symbols | ||
| - Run a built-in benchmark suite | ||
| - Export results as JSON | ||
| ## Included surfaces | ||
|
|
||
| ## Default model | ||
| - Static seven-layer architecture explorer | ||
| - Explicit capability maturity matrix | ||
| - Workspace skill and safety-boundary explorer | ||
| - Fail-closed hybrid LLMLingua-2 compression | ||
| - Deterministic, non-executable AIR previews | ||
| - Simulated, non-persistent Evidence previews | ||
| - CompText-specific benchmark and JSON exports | ||
|
|
||
| `microsoft/llmlingua-2-bert-base-multilingual-cased-meetingbank` | ||
| ## Hard boundaries | ||
|
|
||
| The first startup can take several minutes because the model must be downloaded. | ||
| - No provider calls | ||
| - No repository writes | ||
| - No runtime GitHub access | ||
| - No API keys or runtime secrets | ||
| - No AIR execution | ||
| - No persistent prompt storage | ||
| - No claim that planned or scaffolded components are production-ready | ||
|
|
||
| ## Hardware | ||
| ## Runtime | ||
|
|
||
| Designed for Hugging Face Spaces `CPU Basic` (2 vCPU, 16 GB RAM, 50 GB ephemeral storage). | ||
|
|
||
| ## Safety | ||
|
|
||
| This Space does not call external LLM APIs, require runtime secrets, access private repositories, or modify repositories. | ||
| Only compression callbacks request ZeroGPU. Universe navigation, preview construction, contract views and secret-pattern checks are CPU-only and deterministic. The model is preloaded from the Hub during build to reduce first-request latency. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| { | ||
| "snapshot_version": "1.0", | ||
| "product": { | ||
| "name": "CompText", | ||
| "repository_name": "comptext", | ||
| "status": "local-dry-run-mvp", | ||
| "claim": "Models are providers. Context is the product. Evidence is the trust layer. CompText is the kernel.", | ||
| "description": "A local AI orchestration platform for software engineering. This public Space is an experimental, non-executing showcase." | ||
| }, | ||
| "source": { | ||
| "repository": "ProfRandom92/Comptext", | ||
| "mode": "committed-static-snapshot", | ||
| "runtime_github_access": false, | ||
| "allowed_sources": [ | ||
| "AGENTS.md", | ||
| "docs/COMPTEXT_ARCHITECTURE_v1.md", | ||
| ".agents/skills/comptext-local-autonomy/SKILL.md", | ||
| ".agents/skills/comptext-local-verify/SKILL.md", | ||
| ".agents/skills/comptext-workspace-validation/SKILL.md", | ||
| ".agents/skills/comptext-status/SKILL.md", | ||
| ".agents/skills/workspace-state/SKILL.md" | ||
| ] | ||
| }, | ||
| "boundaries": [ | ||
| "No provider calls", | ||
| "No repository writes", | ||
| "No runtime GitHub access", | ||
| "No secrets or environment access", | ||
| "No AIR execution", | ||
| "No persistent user input storage" | ||
| ], | ||
| "layers": [ | ||
| {"id":"ui","name":"Terminal OS / UI","status":"scaffolded","purpose":"Human-facing workbench for sessions, workspaces, commands, providers, evidence and run queues.","inputs":"user intent","outputs":"normalized commands and views"}, | ||
| {"id":"runtime","name":"Runtime","status":"scaffolded","purpose":"Coordinates runs, plans, verification, retries, queues and replay.","inputs":"AIR plans","outputs":"run state and events"}, | ||
| {"id":"gateway","name":"Gateway","status":"planned","purpose":"Normalizes local provider-compatible message and response routes.","inputs":"local API requests","outputs":"normalized traffic"}, | ||
| {"id":"agent-bus","name":"Agent Bus","status":"planned","purpose":"Coordinates specialized agents as explicit tasks with approval gates.","inputs":"tasks and roles","outputs":"task results and evidence"}, | ||
| {"id":"air","name":"AIR","status":"scaffolded","purpose":"Describes intended work before execution: goal, context, tools, constraints, permissions and outputs.","inputs":"intent and context","outputs":"non-executed plan contract"}, | ||
| {"id":"evidence","name":"Evidence","status":"scaffolded","purpose":"Records what actually happened without secrets, raw provider payloads or hidden reasoning.","inputs":"runtime and validation events","outputs":"redacted evidence events"}, | ||
| {"id":"memory","name":"Memory / Knowledge Graph","status":"future","purpose":"Structured workspace knowledge spanning files, functions, tests, runs and evidence.","inputs":"validated workspace state","outputs":"retrievable context relationships"} | ||
| ], | ||
| "capabilities": [ | ||
| {"name":"Local status","surface":"CLI","status":"implemented","network":"no","provider":"no","mutating":"no"}, | ||
| {"name":"Local verification","surface":"CLI","status":"implemented","network":"no","provider":"no","mutating":"no"}, | ||
| {"name":"Workspace schema validation","surface":"CLI","status":"implemented","network":"no","provider":"no","mutating":"no"}, | ||
| {"name":"Hybrid context compression","surface":"HF Space","status":"experimental","network":"model-cache","provider":"no","mutating":"no"}, | ||
| {"name":"AIR preview","surface":"HF Space","status":"experimental","network":"no","provider":"no","mutating":"no"}, | ||
| {"name":"Simulated Evidence preview","surface":"HF Space","status":"experimental","network":"no","provider":"no","mutating":"no"}, | ||
| {"name":"Provider Router","surface":"Kernel","status":"scaffolded","network":"disabled","provider":"not_configured","mutating":"no"}, | ||
| {"name":"Workspace reflection runtime","surface":"Kernel","status":"future","network":"no","provider":"no","mutating":"local"}, | ||
| {"name":"Autonomous PR merge","surface":"Agent workflow","status":"disabled","network":"yes","provider":"no","mutating":"yes"} | ||
| ], | ||
| "skills": [ | ||
| {"name":"comptext-local-autonomy","purpose":"One-unit-at-a-time offline development loop.","validation":"python -m pytest; git diff --check","boundary":"No network, providers, secrets, GitHub writes or servers."}, | ||
| {"name":"comptext-local-verify","purpose":"Verify status, subagents, workspace validation and doctor diagnostics.","validation":"comptext verify --dry-run","boundary":"Offline dry-run checks only."}, | ||
| {"name":"comptext-workspace-validation","purpose":"Validate committed workspace examples against strict schemas.","validation":"comptext validate workspace --dry-run","boundary":"No active generation, network, databases or providers."}, | ||
| {"name":"comptext-status","purpose":"Show file presence and local diagnostic state.","validation":"comptext status --dry-run","boundary":"Offline local-only data collection."}, | ||
| {"name":"workspace-state","purpose":"Define future snapshot, delta and reflection-gate concepts.","validation":"schema and fixture validation","boundary":"No active runtime or interpretability claims."} | ||
| ], | ||
| "contracts": [ | ||
| {"name":"AIR Plan","kind":"intent","fields":"version, intent, goal, context, files, tools, permissions, expected_outputs, metadata","execution":"never in this Space"}, | ||
| {"name":"Evidence Event","kind":"observed-event","fields":"event_id, run_id, type, actor, tool, summary, hashes, timestamp, redaction","execution":"simulated preview only"}, | ||
| {"name":"Run Record","kind":"run-index","fields":"run_id, air_hash, status, start_time, end_time, event_hashes, metrics","execution":"not created in this Space"}, | ||
| {"name":"Workspace Snapshot","kind":"workspace-state","fields":"schema-defined local state","execution":"static concept preview only"} | ||
| ] | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The object returned for the
compression_metricsUI component is inconsistent. In this 'secret detected' case, you return apayloaddictionary with lowercase keys. In the successful compression case, you return ametricsdictionary with capitalized keys and a different structure. This can be confusing for the UI and any programmatic consumers.I suggest creating a
metricsdictionary here that is consistent with the one in the success path, and use that for the UI component, while keeping thepayloadfor the raw JSON output.