If we look at magical knack, it states:
Pick a class when you gain this trait—your caster level in that class gains a +2 trait bonus as long as this bonus doesn’t raise your caster level above your current Hit Dice.
Hit Dice are defined as:
Hit Dice represent a creature’s general level of power and skill. As a creature gains levels, it gains additional Hit Dice. Monsters, on the other hand, gain racial Hit Dice, which represent the monster’s general prowess and ability. Hit Dice are represented by the number the creature possesses followed by a type of die, such as “3d8.” This value is used to determine a creature’s total hit points. In this example, the creature has 3 Hit Dice. When rolling for this creature’s hit points, you would roll a d8 three times and add the results together, along with other modifiers.
So as an Arcanist 2/Rogue 1 you gain:
- 2 Hit Dice from Arcanist (1d6 twice for 2d6).
- 1 Hit Dice from Rogue (1d8).
This gives you a total of 3 Hit dice, and a caster level of 2 for Arcanist.
If we look at Magical knack, you get a +2 trait bonus to caster level for Arcanist as long as it would not raise your caster level above your total hit dice.
Unfortunately, 2 + 2 = 4, and 4 > 3. This means that magical knack will have no effect on your caster level currently.
You seem to be confused on how Caster level works.
o a level 2 arcanist with Magical Knack would make spell learned at caster level 2 be cast as if my caster level was 4. But what happens when I'm level 8? Since my HD is d6, the bonus would only work on spells learned from a caster level of 1 (operates as if caster level 3) to 4 (operates as if caster level 6). Does that mean a spell learned at caster level 8 wouldn't benefit from the bonus?
You don't learn spells at a specific caster level, a spell is cast at the caster level of the class that is casting the spell.
Casting spells:
A spell’s power often depends on its caster level, which for most spellcasting characters is equal to her class level in the class she’s using to cast the spell.
As a side note, I recommend that you take Unchained Rogue over rogue. It's just a better class overall.