12. Cognition Layer — Skills

The Cognition Layer's Skills subsystem is iFay's "capability library" — it manages hardware drivers, externally registered skills, and inherent capabilities, giving iFay extensible action abilities.


12.1 Device Driver Hub

One-Line Definition

The Device Driver Hub is iFay's motor nerves — if hardware is iFay's "limbs," the Device Driver Hub is the motor nervous system connecting the brain to the limbs. It ensures iFay can correctly control various hardware devices, and that new devices can be connected without needing to "relearn how to walk."

Why It's Needed

Imagine your body: your brain wants to pick up a cup from the table, and it doesn't need to know how every fiber in your arm muscles contracts — the motor nerves translate the intent "pick up the cup" into precise muscle commands. Even better, when you first learn to ride a bicycle, your brain doesn't need to relearn how to walk — new motor skills are "layered on top of" existing neural pathways without destroying existing capabilities.

iFay faces the same situation with the hardware world. Smart bulbs, air conditioners, curtains, robot vacuums, drones… each device has its own "language" and control method. If iFay had to restructure its internals every time a new device was connected, it would be as absurd as having to relearn walking every time you learn a new movement.

The Device Driver Hub solves exactly this problem. It's a hub layer, not a specific driver program or a simple collection of drivers. It provides a standardized interface that lets any new device driver plug in seamlessly, while iFay's other modules remain completely unaware of the change.

How It Works

The Device Driver Hub's operation can be summarized in three keywords: Standardized, Transparent, Graceful Degradation.

1. Standardized — Unified interface contract

Whether it's a smart bulb or an industrial robotic arm, every device driver must follow the same interface specification when connecting:

  • Register Driver: New device drivers declare their type, capabilities, and supported commands
  • Invoke Device: Control any registered device through a unified command format
  • Query Status: Check whether a driver is functioning normally at any time

2. Transparent — Completely transparent to other modules

When a new device driver is added to iFay, other iFay modules (Sensor, Invoke Skill, Self-driven Behavior, etc.) don't need any modifications at all. The Driver Hub "absorbs" all hardware differences, exposing only a unified interface externally.

3. Graceful Degradation — Driver failure won't crash iFay

What if a device driver fails to load or a device goes offline? The Driver Hub won't let the entire iFay become paralyzed. It will:

  • Report the driver's unavailable status to iFay
  • Provide degradation suggestions (e.g., "air conditioner driver offline, suggest using the AC remote control APP via simulated operation")
  • Control of other devices remains completely unaffected

Relationships with Other Modules

Related ModuleRelationshipHuman Body Analogy
SensorSensor's actual hardware interfaces are managed by the Device Driver HubNerve endings' signals transmitted through motor nerves
Invoke SkillWhen Invoke Skill executes hardware-related tasks, it controls devices through the Driver HubBrain issues command → motor nerves execute
Personal Data HeapData generated by devices is collected through the Driver Hub and ultimately stored in the Personal Data HeapSensory signals → memory storage
CAP ProtocolThe Driver Hub obtains hardware control permissions through CAP ProtocolMotor nerves' "authorization channel"
Registered SkillSome Registered Skills need hardware capabilities, achieved indirectly through the Driver HubLearned skills need motor nerves to perform

Scenario Stories

Scenario 1: iFay Controlling Smart Home

At 8 PM, you tell iFay: "Set my home to movie mode."

iFay understands your intent, then simultaneously controls multiple devices through the Device Driver Hub:

  • Smart bulb driver: Dims living room lights to 20%, switches color temperature to warm yellow
  • Air conditioner driver: Sets temperature to 24°C, reduces fan speed to minimum (quiet mode)
  • Smart curtain driver: Closes curtains to block external light
  • Projector driver: Powers on projector, switches to HDMI input source

These four devices are from different brands, using different communication protocols (WiFi, Bluetooth, Zigbee), but iFay doesn't need to know about these differences at all. The Device Driver Hub shields all the complexity.

Scenario 2: New Robot Vacuum — Plug and Play

You buy a new robot vacuum and bring it home. After connecting it to your home network, iFay discovers the new hardware through the terminal device.

  1. The terminal device scans the new robot vacuum and reports its information to iFay
  2. The Device Driver Hub automatically loads the robot vacuum's driver (registered through the standardized interface)
  3. Once driver registration is complete, iFay immediately gains the ability to control the robot vacuum

The next morning when you leave for work, iFay's Self-driven Behavior module determines "Human Prime left, good time to clean," and starts the robot vacuum through the Device Driver Hub.

For Developers

The Device Driver Hub belongs to Phase 2 (Direct Client Takeover) as a core module, depending on CAP Protocol.

  • Requirement ID: Requirement 8 (Device Driver Hub)
  • Interface Specification: DeviceDriverHub interface with four core methods: registerDriver() (register driver), invokeDevice() (invoke device), getDriverStatus() (query status), and unregisterDriver() (unregister driver)
  • Driver States: loaded, active, error, unavailable
  • Related Protocols: CAP (Control Authority Protocol) for directly calling terminal hardware drivers, local interfaces, and commands
  • Related Modules: Sensor (SensorModule)'s hardware interfaces are managed by the Driver Hub; Personal Data Heap (PersonalDataHeap) stores device data
  • Design Points: The Driver Hub is a hub layer, not a single driver or driver collection; standardized interfaces ensure new driver integration is transparent to other modules; provides degradation suggestions rather than system crash when driver loading fails
  • Conformance Testing: iFACTS L1 validates driver registration and invocation capabilities; L2 validates interface integration with Sensor and Personal Data Heap; L4 validates degradation behavior when drivers fail

12.2 Registered Skill

One-Line Definition

Registered Skill is iFay's skill certification — just as humans need a driver's license to drive or a medical license to practice medicine, iFay needs to "register" a skill before it can use it. Registration isn't just record-keeping — it's pre-authorization, ensuring no additional authentication is needed at execution time.

Why It's Needed

Think about your experience going to the hospital. You wouldn't ask a random passerby to perform surgery on you — you need a doctor with a professional license. That license means: this person has undergone professional training, passed exams, and obtained a medical permit. With this license, they can treat you directly without having to re-prove their competence every time.

iFay's Registered Skill works the same way. iFay can do many things — call translation APIs, execute workflows, launch a Bot, use an APP… but before doing anything, that skill must first be "registered." The registration process is like obtaining a certification:

  • Confirm capability: What type is this skill? What can it do?
  • Complete pre-authorization: Obtain usage permission in advance, so the actual execution doesn't need to go through the authentication process again
  • Record on file: iFay's Profile records all registered skills, like listing all certifications on your resume

iFay supports six skill types: API, Workflow, Bot, Agent, APP, Microservice. Regardless of type, registration is the prerequisite for use — no registration, no execution rights.

How It Works

Registered Skill's operation can be summarized in four keywords: Register, Pre-authorize, Cache, Refresh.

1. Register — Skill "onboarding"

When iFay needs to use a new skill, it first completes registration. The registration process records key information:

  • Skill name and type (one of six: API, Workflow, Bot, Agent, APP, Microservice)
  • Skill's access endpoint (where to call it)
  • Authentication method required
  • Capability description (what it can do)

2. Pre-authorize — Get the "pass" in advance

The core value of registration is pre-authorization. During registration, iFay completes all authentication steps in advance — obtaining access tokens, establishing secure connections, verifying permissions. This way, when execution is actually needed, iFay can call directly with zero delay.

3. Cache — Works offline too

iFay isn't always online. When iFay is offline (e.g., you're on a plane), the Registered Skill module caches pending actions. When the network recovers, these cached actions are executed asynchronously.

4. Refresh — Keep authorization valid

Pre-authorization isn't permanent. Access tokens expire, permissions may change. The Registered Skill module periodically refreshes authorization status, ensuring each skill's permissions are valid when called.

Relationships with Other Modules

Related ModuleRelationshipHuman Body Analogy
Invoke SkillInvoke Skill can only call registered skills; registration is the prerequisite for executionMust have a license before practicing
Credentials ManagementRegistered Skill pre-authorization depends on authentication credentials from Credentials ManagementNeed ID to apply for certifications
Internal SkillRegistered Skills are externally learned capabilities; Internal Skills are innate capabilities — complementaryEarned certifications vs. natural intuition
Self-driven BehaviorSelf-driven Behavior also calls registered skills when autonomously executing tasksSpontaneous action also requires corresponding capability
iFay ProfileAll registered skills are recorded in the Profile's skills dimensionCertification list on your resume

Scenario Stories

Scenario 1: Registering a Translation API — Instant Response Through Pre-authorization

You frequently communicate with overseas clients, so you have iFay register a professional translation API skill.

During registration, iFay completes:

  • Records the translation API's type (API skill), endpoint address, and capability description
  • Uses your delegated credentials to complete API authentication and obtain an access token
  • Securely stores the token, marking pre-authorization status as "completed"

A week later, you receive a Japanese email. You tell iFay: "Translate this email for me."

Because the translation skill was already registered and pre-authorized, iFay immediately calls the translation API — two seconds later, the translation result is presented to you. No pop-ups asking for passwords, no spinning authentication wheels — everything was prepared during registration.

Scenario 2: Offline Caching on a Plane

You're on a flight to New York, phone in airplane mode. During the flight, you think of several things for iFay to handle:

  • "Send an email to Director Zhang confirming next Wednesday's meeting time"
  • "Book the highest-rated Japanese restaurant near the New York hotel"
  • "Check tomorrow's weather in New York"

iFay receives these three requests. Sending email requires the email API skill, booking a restaurant requires the dining reservation skill, checking weather requires the weather query skill — all three are already registered, but there's no network now.

The Registered Skill module caches these three pending actions and tells you: "Got it. These three things need internet to complete — I'll handle them immediately after landing."

The plane lands, you turn on your phone, network recovers. The Registered Skill module detects the connection is back and immediately executes the three cached actions asynchronously: email sent, restaurant booked, weather information pushed to you.

For Developers

Registered Skill belongs to Phase 2 (Direct Client Takeover) as a core module.

  • Requirement ID: Requirement 9 (Registered Skill Management)
  • Interface Specification: RegisteredSkillManager interface with five core methods: register() (register skill), query() (query skill), refreshAuthorization() (refresh authorization), cacheOfflineAction() (cache offline action), and flushCachedActions() (execute cached actions)
  • Six Skill Types: api, workflow, bot, agent, app, microservice
  • Pre-authorization Status: pre_authorized, pending, expired
  • Related Modules: Invoke Skill (InvokeSkillService) consumes registered skills; Credentials Management (CredentialManager) provides authentication support; Internal Skill (InternalSkill) provides complementary capabilities
  • Design Points: Registration is the prerequisite for any action; pre-authorization completes during registration, ensuring zero delay at execution time; offline caching supports asynchronous execution; authorization status refreshed periodically
  • Conformance Testing: iFACTS L1 validates registration and pre-authorization for six skill types; L2 validates interface integration with Invoke Skill and Credentials Management; L3 validates the complete offline caching and recovery execution flow

12.3 Internal Skill

One-Line Definition

Internal Skill is iFay's intuition and bottom line — Registered Skills are capabilities iFay learned externally (like earned certifications), while Internal Skills are capabilities iFay was born with (like intuition and moral compass). They ensure external skill outputs don't violate the Human Prime's intent.

Why It's Needed

Imagine you hired a translator. The translator is technically excellent, but they don't know you — they might translate your business email too casually, or use overly direct phrasing when you need to be diplomatic. The translation "skill" is fine, but the translation "style" isn't your style.

What you need isn't a different translator, but someone who knows you to review the translation results — "this sentence doesn't sound like something I'd say, change it" or "this tone is too aggressive, soften it." That "person who knows you" is Internal Skill.

Internal Skill does three things:

First, establishes habits aligned with the Human Prime's personality, including governance of external skill outputs. Like your intuition telling you "something's off," Internal Skill performs an "intuition check" on external skill outputs — does this result match the Human Prime's style? Their values? If not, intercept and adjust.

Second, provides introspection mechanisms to ensure external knowledge doesn't conflict with the Human Prime's intent. iFay acquires vast amounts of information from external knowledge bases, but not all information suits the Human Prime. Internal Skill acts as a "filter," ensuring external knowledge passes through the Human Prime's intent verification before being adopted by iFay.

Third, embeds the Human Prime's specific inherent capabilities. If you're a financial analyst, your iFay should inherently possess financial analysis capabilities — this isn't a skill registered from outside, but a "professional quality" iFay was born with. These capabilities are embedded during iFay initialization based on the Human Prime's professional background and expertise.

In short: Registered Skills are iFay's "external martial arts," Internal Skills are iFay's "internal cultivation." External arts can continuously learn new techniques, but internal cultivation determines how those techniques are used, to what degree, and when they shouldn't be used.

How It Works

Internal Skill's operation can be summarized in three keywords: Govern, Introspect, Empower.

1. Govern — "Intuition check" on external skill outputs

Whenever a Registered Skill completes a task and returns results, Internal Skill reviews the output:

  • Does this result's tone and style match the Human Prime's habits?
  • Does this result violate the Human Prime's values or preferences?
  • Does this result exceed the boundaries set by the Human Prime?

If issues are found, Internal Skill intercepts the output and adjusts it based on the Human Prime profile. Only the adjusted result is presented to the Human Prime or used for subsequent operations.

2. Introspect — Ensure external knowledge doesn't "mislead" iFay

iFay acquires vast amounts of information and suggestions from external knowledge bases. But external knowledge is generic and may not suit you. Internal Skill's introspection mechanism checks:

  • Does this external knowledge conflict with the Human Prime's existing cognition?
  • Would adopting this knowledge cause iFay's behavior to deviate from the Human Prime's intent?
  • Is this knowledge source trustworthy?

3. Empower — Embed the Human Prime's professional capabilities

If you're a financial analyst, your iFay doesn't need to "register" a financial analysis skill — this capability is embedded during iFay initialization. It includes:

  • Your professional knowledge system (financial models, market analysis methods, etc.)
  • Your analysis style (conservative vs. aggressive)
  • Your industry experience (intuitive judgments about specific markets)

These capabilities aren't called through external APIs — they're an intrinsic part of iFay.

Relationships with Other Modules

Related ModuleRelationshipHuman Body Analogy
Registered SkillInternal Skill governs Registered Skill outputs, ensuring results match the Human Prime's styleIntuition reviews external advice
External KnowledgeInternal Skill's introspection mechanism reviews external knowledge, preventing conflicts with Human Prime's intentSelectively filtering external information with your own judgment
Aligned ConsciousnessInternal Skill's behavioral baseline comes from the Human Prime profile maintained by Aligned ConsciousnessSelf-awareness determines intuitive reactions
Ego ModelEgo shapes iFay's personality; Internal Skill enforces personality constraints at the skill levelPersonality determines behavioral style
Self-driven BehaviorSelf-driven Behavior relies on Internal Skill's persistent capabilities when autonomously executing tasksSpontaneous action relies on instinct and professional quality

Scenario Stories

Scenario 1: Style Correction of Translation Results

You're a tech company CEO who communicates with partners in a warm but professional tone. Today you ask iFay to reply to an English email.

iFay calls the registered translation API skill, translating your Chinese draft into English. The translation is grammatically and lexically correct, but the tone is too direct — "We need the report by Friday."

Internal Skill intervenes. Based on your communication style profile in Aligned Consciousness, it judges this sentence's tone doesn't match your habits. You typically express the same meaning more diplomatically. So Internal Skill adjusts it to: "Would it be possible to have the report ready by Friday? That would be really helpful for our planning."

You see the adjusted result, satisfied, and hit send. You didn't even notice iFay made this adjustment — because the adjusted result is exactly what you would say. This is Internal Skill's value: it makes iFay's output sound like you, not just be correct.

Scenario 2: A Financial Analyst's Inherent Capabilities

You're a senior financial analyst, and your iFay had your professional capabilities embedded as Internal Skills during initialization.

One day, your assistant sends a market analysis report through iFay for your review. iFay uses the financial analysis capabilities embedded in Internal Skill to quickly scan the report:

  • The report uses a DCF (Discounted Cash Flow) valuation model, but you typically prefer combining DCF with comparable company analysis
  • The report's growth expectations for a certain industry are overly optimistic, inconsistent with your decade of industry experience
  • The report's risk assessment section is missing geopolitical factors, which you've always considered a key variable in the current market

iFay compiles these findings as annotations alongside the report: "This report is generally good, but there are three areas that might need your attention…"

Note: iFay didn't call any external financial analysis API — these judgments come entirely from the professional knowledge and analysis style embedded in Internal Skill. This is the difference between Internal Skill and Registered Skill: Registered Skills are capabilities "borrowed" from outside; Internal Skills are capabilities that are iFay's "own."

For Developers

Internal Skill belongs to Phase 4 (iFay + coFay Full Personification) as a core module.

  • Requirement ID: Requirement 15 (Internal Skill)
  • Interface Specification: InternalSkill interface with three core methods: introspect() (introspection check), intercept() (intercept and adjust external output), and getHostCapabilities() (get Human Prime-specific capabilities)
  • Three Responsibilities: (1) Establish habits aligned with Human Prime's personality, govern external skill outputs; (2) Introspection mechanism ensures external knowledge doesn't conflict with Human Prime's intent; (3) Embed Human Prime-specific inherent capabilities (professional skills, expertise)
  • Related Modules: Registered Skill (RegisteredSkillManager) outputs are governed by Internal Skill; External Knowledge (ExternalKnowledge) outputs are reviewed by Internal Skill; Aligned Consciousness (AlignedConsciousness) provides behavioral baseline
  • Difference from Registered Skill: Registered Skills are externally acquired capabilities (require registration and pre-authorization); Internal Skills are innate capabilities (embedded during initialization, no registration needed)
  • Design Points: Internal Skill is a "gatekeeper" role, performing style and intent verification on external outputs; introspection mechanism prevents external knowledge from "misleading" iFay; embedded Human Prime capabilities are iFay's core competency
  • Conformance Testing: iFACTS L1 validates introspection and interception capabilities; L2 validates output review interfaces with Registered Skill and External Knowledge; L4 validates whether external output adjustments truly match the Human Prime profile